@appwrite.io/console 0.0.2-preview-0.0 → 0.1.0-preview-0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.travis.yml +32 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/sdk.js +602 -15
  4. package/dist/cjs/sdk.js.map +1 -1
  5. package/dist/esm/sdk.js +602 -15
  6. package/dist/esm/sdk.js.map +1 -1
  7. package/dist/iife/sdk.js +602 -15
  8. package/docs/examples/databases/create-relationship-attribute.md +18 -0
  9. package/docs/examples/databases/update-boolean-attribute.md +18 -0
  10. package/docs/examples/databases/update-datetime-attribute.md +18 -0
  11. package/docs/examples/databases/update-email-attribute.md +18 -0
  12. package/docs/examples/databases/update-enum-attribute.md +18 -0
  13. package/docs/examples/databases/update-float-attribute.md +18 -0
  14. package/docs/examples/databases/update-integer-attribute.md +18 -0
  15. package/docs/examples/databases/update-ip-attribute.md +18 -0
  16. package/docs/examples/databases/update-relationship-attribute.md +18 -0
  17. package/docs/examples/databases/update-string-attribute.md +18 -0
  18. package/docs/examples/databases/update-url-attribute.md +18 -0
  19. package/docs/examples/functions/create.md +1 -1
  20. package/docs/examples/functions/update.md +1 -1
  21. package/docs/examples/teams/get-prefs.md +18 -0
  22. package/docs/examples/teams/update-name.md +18 -0
  23. package/docs/examples/teams/update-prefs.md +18 -0
  24. package/docs/examples/teams/update.md +1 -1
  25. package/package.json +1 -1
  26. package/src/client.ts +1 -1
  27. package/src/models.ts +52 -3
  28. package/src/services/account.ts +7 -7
  29. package/src/services/databases.ts +736 -108
  30. package/src/services/functions.ts +3 -11
  31. package/src/services/teams.ts +65 -7
  32. package/types/models.d.ts +52 -3
  33. package/types/services/account.d.ts +7 -7
  34. package/types/services/databases.d.ts +174 -1
  35. package/types/services/functions.d.ts +3 -3
  36. package/types/services/teams.d.ts +31 -7
  37. package/.github/workflows/publish.yml +0 -18
@@ -460,6 +460,56 @@ export class Databases extends Service {
460
460
  }, payload);
461
461
  }
462
462
 
463
+ /**
464
+ * Update Boolean Attribute
465
+ *
466
+ *
467
+ * @param {string} databaseId
468
+ * @param {string} collectionId
469
+ * @param {string} key
470
+ * @param {boolean} required
471
+ * @param {boolean} xdefault
472
+ * @throws {AppwriteException}
473
+ * @returns {Promise}
474
+ */
475
+ async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: boolean): Promise<Models.AttributeBoolean> {
476
+ if (typeof databaseId === 'undefined') {
477
+ throw new AppwriteException('Missing required parameter: "databaseId"');
478
+ }
479
+
480
+ if (typeof collectionId === 'undefined') {
481
+ throw new AppwriteException('Missing required parameter: "collectionId"');
482
+ }
483
+
484
+ if (typeof key === 'undefined') {
485
+ throw new AppwriteException('Missing required parameter: "key"');
486
+ }
487
+
488
+ if (typeof required === 'undefined') {
489
+ throw new AppwriteException('Missing required parameter: "required"');
490
+ }
491
+
492
+ if (typeof xdefault === 'undefined') {
493
+ throw new AppwriteException('Missing required parameter: "xdefault"');
494
+ }
495
+
496
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
497
+ let payload: Payload = {};
498
+
499
+ if (typeof required !== 'undefined') {
500
+ payload['required'] = required;
501
+ }
502
+
503
+ if (typeof xdefault !== 'undefined') {
504
+ payload['default'] = xdefault;
505
+ }
506
+
507
+ const uri = new URL(this.client.config.endpoint + path);
508
+ return await this.client.call('patch', uri, {
509
+ 'content-type': 'application/json',
510
+ }, payload);
511
+ }
512
+
463
513
  /**
464
514
  * Create DateTime Attribute
465
515
  *
@@ -468,12 +518,497 @@ export class Databases extends Service {
468
518
  * @param {string} collectionId
469
519
  * @param {string} key
470
520
  * @param {boolean} required
471
- * @param {string} xdefault
521
+ * @param {string} xdefault
522
+ * @param {boolean} array
523
+ * @throws {AppwriteException}
524
+ * @returns {Promise}
525
+ */
526
+ async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
527
+ if (typeof databaseId === 'undefined') {
528
+ throw new AppwriteException('Missing required parameter: "databaseId"');
529
+ }
530
+
531
+ if (typeof collectionId === 'undefined') {
532
+ throw new AppwriteException('Missing required parameter: "collectionId"');
533
+ }
534
+
535
+ if (typeof key === 'undefined') {
536
+ throw new AppwriteException('Missing required parameter: "key"');
537
+ }
538
+
539
+ if (typeof required === 'undefined') {
540
+ throw new AppwriteException('Missing required parameter: "required"');
541
+ }
542
+
543
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
544
+ let payload: Payload = {};
545
+
546
+ if (typeof key !== 'undefined') {
547
+ payload['key'] = key;
548
+ }
549
+
550
+ if (typeof required !== 'undefined') {
551
+ payload['required'] = required;
552
+ }
553
+
554
+ if (typeof xdefault !== 'undefined') {
555
+ payload['default'] = xdefault;
556
+ }
557
+
558
+ if (typeof array !== 'undefined') {
559
+ payload['array'] = array;
560
+ }
561
+
562
+ const uri = new URL(this.client.config.endpoint + path);
563
+ return await this.client.call('post', uri, {
564
+ 'content-type': 'application/json',
565
+ }, payload);
566
+ }
567
+
568
+ /**
569
+ * Update DateTime Attribute
570
+ *
571
+ *
572
+ * @param {string} databaseId
573
+ * @param {string} collectionId
574
+ * @param {string} key
575
+ * @param {boolean} required
576
+ * @param {string} xdefault
577
+ * @throws {AppwriteException}
578
+ * @returns {Promise}
579
+ */
580
+ async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeDatetime> {
581
+ if (typeof databaseId === 'undefined') {
582
+ throw new AppwriteException('Missing required parameter: "databaseId"');
583
+ }
584
+
585
+ if (typeof collectionId === 'undefined') {
586
+ throw new AppwriteException('Missing required parameter: "collectionId"');
587
+ }
588
+
589
+ if (typeof key === 'undefined') {
590
+ throw new AppwriteException('Missing required parameter: "key"');
591
+ }
592
+
593
+ if (typeof required === 'undefined') {
594
+ throw new AppwriteException('Missing required parameter: "required"');
595
+ }
596
+
597
+ if (typeof xdefault === 'undefined') {
598
+ throw new AppwriteException('Missing required parameter: "xdefault"');
599
+ }
600
+
601
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
602
+ let payload: Payload = {};
603
+
604
+ if (typeof required !== 'undefined') {
605
+ payload['required'] = required;
606
+ }
607
+
608
+ if (typeof xdefault !== 'undefined') {
609
+ payload['default'] = xdefault;
610
+ }
611
+
612
+ const uri = new URL(this.client.config.endpoint + path);
613
+ return await this.client.call('patch', uri, {
614
+ 'content-type': 'application/json',
615
+ }, payload);
616
+ }
617
+
618
+ /**
619
+ * Create Email Attribute
620
+ *
621
+ * Create an email attribute.
622
+ *
623
+ *
624
+ * @param {string} databaseId
625
+ * @param {string} collectionId
626
+ * @param {string} key
627
+ * @param {boolean} required
628
+ * @param {string} xdefault
629
+ * @param {boolean} array
630
+ * @throws {AppwriteException}
631
+ * @returns {Promise}
632
+ */
633
+ async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
634
+ if (typeof databaseId === 'undefined') {
635
+ throw new AppwriteException('Missing required parameter: "databaseId"');
636
+ }
637
+
638
+ if (typeof collectionId === 'undefined') {
639
+ throw new AppwriteException('Missing required parameter: "collectionId"');
640
+ }
641
+
642
+ if (typeof key === 'undefined') {
643
+ throw new AppwriteException('Missing required parameter: "key"');
644
+ }
645
+
646
+ if (typeof required === 'undefined') {
647
+ throw new AppwriteException('Missing required parameter: "required"');
648
+ }
649
+
650
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
651
+ let payload: Payload = {};
652
+
653
+ if (typeof key !== 'undefined') {
654
+ payload['key'] = key;
655
+ }
656
+
657
+ if (typeof required !== 'undefined') {
658
+ payload['required'] = required;
659
+ }
660
+
661
+ if (typeof xdefault !== 'undefined') {
662
+ payload['default'] = xdefault;
663
+ }
664
+
665
+ if (typeof array !== 'undefined') {
666
+ payload['array'] = array;
667
+ }
668
+
669
+ const uri = new URL(this.client.config.endpoint + path);
670
+ return await this.client.call('post', uri, {
671
+ 'content-type': 'application/json',
672
+ }, payload);
673
+ }
674
+
675
+ /**
676
+ * Update Email Attribute
677
+ *
678
+ * Update an email attribute. Changing the `default` value will not update
679
+ * already existing documents.
680
+ *
681
+ *
682
+ * @param {string} databaseId
683
+ * @param {string} collectionId
684
+ * @param {string} key
685
+ * @param {boolean} required
686
+ * @param {string} xdefault
687
+ * @throws {AppwriteException}
688
+ * @returns {Promise}
689
+ */
690
+ async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeEmail> {
691
+ if (typeof databaseId === 'undefined') {
692
+ throw new AppwriteException('Missing required parameter: "databaseId"');
693
+ }
694
+
695
+ if (typeof collectionId === 'undefined') {
696
+ throw new AppwriteException('Missing required parameter: "collectionId"');
697
+ }
698
+
699
+ if (typeof key === 'undefined') {
700
+ throw new AppwriteException('Missing required parameter: "key"');
701
+ }
702
+
703
+ if (typeof required === 'undefined') {
704
+ throw new AppwriteException('Missing required parameter: "required"');
705
+ }
706
+
707
+ if (typeof xdefault === 'undefined') {
708
+ throw new AppwriteException('Missing required parameter: "xdefault"');
709
+ }
710
+
711
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
712
+ let payload: Payload = {};
713
+
714
+ if (typeof required !== 'undefined') {
715
+ payload['required'] = required;
716
+ }
717
+
718
+ if (typeof xdefault !== 'undefined') {
719
+ payload['default'] = xdefault;
720
+ }
721
+
722
+ const uri = new URL(this.client.config.endpoint + path);
723
+ return await this.client.call('patch', uri, {
724
+ 'content-type': 'application/json',
725
+ }, payload);
726
+ }
727
+
728
+ /**
729
+ * Create Enum Attribute
730
+ *
731
+ *
732
+ * @param {string} databaseId
733
+ * @param {string} collectionId
734
+ * @param {string} key
735
+ * @param {string[]} elements
736
+ * @param {boolean} required
737
+ * @param {string} xdefault
738
+ * @param {boolean} array
739
+ * @throws {AppwriteException}
740
+ * @returns {Promise}
741
+ */
742
+ async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
743
+ if (typeof databaseId === 'undefined') {
744
+ throw new AppwriteException('Missing required parameter: "databaseId"');
745
+ }
746
+
747
+ if (typeof collectionId === 'undefined') {
748
+ throw new AppwriteException('Missing required parameter: "collectionId"');
749
+ }
750
+
751
+ if (typeof key === 'undefined') {
752
+ throw new AppwriteException('Missing required parameter: "key"');
753
+ }
754
+
755
+ if (typeof elements === 'undefined') {
756
+ throw new AppwriteException('Missing required parameter: "elements"');
757
+ }
758
+
759
+ if (typeof required === 'undefined') {
760
+ throw new AppwriteException('Missing required parameter: "required"');
761
+ }
762
+
763
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
764
+ let payload: Payload = {};
765
+
766
+ if (typeof key !== 'undefined') {
767
+ payload['key'] = key;
768
+ }
769
+
770
+ if (typeof elements !== 'undefined') {
771
+ payload['elements'] = elements;
772
+ }
773
+
774
+ if (typeof required !== 'undefined') {
775
+ payload['required'] = required;
776
+ }
777
+
778
+ if (typeof xdefault !== 'undefined') {
779
+ payload['default'] = xdefault;
780
+ }
781
+
782
+ if (typeof array !== 'undefined') {
783
+ payload['array'] = array;
784
+ }
785
+
786
+ const uri = new URL(this.client.config.endpoint + path);
787
+ return await this.client.call('post', uri, {
788
+ 'content-type': 'application/json',
789
+ }, payload);
790
+ }
791
+
792
+ /**
793
+ * Update Enum Attribute
794
+ *
795
+ * Update an enum attribute. Changing the `default` value will not update
796
+ * already existing documents.
797
+ *
798
+ *
799
+ * @param {string} databaseId
800
+ * @param {string} collectionId
801
+ * @param {string} key
802
+ * @param {string[]} elements
803
+ * @param {boolean} required
804
+ * @param {string} xdefault
805
+ * @throws {AppwriteException}
806
+ * @returns {Promise}
807
+ */
808
+ async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault: string): Promise<Models.AttributeEnum> {
809
+ if (typeof databaseId === 'undefined') {
810
+ throw new AppwriteException('Missing required parameter: "databaseId"');
811
+ }
812
+
813
+ if (typeof collectionId === 'undefined') {
814
+ throw new AppwriteException('Missing required parameter: "collectionId"');
815
+ }
816
+
817
+ if (typeof key === 'undefined') {
818
+ throw new AppwriteException('Missing required parameter: "key"');
819
+ }
820
+
821
+ if (typeof elements === 'undefined') {
822
+ throw new AppwriteException('Missing required parameter: "elements"');
823
+ }
824
+
825
+ if (typeof required === 'undefined') {
826
+ throw new AppwriteException('Missing required parameter: "required"');
827
+ }
828
+
829
+ if (typeof xdefault === 'undefined') {
830
+ throw new AppwriteException('Missing required parameter: "xdefault"');
831
+ }
832
+
833
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
834
+ let payload: Payload = {};
835
+
836
+ if (typeof elements !== 'undefined') {
837
+ payload['elements'] = elements;
838
+ }
839
+
840
+ if (typeof required !== 'undefined') {
841
+ payload['required'] = required;
842
+ }
843
+
844
+ if (typeof xdefault !== 'undefined') {
845
+ payload['default'] = xdefault;
846
+ }
847
+
848
+ const uri = new URL(this.client.config.endpoint + path);
849
+ return await this.client.call('patch', uri, {
850
+ 'content-type': 'application/json',
851
+ }, payload);
852
+ }
853
+
854
+ /**
855
+ * Create Float Attribute
856
+ *
857
+ * Create a float attribute. Optionally, minimum and maximum values can be
858
+ * provided.
859
+ *
860
+ *
861
+ * @param {string} databaseId
862
+ * @param {string} collectionId
863
+ * @param {string} key
864
+ * @param {boolean} required
865
+ * @param {number} min
866
+ * @param {number} max
867
+ * @param {number} xdefault
868
+ * @param {boolean} array
869
+ * @throws {AppwriteException}
870
+ * @returns {Promise}
871
+ */
872
+ async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
873
+ if (typeof databaseId === 'undefined') {
874
+ throw new AppwriteException('Missing required parameter: "databaseId"');
875
+ }
876
+
877
+ if (typeof collectionId === 'undefined') {
878
+ throw new AppwriteException('Missing required parameter: "collectionId"');
879
+ }
880
+
881
+ if (typeof key === 'undefined') {
882
+ throw new AppwriteException('Missing required parameter: "key"');
883
+ }
884
+
885
+ if (typeof required === 'undefined') {
886
+ throw new AppwriteException('Missing required parameter: "required"');
887
+ }
888
+
889
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
890
+ let payload: Payload = {};
891
+
892
+ if (typeof key !== 'undefined') {
893
+ payload['key'] = key;
894
+ }
895
+
896
+ if (typeof required !== 'undefined') {
897
+ payload['required'] = required;
898
+ }
899
+
900
+ if (typeof min !== 'undefined') {
901
+ payload['min'] = min;
902
+ }
903
+
904
+ if (typeof max !== 'undefined') {
905
+ payload['max'] = max;
906
+ }
907
+
908
+ if (typeof xdefault !== 'undefined') {
909
+ payload['default'] = xdefault;
910
+ }
911
+
912
+ if (typeof array !== 'undefined') {
913
+ payload['array'] = array;
914
+ }
915
+
916
+ const uri = new URL(this.client.config.endpoint + path);
917
+ return await this.client.call('post', uri, {
918
+ 'content-type': 'application/json',
919
+ }, payload);
920
+ }
921
+
922
+ /**
923
+ * Update Float Attribute
924
+ *
925
+ * Update a float attribute. Changing the `default` value will not update
926
+ * already existing documents.
927
+ *
928
+ *
929
+ * @param {string} databaseId
930
+ * @param {string} collectionId
931
+ * @param {string} key
932
+ * @param {boolean} required
933
+ * @param {number} min
934
+ * @param {number} max
935
+ * @param {number} xdefault
936
+ * @throws {AppwriteException}
937
+ * @returns {Promise}
938
+ */
939
+ async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeFloat> {
940
+ if (typeof databaseId === 'undefined') {
941
+ throw new AppwriteException('Missing required parameter: "databaseId"');
942
+ }
943
+
944
+ if (typeof collectionId === 'undefined') {
945
+ throw new AppwriteException('Missing required parameter: "collectionId"');
946
+ }
947
+
948
+ if (typeof key === 'undefined') {
949
+ throw new AppwriteException('Missing required parameter: "key"');
950
+ }
951
+
952
+ if (typeof required === 'undefined') {
953
+ throw new AppwriteException('Missing required parameter: "required"');
954
+ }
955
+
956
+ if (typeof min === 'undefined') {
957
+ throw new AppwriteException('Missing required parameter: "min"');
958
+ }
959
+
960
+ if (typeof max === 'undefined') {
961
+ throw new AppwriteException('Missing required parameter: "max"');
962
+ }
963
+
964
+ if (typeof xdefault === 'undefined') {
965
+ throw new AppwriteException('Missing required parameter: "xdefault"');
966
+ }
967
+
968
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
969
+ let payload: Payload = {};
970
+
971
+ if (typeof required !== 'undefined') {
972
+ payload['required'] = required;
973
+ }
974
+
975
+ if (typeof min !== 'undefined') {
976
+ payload['min'] = min;
977
+ }
978
+
979
+ if (typeof max !== 'undefined') {
980
+ payload['max'] = max;
981
+ }
982
+
983
+ if (typeof xdefault !== 'undefined') {
984
+ payload['default'] = xdefault;
985
+ }
986
+
987
+ const uri = new URL(this.client.config.endpoint + path);
988
+ return await this.client.call('patch', uri, {
989
+ 'content-type': 'application/json',
990
+ }, payload);
991
+ }
992
+
993
+ /**
994
+ * Create Integer Attribute
995
+ *
996
+ * Create an integer attribute. Optionally, minimum and maximum values can be
997
+ * provided.
998
+ *
999
+ *
1000
+ * @param {string} databaseId
1001
+ * @param {string} collectionId
1002
+ * @param {string} key
1003
+ * @param {boolean} required
1004
+ * @param {number} min
1005
+ * @param {number} max
1006
+ * @param {number} xdefault
472
1007
  * @param {boolean} array
473
1008
  * @throws {AppwriteException}
474
1009
  * @returns {Promise}
475
1010
  */
476
- async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
1011
+ async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
477
1012
  if (typeof databaseId === 'undefined') {
478
1013
  throw new AppwriteException('Missing required parameter: "databaseId"');
479
1014
  }
@@ -490,7 +1025,7 @@ export class Databases extends Service {
490
1025
  throw new AppwriteException('Missing required parameter: "required"');
491
1026
  }
492
1027
 
493
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1028
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
494
1029
  let payload: Payload = {};
495
1030
 
496
1031
  if (typeof key !== 'undefined') {
@@ -501,6 +1036,14 @@ export class Databases extends Service {
501
1036
  payload['required'] = required;
502
1037
  }
503
1038
 
1039
+ if (typeof min !== 'undefined') {
1040
+ payload['min'] = min;
1041
+ }
1042
+
1043
+ if (typeof max !== 'undefined') {
1044
+ payload['max'] = max;
1045
+ }
1046
+
504
1047
  if (typeof xdefault !== 'undefined') {
505
1048
  payload['default'] = xdefault;
506
1049
  }
@@ -516,21 +1059,23 @@ export class Databases extends Service {
516
1059
  }
517
1060
 
518
1061
  /**
519
- * Create Email Attribute
1062
+ * Update Integer Attribute
520
1063
  *
521
- * Create an email attribute.
1064
+ * Update an integer attribute. Changing the `default` value will not update
1065
+ * already existing documents.
522
1066
  *
523
1067
  *
524
1068
  * @param {string} databaseId
525
1069
  * @param {string} collectionId
526
1070
  * @param {string} key
527
1071
  * @param {boolean} required
528
- * @param {string} xdefault
529
- * @param {boolean} array
1072
+ * @param {number} min
1073
+ * @param {number} max
1074
+ * @param {number} xdefault
530
1075
  * @throws {AppwriteException}
531
1076
  * @returns {Promise}
532
1077
  */
533
- async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
1078
+ async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault: number): Promise<Models.AttributeInteger> {
534
1079
  if (typeof databaseId === 'undefined') {
535
1080
  throw new AppwriteException('Missing required parameter: "databaseId"');
536
1081
  }
@@ -547,46 +1092,59 @@ export class Databases extends Service {
547
1092
  throw new AppwriteException('Missing required parameter: "required"');
548
1093
  }
549
1094
 
550
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
551
- let payload: Payload = {};
1095
+ if (typeof min === 'undefined') {
1096
+ throw new AppwriteException('Missing required parameter: "min"');
1097
+ }
552
1098
 
553
- if (typeof key !== 'undefined') {
554
- payload['key'] = key;
1099
+ if (typeof max === 'undefined') {
1100
+ throw new AppwriteException('Missing required parameter: "max"');
1101
+ }
1102
+
1103
+ if (typeof xdefault === 'undefined') {
1104
+ throw new AppwriteException('Missing required parameter: "xdefault"');
555
1105
  }
556
1106
 
1107
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1108
+ let payload: Payload = {};
1109
+
557
1110
  if (typeof required !== 'undefined') {
558
1111
  payload['required'] = required;
559
1112
  }
560
1113
 
561
- if (typeof xdefault !== 'undefined') {
562
- payload['default'] = xdefault;
1114
+ if (typeof min !== 'undefined') {
1115
+ payload['min'] = min;
563
1116
  }
564
1117
 
565
- if (typeof array !== 'undefined') {
566
- payload['array'] = array;
1118
+ if (typeof max !== 'undefined') {
1119
+ payload['max'] = max;
1120
+ }
1121
+
1122
+ if (typeof xdefault !== 'undefined') {
1123
+ payload['default'] = xdefault;
567
1124
  }
568
1125
 
569
1126
  const uri = new URL(this.client.config.endpoint + path);
570
- return await this.client.call('post', uri, {
1127
+ return await this.client.call('patch', uri, {
571
1128
  'content-type': 'application/json',
572
1129
  }, payload);
573
1130
  }
574
1131
 
575
1132
  /**
576
- * Create Enum Attribute
1133
+ * Create IP Address Attribute
577
1134
  *
1135
+ * Create IP address attribute.
1136
+ *
578
1137
  *
579
1138
  * @param {string} databaseId
580
1139
  * @param {string} collectionId
581
1140
  * @param {string} key
582
- * @param {string[]} elements
583
1141
  * @param {boolean} required
584
1142
  * @param {string} xdefault
585
1143
  * @param {boolean} array
586
1144
  * @throws {AppwriteException}
587
1145
  * @returns {Promise}
588
1146
  */
589
- async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
1147
+ async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
590
1148
  if (typeof databaseId === 'undefined') {
591
1149
  throw new AppwriteException('Missing required parameter: "databaseId"');
592
1150
  }
@@ -599,25 +1157,17 @@ export class Databases extends Service {
599
1157
  throw new AppwriteException('Missing required parameter: "key"');
600
1158
  }
601
1159
 
602
- if (typeof elements === 'undefined') {
603
- throw new AppwriteException('Missing required parameter: "elements"');
604
- }
605
-
606
1160
  if (typeof required === 'undefined') {
607
1161
  throw new AppwriteException('Missing required parameter: "required"');
608
1162
  }
609
1163
 
610
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1164
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
611
1165
  let payload: Payload = {};
612
1166
 
613
1167
  if (typeof key !== 'undefined') {
614
1168
  payload['key'] = key;
615
1169
  }
616
1170
 
617
- if (typeof elements !== 'undefined') {
618
- payload['elements'] = elements;
619
- }
620
-
621
1171
  if (typeof required !== 'undefined') {
622
1172
  payload['required'] = required;
623
1173
  }
@@ -637,24 +1187,21 @@ export class Databases extends Service {
637
1187
  }
638
1188
 
639
1189
  /**
640
- * Create Float Attribute
1190
+ * Update IP Address Attribute
641
1191
  *
642
- * Create a float attribute. Optionally, minimum and maximum values can be
643
- * provided.
1192
+ * Update an ip attribute. Changing the `default` value will not update
1193
+ * already existing documents.
644
1194
  *
645
1195
  *
646
1196
  * @param {string} databaseId
647
1197
  * @param {string} collectionId
648
1198
  * @param {string} key
649
1199
  * @param {boolean} required
650
- * @param {number} min
651
- * @param {number} max
652
- * @param {number} xdefault
653
- * @param {boolean} array
1200
+ * @param {string} xdefault
654
1201
  * @throws {AppwriteException}
655
1202
  * @returns {Promise}
656
1203
  */
657
- async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
1204
+ async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeIp> {
658
1205
  if (typeof databaseId === 'undefined') {
659
1206
  throw new AppwriteException('Missing required parameter: "databaseId"');
660
1207
  }
@@ -671,31 +1218,84 @@ export class Databases extends Service {
671
1218
  throw new AppwriteException('Missing required parameter: "required"');
672
1219
  }
673
1220
 
674
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
675
- let payload: Payload = {};
676
-
677
- if (typeof key !== 'undefined') {
678
- payload['key'] = key;
1221
+ if (typeof xdefault === 'undefined') {
1222
+ throw new AppwriteException('Missing required parameter: "xdefault"');
679
1223
  }
680
1224
 
1225
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1226
+ let payload: Payload = {};
1227
+
681
1228
  if (typeof required !== 'undefined') {
682
1229
  payload['required'] = required;
683
1230
  }
684
1231
 
685
- if (typeof min !== 'undefined') {
686
- payload['min'] = min;
1232
+ if (typeof xdefault !== 'undefined') {
1233
+ payload['default'] = xdefault;
687
1234
  }
688
1235
 
689
- if (typeof max !== 'undefined') {
690
- payload['max'] = max;
1236
+ const uri = new URL(this.client.config.endpoint + path);
1237
+ return await this.client.call('patch', uri, {
1238
+ 'content-type': 'application/json',
1239
+ }, payload);
1240
+ }
1241
+
1242
+ /**
1243
+ * Create relationship Attribute
1244
+ *
1245
+ *
1246
+ * @param {string} databaseId
1247
+ * @param {string} collectionId
1248
+ * @param {string} relatedCollectionId
1249
+ * @param {string} type
1250
+ * @param {boolean} twoWay
1251
+ * @param {string} key
1252
+ * @param {string} twoWayKey
1253
+ * @param {string} onDelete
1254
+ * @throws {AppwriteException}
1255
+ * @returns {Promise}
1256
+ */
1257
+ async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: string, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: string): Promise<Models.AttributeRelationship> {
1258
+ if (typeof databaseId === 'undefined') {
1259
+ throw new AppwriteException('Missing required parameter: "databaseId"');
691
1260
  }
692
1261
 
693
- if (typeof xdefault !== 'undefined') {
694
- payload['default'] = xdefault;
1262
+ if (typeof collectionId === 'undefined') {
1263
+ throw new AppwriteException('Missing required parameter: "collectionId"');
695
1264
  }
696
1265
 
697
- if (typeof array !== 'undefined') {
698
- payload['array'] = array;
1266
+ if (typeof relatedCollectionId === 'undefined') {
1267
+ throw new AppwriteException('Missing required parameter: "relatedCollectionId"');
1268
+ }
1269
+
1270
+ if (typeof type === 'undefined') {
1271
+ throw new AppwriteException('Missing required parameter: "type"');
1272
+ }
1273
+
1274
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1275
+ let payload: Payload = {};
1276
+
1277
+ if (typeof relatedCollectionId !== 'undefined') {
1278
+ payload['relatedCollectionId'] = relatedCollectionId;
1279
+ }
1280
+
1281
+ if (typeof type !== 'undefined') {
1282
+ payload['type'] = type;
1283
+ }
1284
+
1285
+ if (typeof twoWay !== 'undefined') {
1286
+ payload['twoWay'] = twoWay;
1287
+ }
1288
+
1289
+ if (typeof key !== 'undefined') {
1290
+ payload['key'] = key;
1291
+ }
1292
+
1293
+ if (typeof twoWayKey !== 'undefined') {
1294
+ payload['twoWayKey'] = twoWayKey;
1295
+ }
1296
+
1297
+ if (typeof onDelete !== 'undefined') {
1298
+ payload['onDelete'] = onDelete;
699
1299
  }
700
1300
 
701
1301
  const uri = new URL(this.client.config.endpoint + path);
@@ -705,24 +1305,22 @@ export class Databases extends Service {
705
1305
  }
706
1306
 
707
1307
  /**
708
- * Create Integer Attribute
1308
+ * Create String Attribute
709
1309
  *
710
- * Create an integer attribute. Optionally, minimum and maximum values can be
711
- * provided.
1310
+ * Create a string attribute.
712
1311
  *
713
1312
  *
714
1313
  * @param {string} databaseId
715
1314
  * @param {string} collectionId
716
1315
  * @param {string} key
1316
+ * @param {number} size
717
1317
  * @param {boolean} required
718
- * @param {number} min
719
- * @param {number} max
720
- * @param {number} xdefault
1318
+ * @param {string} xdefault
721
1319
  * @param {boolean} array
722
1320
  * @throws {AppwriteException}
723
1321
  * @returns {Promise}
724
1322
  */
725
- async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
1323
+ async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString> {
726
1324
  if (typeof databaseId === 'undefined') {
727
1325
  throw new AppwriteException('Missing required parameter: "databaseId"');
728
1326
  }
@@ -735,27 +1333,27 @@ export class Databases extends Service {
735
1333
  throw new AppwriteException('Missing required parameter: "key"');
736
1334
  }
737
1335
 
1336
+ if (typeof size === 'undefined') {
1337
+ throw new AppwriteException('Missing required parameter: "size"');
1338
+ }
1339
+
738
1340
  if (typeof required === 'undefined') {
739
1341
  throw new AppwriteException('Missing required parameter: "required"');
740
1342
  }
741
1343
 
742
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1344
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
743
1345
  let payload: Payload = {};
744
1346
 
745
1347
  if (typeof key !== 'undefined') {
746
1348
  payload['key'] = key;
747
1349
  }
748
1350
 
749
- if (typeof required !== 'undefined') {
750
- payload['required'] = required;
751
- }
752
-
753
- if (typeof min !== 'undefined') {
754
- payload['min'] = min;
1351
+ if (typeof size !== 'undefined') {
1352
+ payload['size'] = size;
755
1353
  }
756
1354
 
757
- if (typeof max !== 'undefined') {
758
- payload['max'] = max;
1355
+ if (typeof required !== 'undefined') {
1356
+ payload['required'] = required;
759
1357
  }
760
1358
 
761
1359
  if (typeof xdefault !== 'undefined') {
@@ -773,9 +1371,10 @@ export class Databases extends Service {
773
1371
  }
774
1372
 
775
1373
  /**
776
- * Create IP Address Attribute
1374
+ * Update String Attribute
777
1375
  *
778
- * Create IP address attribute.
1376
+ * Update a string attribute. Changing the `default` value will not update
1377
+ * already existing documents.
779
1378
  *
780
1379
  *
781
1380
  * @param {string} databaseId
@@ -783,11 +1382,10 @@ export class Databases extends Service {
783
1382
  * @param {string} key
784
1383
  * @param {boolean} required
785
1384
  * @param {string} xdefault
786
- * @param {boolean} array
787
1385
  * @throws {AppwriteException}
788
1386
  * @returns {Promise}
789
1387
  */
790
- async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
1388
+ async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeString> {
791
1389
  if (typeof databaseId === 'undefined') {
792
1390
  throw new AppwriteException('Missing required parameter: "databaseId"');
793
1391
  }
@@ -804,13 +1402,13 @@ export class Databases extends Service {
804
1402
  throw new AppwriteException('Missing required parameter: "required"');
805
1403
  }
806
1404
 
807
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
808
- let payload: Payload = {};
809
-
810
- if (typeof key !== 'undefined') {
811
- payload['key'] = key;
1405
+ if (typeof xdefault === 'undefined') {
1406
+ throw new AppwriteException('Missing required parameter: "xdefault"');
812
1407
  }
813
1408
 
1409
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1410
+ let payload: Payload = {};
1411
+
814
1412
  if (typeof required !== 'undefined') {
815
1413
  payload['required'] = required;
816
1414
  }
@@ -819,33 +1417,28 @@ export class Databases extends Service {
819
1417
  payload['default'] = xdefault;
820
1418
  }
821
1419
 
822
- if (typeof array !== 'undefined') {
823
- payload['array'] = array;
824
- }
825
-
826
1420
  const uri = new URL(this.client.config.endpoint + path);
827
- return await this.client.call('post', uri, {
1421
+ return await this.client.call('patch', uri, {
828
1422
  'content-type': 'application/json',
829
1423
  }, payload);
830
1424
  }
831
1425
 
832
1426
  /**
833
- * Create String Attribute
1427
+ * Create URL Attribute
834
1428
  *
835
- * Create a string attribute.
1429
+ * Create a URL attribute.
836
1430
  *
837
1431
  *
838
1432
  * @param {string} databaseId
839
1433
  * @param {string} collectionId
840
1434
  * @param {string} key
841
- * @param {number} size
842
1435
  * @param {boolean} required
843
1436
  * @param {string} xdefault
844
1437
  * @param {boolean} array
845
1438
  * @throws {AppwriteException}
846
1439
  * @returns {Promise}
847
1440
  */
848
- async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeString> {
1441
+ async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
849
1442
  if (typeof databaseId === 'undefined') {
850
1443
  throw new AppwriteException('Missing required parameter: "databaseId"');
851
1444
  }
@@ -858,25 +1451,17 @@ export class Databases extends Service {
858
1451
  throw new AppwriteException('Missing required parameter: "key"');
859
1452
  }
860
1453
 
861
- if (typeof size === 'undefined') {
862
- throw new AppwriteException('Missing required parameter: "size"');
863
- }
864
-
865
1454
  if (typeof required === 'undefined') {
866
1455
  throw new AppwriteException('Missing required parameter: "required"');
867
1456
  }
868
1457
 
869
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
1458
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
870
1459
  let payload: Payload = {};
871
1460
 
872
1461
  if (typeof key !== 'undefined') {
873
1462
  payload['key'] = key;
874
1463
  }
875
1464
 
876
- if (typeof size !== 'undefined') {
877
- payload['size'] = size;
878
- }
879
-
880
1465
  if (typeof required !== 'undefined') {
881
1466
  payload['required'] = required;
882
1467
  }
@@ -896,9 +1481,10 @@ export class Databases extends Service {
896
1481
  }
897
1482
 
898
1483
  /**
899
- * Create URL Attribute
1484
+ * Update URL Attribute
900
1485
  *
901
- * Create a URL attribute.
1486
+ * Update an url attribute. Changing the `default` value will not update
1487
+ * already existing documents.
902
1488
  *
903
1489
  *
904
1490
  * @param {string} databaseId
@@ -906,11 +1492,10 @@ export class Databases extends Service {
906
1492
  * @param {string} key
907
1493
  * @param {boolean} required
908
1494
  * @param {string} xdefault
909
- * @param {boolean} array
910
1495
  * @throws {AppwriteException}
911
1496
  * @returns {Promise}
912
1497
  */
913
- async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
1498
+ async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault: string): Promise<Models.AttributeUrl> {
914
1499
  if (typeof databaseId === 'undefined') {
915
1500
  throw new AppwriteException('Missing required parameter: "databaseId"');
916
1501
  }
@@ -927,13 +1512,13 @@ export class Databases extends Service {
927
1512
  throw new AppwriteException('Missing required parameter: "required"');
928
1513
  }
929
1514
 
930
- let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
931
- let payload: Payload = {};
932
-
933
- if (typeof key !== 'undefined') {
934
- payload['key'] = key;
1515
+ if (typeof xdefault === 'undefined') {
1516
+ throw new AppwriteException('Missing required parameter: "xdefault"');
935
1517
  }
936
1518
 
1519
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1520
+ let payload: Payload = {};
1521
+
937
1522
  if (typeof required !== 'undefined') {
938
1523
  payload['required'] = required;
939
1524
  }
@@ -942,12 +1527,8 @@ export class Databases extends Service {
942
1527
  payload['default'] = xdefault;
943
1528
  }
944
1529
 
945
- if (typeof array !== 'undefined') {
946
- payload['array'] = array;
947
- }
948
-
949
1530
  const uri = new URL(this.client.config.endpoint + path);
950
- return await this.client.call('post', uri, {
1531
+ return await this.client.call('patch', uri, {
951
1532
  'content-type': 'application/json',
952
1533
  }, payload);
953
1534
  }
@@ -1016,6 +1597,48 @@ export class Databases extends Service {
1016
1597
  }, payload);
1017
1598
  }
1018
1599
 
1600
+ /**
1601
+ * Update Relationship Attribute
1602
+ *
1603
+ *
1604
+ * @param {string} databaseId
1605
+ * @param {string} collectionId
1606
+ * @param {string} key
1607
+ * @param {boolean} twoWay
1608
+ * @param {string} onDelete
1609
+ * @throws {AppwriteException}
1610
+ * @returns {Promise}
1611
+ */
1612
+ async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, twoWay?: boolean, onDelete?: string): Promise<Models.AttributeRelationship> {
1613
+ if (typeof databaseId === 'undefined') {
1614
+ throw new AppwriteException('Missing required parameter: "databaseId"');
1615
+ }
1616
+
1617
+ if (typeof collectionId === 'undefined') {
1618
+ throw new AppwriteException('Missing required parameter: "collectionId"');
1619
+ }
1620
+
1621
+ if (typeof key === 'undefined') {
1622
+ throw new AppwriteException('Missing required parameter: "key"');
1623
+ }
1624
+
1625
+ let path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
1626
+ let payload: Payload = {};
1627
+
1628
+ if (typeof twoWay !== 'undefined') {
1629
+ payload['twoWay'] = twoWay;
1630
+ }
1631
+
1632
+ if (typeof onDelete !== 'undefined') {
1633
+ payload['onDelete'] = onDelete;
1634
+ }
1635
+
1636
+ const uri = new URL(this.client.config.endpoint + path);
1637
+ return await this.client.call('patch', uri, {
1638
+ 'content-type': 'application/json',
1639
+ }, payload);
1640
+ }
1641
+
1019
1642
  /**
1020
1643
  * List Documents
1021
1644
  *
@@ -1113,10 +1736,11 @@ export class Databases extends Service {
1113
1736
  * @param {string} databaseId
1114
1737
  * @param {string} collectionId
1115
1738
  * @param {string} documentId
1739
+ * @param {string[]} queries
1116
1740
  * @throws {AppwriteException}
1117
1741
  * @returns {Promise}
1118
1742
  */
1119
- async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string): Promise<Document> {
1743
+ async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
1120
1744
  if (typeof databaseId === 'undefined') {
1121
1745
  throw new AppwriteException('Missing required parameter: "databaseId"');
1122
1746
  }
@@ -1132,6 +1756,10 @@ export class Databases extends Service {
1132
1756
  let path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
1133
1757
  let payload: Payload = {};
1134
1758
 
1759
+ if (typeof queries !== 'undefined') {
1760
+ payload['queries'] = queries;
1761
+ }
1762
+
1135
1763
  const uri = new URL(this.client.config.endpoint + path);
1136
1764
  return await this.client.call('get', uri, {
1137
1765
  'content-type': 'application/json',