appwrite 7.1.0 → 8.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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +1 -1
- data/lib/appwrite/models/algo_argon2.rb +5 -0
- data/lib/appwrite/models/algo_bcrypt.rb +5 -0
- data/lib/appwrite/models/algo_md5.rb +5 -0
- data/lib/appwrite/models/algo_phpass.rb +5 -0
- data/lib/appwrite/models/algo_scrypt.rb +5 -0
- data/lib/appwrite/models/algo_scrypt_modified.rb +5 -0
- data/lib/appwrite/models/algo_sha.rb +5 -0
- data/lib/appwrite/models/attribute_relationship.rb +77 -0
- data/lib/appwrite/models/deployment.rb +8 -3
- data/lib/appwrite/models/team.rb +8 -3
- data/lib/appwrite/models/user.rb +3 -3
- data/lib/appwrite/query.rb +41 -17
- data/lib/appwrite/services/account.rb +15 -15
- data/lib/appwrite/services/databases.rb +757 -123
- data/lib/appwrite/services/functions.rb +9 -19
- data/lib/appwrite/services/graphql.rb +71 -0
- data/lib/appwrite/services/storage.rb +10 -11
- data/lib/appwrite/services/teams.rb +99 -27
- data/lib/appwrite/services/users.rb +10 -10
- data/lib/appwrite.rb +2 -1
- metadata +5 -4
- data/lib/appwrite/models/account.rb +0 -82
@@ -10,7 +10,7 @@ module Appwrite
|
|
10
10
|
# Get a list of all databases from the current Appwrite project. You can use
|
11
11
|
# the search parameter to filter your results.
|
12
12
|
#
|
13
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
13
|
+
# @param [Array] 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
|
14
14
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
15
15
|
#
|
16
16
|
# @return [DatabaseList]
|
@@ -39,7 +39,7 @@ module Appwrite
|
|
39
39
|
# Create a new Database.
|
40
40
|
#
|
41
41
|
#
|
42
|
-
# @param [String] database_id Unique Id. Choose
|
42
|
+
# @param [String] database_id 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.
|
43
43
|
# @param [String] name Collection name. Max length: 128 chars.
|
44
44
|
#
|
45
45
|
# @return [Database]
|
@@ -107,7 +107,7 @@ module Appwrite
|
|
107
107
|
# Update a database by its unique ID.
|
108
108
|
#
|
109
109
|
# @param [String] database_id Database ID.
|
110
|
-
# @param [String] name
|
110
|
+
# @param [String] name Database name. Max length: 128 chars.
|
111
111
|
#
|
112
112
|
# @return [Database]
|
113
113
|
def update(database_id:, name:)
|
@@ -174,7 +174,7 @@ module Appwrite
|
|
174
174
|
# can use the search parameter to filter your results.
|
175
175
|
#
|
176
176
|
# @param [String] database_id Database ID.
|
177
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
177
|
+
# @param [Array] 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
|
178
178
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
179
179
|
#
|
180
180
|
# @return [CollectionList]
|
@@ -211,9 +211,9 @@ module Appwrite
|
|
211
211
|
# directly from your database console.
|
212
212
|
#
|
213
213
|
# @param [String] database_id Database ID.
|
214
|
-
# @param [String] collection_id Unique Id. Choose
|
214
|
+
# @param [String] collection_id 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.
|
215
215
|
# @param [String] name Collection name. Max length: 128 chars.
|
216
|
-
# @param [Array] permissions An array of permissions strings. By default no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
|
216
|
+
# @param [Array] permissions An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
|
217
217
|
# @param [] document_security 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).
|
218
218
|
#
|
219
219
|
# @return [Collection]
|
@@ -296,7 +296,7 @@ module Appwrite
|
|
296
296
|
# @param [String] database_id Database ID.
|
297
297
|
# @param [String] collection_id Collection ID.
|
298
298
|
# @param [String] name Collection name. Max length: 128 chars.
|
299
|
-
# @param [Array] permissions An array of permission strings. By default the current
|
299
|
+
# @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
300
300
|
# @param [] document_security 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).
|
301
301
|
# @param [] enabled Is collection enabled?
|
302
302
|
#
|
@@ -470,14 +470,14 @@ module Appwrite
|
|
470
470
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
471
471
|
# @param [String] key Attribute Key.
|
472
472
|
# @param [] required Is attribute required?
|
473
|
-
# @param [
|
474
|
-
# @param [] array Is attribute an array?
|
473
|
+
# @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
475
474
|
#
|
476
|
-
# @return [
|
477
|
-
def
|
478
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
475
|
+
# @return [AttributeBoolean]
|
476
|
+
def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:)
|
477
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'
|
479
478
|
.gsub('{databaseId}', database_id)
|
480
479
|
.gsub('{collectionId}', collection_id)
|
480
|
+
.gsub('{key}', key)
|
481
481
|
|
482
482
|
if database_id.nil?
|
483
483
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -495,11 +495,13 @@ module Appwrite
|
|
495
495
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
496
496
|
end
|
497
497
|
|
498
|
+
if default.nil?
|
499
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
500
|
+
end
|
501
|
+
|
498
502
|
params = {
|
499
|
-
key: key,
|
500
503
|
required: required,
|
501
504
|
default: default,
|
502
|
-
array: array,
|
503
505
|
}
|
504
506
|
|
505
507
|
headers = {
|
@@ -507,28 +509,27 @@ module Appwrite
|
|
507
509
|
}
|
508
510
|
|
509
511
|
@client.call(
|
510
|
-
method: '
|
512
|
+
method: 'PATCH',
|
511
513
|
path: path,
|
512
514
|
headers: headers,
|
513
515
|
params: params,
|
514
|
-
response_type: Models::
|
516
|
+
response_type: Models::AttributeBoolean
|
515
517
|
)
|
516
518
|
end
|
517
519
|
|
518
520
|
|
519
|
-
# Create an email attribute.
|
520
521
|
#
|
521
522
|
#
|
522
523
|
# @param [String] database_id Database ID.
|
523
524
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
524
525
|
# @param [String] key Attribute Key.
|
525
526
|
# @param [] required Is attribute required?
|
526
|
-
# @param [String] default Default value for attribute
|
527
|
+
# @param [String] default Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
|
527
528
|
# @param [] array Is attribute an array?
|
528
529
|
#
|
529
|
-
# @return [
|
530
|
-
def
|
531
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
530
|
+
# @return [AttributeDatetime]
|
531
|
+
def create_datetime_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
532
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'
|
532
533
|
.gsub('{databaseId}', database_id)
|
533
534
|
.gsub('{collectionId}', collection_id)
|
534
535
|
|
@@ -564,7 +565,7 @@ module Appwrite
|
|
564
565
|
path: path,
|
565
566
|
headers: headers,
|
566
567
|
params: params,
|
567
|
-
response_type: Models::
|
568
|
+
response_type: Models::AttributeDatetime
|
568
569
|
)
|
569
570
|
end
|
570
571
|
|
@@ -574,16 +575,15 @@ module Appwrite
|
|
574
575
|
# @param [String] database_id Database ID.
|
575
576
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
576
577
|
# @param [String] key Attribute Key.
|
577
|
-
# @param [Array] 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.
|
578
578
|
# @param [] required Is attribute required?
|
579
579
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
580
|
-
# @param [] array Is attribute an array?
|
581
580
|
#
|
582
|
-
# @return [
|
583
|
-
def
|
584
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
581
|
+
# @return [AttributeDatetime]
|
582
|
+
def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:)
|
583
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'
|
585
584
|
.gsub('{databaseId}', database_id)
|
586
585
|
.gsub('{collectionId}', collection_id)
|
586
|
+
.gsub('{key}', key)
|
587
587
|
|
588
588
|
if database_id.nil?
|
589
589
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -597,20 +597,17 @@ module Appwrite
|
|
597
597
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
598
598
|
end
|
599
599
|
|
600
|
-
if elements.nil?
|
601
|
-
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
602
|
-
end
|
603
|
-
|
604
600
|
if required.nil?
|
605
601
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
606
602
|
end
|
607
603
|
|
604
|
+
if default.nil?
|
605
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
606
|
+
end
|
607
|
+
|
608
608
|
params = {
|
609
|
-
key: key,
|
610
|
-
elements: elements,
|
611
609
|
required: required,
|
612
610
|
default: default,
|
613
|
-
array: array,
|
614
611
|
}
|
615
612
|
|
616
613
|
headers = {
|
@@ -618,31 +615,28 @@ module Appwrite
|
|
618
615
|
}
|
619
616
|
|
620
617
|
@client.call(
|
621
|
-
method: '
|
618
|
+
method: 'PATCH',
|
622
619
|
path: path,
|
623
620
|
headers: headers,
|
624
621
|
params: params,
|
625
|
-
response_type: Models::
|
622
|
+
response_type: Models::AttributeDatetime
|
626
623
|
)
|
627
624
|
end
|
628
625
|
|
629
626
|
|
630
|
-
# Create
|
631
|
-
# provided.
|
627
|
+
# Create an email attribute.
|
632
628
|
#
|
633
629
|
#
|
634
630
|
# @param [String] database_id Database ID.
|
635
631
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
636
632
|
# @param [String] key Attribute Key.
|
637
633
|
# @param [] required Is attribute required?
|
638
|
-
# @param [
|
639
|
-
# @param [Float] max Maximum value to enforce on new documents
|
640
|
-
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
634
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
641
635
|
# @param [] array Is attribute an array?
|
642
636
|
#
|
643
|
-
# @return [
|
644
|
-
def
|
645
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
637
|
+
# @return [AttributeEmail]
|
638
|
+
def create_email_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
639
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/email'
|
646
640
|
.gsub('{databaseId}', database_id)
|
647
641
|
.gsub('{collectionId}', collection_id)
|
648
642
|
|
@@ -665,8 +659,6 @@ module Appwrite
|
|
665
659
|
params = {
|
666
660
|
key: key,
|
667
661
|
required: required,
|
668
|
-
min: min,
|
669
|
-
max: max,
|
670
662
|
default: default,
|
671
663
|
array: array,
|
672
664
|
}
|
@@ -680,29 +672,27 @@ module Appwrite
|
|
680
672
|
path: path,
|
681
673
|
headers: headers,
|
682
674
|
params: params,
|
683
|
-
response_type: Models::
|
675
|
+
response_type: Models::AttributeEmail
|
684
676
|
)
|
685
677
|
end
|
686
678
|
|
687
679
|
|
688
|
-
#
|
689
|
-
#
|
680
|
+
# Update an email attribute. Changing the `default` value will not update
|
681
|
+
# already existing documents.
|
690
682
|
#
|
691
683
|
#
|
692
684
|
# @param [String] database_id Database ID.
|
693
685
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
694
686
|
# @param [String] key Attribute Key.
|
695
687
|
# @param [] required Is attribute required?
|
696
|
-
# @param [
|
697
|
-
# @param [Integer] max Maximum value to enforce on new documents
|
698
|
-
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
699
|
-
# @param [] array Is attribute an array?
|
688
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
700
689
|
#
|
701
|
-
# @return [
|
702
|
-
def
|
703
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
690
|
+
# @return [AttributeEmail]
|
691
|
+
def update_email_attribute(database_id:, collection_id:, key:, required:, default:)
|
692
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'
|
704
693
|
.gsub('{databaseId}', database_id)
|
705
694
|
.gsub('{collectionId}', collection_id)
|
695
|
+
.gsub('{key}', key)
|
706
696
|
|
707
697
|
if database_id.nil?
|
708
698
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -720,13 +710,13 @@ module Appwrite
|
|
720
710
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
721
711
|
end
|
722
712
|
|
713
|
+
if default.nil?
|
714
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
715
|
+
end
|
716
|
+
|
723
717
|
params = {
|
724
|
-
key: key,
|
725
718
|
required: required,
|
726
|
-
min: min,
|
727
|
-
max: max,
|
728
719
|
default: default,
|
729
|
-
array: array,
|
730
720
|
}
|
731
721
|
|
732
722
|
headers = {
|
@@ -734,28 +724,28 @@ module Appwrite
|
|
734
724
|
}
|
735
725
|
|
736
726
|
@client.call(
|
737
|
-
method: '
|
727
|
+
method: 'PATCH',
|
738
728
|
path: path,
|
739
729
|
headers: headers,
|
740
730
|
params: params,
|
741
|
-
response_type: Models::
|
731
|
+
response_type: Models::AttributeEmail
|
742
732
|
)
|
743
733
|
end
|
744
734
|
|
745
735
|
|
746
|
-
# Create IP address attribute.
|
747
736
|
#
|
748
737
|
#
|
749
738
|
# @param [String] database_id Database ID.
|
750
739
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
751
740
|
# @param [String] key Attribute Key.
|
741
|
+
# @param [Array] 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.
|
752
742
|
# @param [] required Is attribute required?
|
753
743
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
754
744
|
# @param [] array Is attribute an array?
|
755
745
|
#
|
756
|
-
# @return [
|
757
|
-
def
|
758
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
746
|
+
# @return [AttributeEnum]
|
747
|
+
def create_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default: nil, array: nil)
|
748
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'
|
759
749
|
.gsub('{databaseId}', database_id)
|
760
750
|
.gsub('{collectionId}', collection_id)
|
761
751
|
|
@@ -771,12 +761,17 @@ module Appwrite
|
|
771
761
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
772
762
|
end
|
773
763
|
|
764
|
+
if elements.nil?
|
765
|
+
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
766
|
+
end
|
767
|
+
|
774
768
|
if required.nil?
|
775
769
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
776
770
|
end
|
777
771
|
|
778
772
|
params = {
|
779
773
|
key: key,
|
774
|
+
elements: elements,
|
780
775
|
required: required,
|
781
776
|
default: default,
|
782
777
|
array: array,
|
@@ -791,27 +786,28 @@ module Appwrite
|
|
791
786
|
path: path,
|
792
787
|
headers: headers,
|
793
788
|
params: params,
|
794
|
-
response_type: Models::
|
789
|
+
response_type: Models::AttributeEnum
|
795
790
|
)
|
796
791
|
end
|
797
792
|
|
798
793
|
|
799
|
-
#
|
794
|
+
# Update an enum attribute. Changing the `default` value will not update
|
795
|
+
# already existing documents.
|
800
796
|
#
|
801
797
|
#
|
802
798
|
# @param [String] database_id Database ID.
|
803
799
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
804
800
|
# @param [String] key Attribute Key.
|
805
|
-
# @param [
|
801
|
+
# @param [Array] 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.
|
806
802
|
# @param [] required Is attribute required?
|
807
803
|
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
808
|
-
# @param [] array Is attribute an array?
|
809
804
|
#
|
810
|
-
# @return [
|
811
|
-
def
|
812
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
805
|
+
# @return [AttributeEnum]
|
806
|
+
def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)
|
807
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'
|
813
808
|
.gsub('{databaseId}', database_id)
|
814
809
|
.gsub('{collectionId}', collection_id)
|
810
|
+
.gsub('{key}', key)
|
815
811
|
|
816
812
|
if database_id.nil?
|
817
813
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -825,20 +821,22 @@ module Appwrite
|
|
825
821
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
826
822
|
end
|
827
823
|
|
828
|
-
if
|
829
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
824
|
+
if elements.nil?
|
825
|
+
raise Appwrite::Exception.new('Missing required parameter: "elements"')
|
830
826
|
end
|
831
827
|
|
832
828
|
if required.nil?
|
833
829
|
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
834
830
|
end
|
835
831
|
|
832
|
+
if default.nil?
|
833
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
834
|
+
end
|
835
|
+
|
836
836
|
params = {
|
837
|
-
|
838
|
-
size: size,
|
837
|
+
elements: elements,
|
839
838
|
required: required,
|
840
839
|
default: default,
|
841
|
-
array: array,
|
842
840
|
}
|
843
841
|
|
844
842
|
headers = {
|
@@ -846,28 +844,31 @@ module Appwrite
|
|
846
844
|
}
|
847
845
|
|
848
846
|
@client.call(
|
849
|
-
method: '
|
847
|
+
method: 'PATCH',
|
850
848
|
path: path,
|
851
849
|
headers: headers,
|
852
850
|
params: params,
|
853
|
-
response_type: Models::
|
851
|
+
response_type: Models::AttributeEnum
|
854
852
|
)
|
855
853
|
end
|
856
854
|
|
857
855
|
|
858
|
-
# Create a
|
856
|
+
# Create a float attribute. Optionally, minimum and maximum values can be
|
857
|
+
# provided.
|
859
858
|
#
|
860
859
|
#
|
861
860
|
# @param [String] database_id Database ID.
|
862
861
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
863
862
|
# @param [String] key Attribute Key.
|
864
863
|
# @param [] required Is attribute required?
|
865
|
-
# @param [
|
864
|
+
# @param [Float] min Minimum value to enforce on new documents
|
865
|
+
# @param [Float] max Maximum value to enforce on new documents
|
866
|
+
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
866
867
|
# @param [] array Is attribute an array?
|
867
868
|
#
|
868
|
-
# @return [
|
869
|
-
def
|
870
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
869
|
+
# @return [AttributeFloat]
|
870
|
+
def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
871
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'
|
871
872
|
.gsub('{databaseId}', database_id)
|
872
873
|
.gsub('{collectionId}', collection_id)
|
873
874
|
|
@@ -890,6 +891,8 @@ module Appwrite
|
|
890
891
|
params = {
|
891
892
|
key: key,
|
892
893
|
required: required,
|
894
|
+
min: min,
|
895
|
+
max: max,
|
893
896
|
default: default,
|
894
897
|
array: array,
|
895
898
|
}
|
@@ -903,20 +906,26 @@ module Appwrite
|
|
903
906
|
path: path,
|
904
907
|
headers: headers,
|
905
908
|
params: params,
|
906
|
-
response_type: Models::
|
909
|
+
response_type: Models::AttributeFloat
|
907
910
|
)
|
908
911
|
end
|
909
912
|
|
910
913
|
|
914
|
+
# Update a float attribute. Changing the `default` value will not update
|
915
|
+
# already existing documents.
|
911
916
|
#
|
912
917
|
#
|
913
918
|
# @param [String] database_id Database ID.
|
914
919
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
915
920
|
# @param [String] key Attribute Key.
|
921
|
+
# @param [] required Is attribute required?
|
922
|
+
# @param [Float] min Minimum value to enforce on new documents
|
923
|
+
# @param [Float] max Maximum value to enforce on new documents
|
924
|
+
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
916
925
|
#
|
917
|
-
# @return []
|
918
|
-
def
|
919
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
926
|
+
# @return [AttributeFloat]
|
927
|
+
def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
|
928
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'
|
920
929
|
.gsub('{databaseId}', database_id)
|
921
930
|
.gsub('{collectionId}', collection_id)
|
922
931
|
.gsub('{key}', key)
|
@@ -933,7 +942,27 @@ module Appwrite
|
|
933
942
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
934
943
|
end
|
935
944
|
|
945
|
+
if required.nil?
|
946
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
947
|
+
end
|
948
|
+
|
949
|
+
if min.nil?
|
950
|
+
raise Appwrite::Exception.new('Missing required parameter: "min"')
|
951
|
+
end
|
952
|
+
|
953
|
+
if max.nil?
|
954
|
+
raise Appwrite::Exception.new('Missing required parameter: "max"')
|
955
|
+
end
|
956
|
+
|
957
|
+
if default.nil?
|
958
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
959
|
+
end
|
960
|
+
|
936
961
|
params = {
|
962
|
+
required: required,
|
963
|
+
min: min,
|
964
|
+
max: max,
|
965
|
+
default: default,
|
937
966
|
}
|
938
967
|
|
939
968
|
headers = {
|
@@ -941,26 +970,33 @@ module Appwrite
|
|
941
970
|
}
|
942
971
|
|
943
972
|
@client.call(
|
944
|
-
method: '
|
973
|
+
method: 'PATCH',
|
945
974
|
path: path,
|
946
975
|
headers: headers,
|
947
976
|
params: params,
|
977
|
+
response_type: Models::AttributeFloat
|
948
978
|
)
|
949
979
|
end
|
950
980
|
|
951
981
|
|
982
|
+
# Create an integer attribute. Optionally, minimum and maximum values can be
|
983
|
+
# provided.
|
952
984
|
#
|
953
985
|
#
|
954
986
|
# @param [String] database_id Database ID.
|
955
987
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
956
988
|
# @param [String] key Attribute Key.
|
989
|
+
# @param [] required Is attribute required?
|
990
|
+
# @param [Integer] min Minimum value to enforce on new documents
|
991
|
+
# @param [Integer] max Maximum value to enforce on new documents
|
992
|
+
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
993
|
+
# @param [] array Is attribute an array?
|
957
994
|
#
|
958
|
-
# @return []
|
959
|
-
def
|
960
|
-
path = '/databases/{databaseId}/collections/{collectionId}/attributes/
|
995
|
+
# @return [AttributeInteger]
|
996
|
+
def create_integer_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)
|
997
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'
|
961
998
|
.gsub('{databaseId}', database_id)
|
962
999
|
.gsub('{collectionId}', collection_id)
|
963
|
-
.gsub('{key}', key)
|
964
1000
|
|
965
1001
|
if database_id.nil?
|
966
1002
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -974,7 +1010,17 @@ module Appwrite
|
|
974
1010
|
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
975
1011
|
end
|
976
1012
|
|
1013
|
+
if required.nil?
|
1014
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1015
|
+
end
|
1016
|
+
|
977
1017
|
params = {
|
1018
|
+
key: key,
|
1019
|
+
required: required,
|
1020
|
+
min: min,
|
1021
|
+
max: max,
|
1022
|
+
default: default,
|
1023
|
+
array: array,
|
978
1024
|
}
|
979
1025
|
|
980
1026
|
headers = {
|
@@ -982,28 +1028,33 @@ module Appwrite
|
|
982
1028
|
}
|
983
1029
|
|
984
1030
|
@client.call(
|
985
|
-
method: '
|
1031
|
+
method: 'POST',
|
986
1032
|
path: path,
|
987
1033
|
headers: headers,
|
988
1034
|
params: params,
|
1035
|
+
response_type: Models::AttributeInteger
|
989
1036
|
)
|
990
1037
|
end
|
991
1038
|
|
992
1039
|
|
993
|
-
#
|
994
|
-
#
|
995
|
-
#
|
996
|
-
# [Learn more about different API modes](/docs/admin).
|
1040
|
+
# Update an integer attribute. Changing the `default` value will not update
|
1041
|
+
# already existing documents.
|
1042
|
+
#
|
997
1043
|
#
|
998
1044
|
# @param [String] database_id Database ID.
|
999
1045
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1000
|
-
# @param [
|
1046
|
+
# @param [String] key Attribute Key.
|
1047
|
+
# @param [] required Is attribute required?
|
1048
|
+
# @param [Integer] min Minimum value to enforce on new documents
|
1049
|
+
# @param [Integer] max Maximum value to enforce on new documents
|
1050
|
+
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1001
1051
|
#
|
1002
|
-
# @return [
|
1003
|
-
def
|
1004
|
-
path = '/databases/{databaseId}/collections/{collectionId}/
|
1052
|
+
# @return [AttributeInteger]
|
1053
|
+
def update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
|
1054
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'
|
1005
1055
|
.gsub('{databaseId}', database_id)
|
1006
1056
|
.gsub('{collectionId}', collection_id)
|
1057
|
+
.gsub('{key}', key)
|
1007
1058
|
|
1008
1059
|
if database_id.nil?
|
1009
1060
|
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
@@ -1013,8 +1064,31 @@ module Appwrite
|
|
1013
1064
|
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1014
1065
|
end
|
1015
1066
|
|
1067
|
+
if key.nil?
|
1068
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
if required.nil?
|
1072
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1073
|
+
end
|
1074
|
+
|
1075
|
+
if min.nil?
|
1076
|
+
raise Appwrite::Exception.new('Missing required parameter: "min"')
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
if max.nil?
|
1080
|
+
raise Appwrite::Exception.new('Missing required parameter: "max"')
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
if default.nil?
|
1084
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1085
|
+
end
|
1086
|
+
|
1016
1087
|
params = {
|
1017
|
-
|
1088
|
+
required: required,
|
1089
|
+
min: min,
|
1090
|
+
max: max,
|
1091
|
+
default: default,
|
1018
1092
|
}
|
1019
1093
|
|
1020
1094
|
headers = {
|
@@ -1022,29 +1096,28 @@ module Appwrite
|
|
1022
1096
|
}
|
1023
1097
|
|
1024
1098
|
@client.call(
|
1025
|
-
method: '
|
1099
|
+
method: 'PATCH',
|
1026
1100
|
path: path,
|
1027
1101
|
headers: headers,
|
1028
1102
|
params: params,
|
1029
|
-
response_type: Models::
|
1103
|
+
response_type: Models::AttributeInteger
|
1030
1104
|
)
|
1031
1105
|
end
|
1032
1106
|
|
1033
1107
|
|
1034
|
-
# Create
|
1035
|
-
#
|
1036
|
-
# integration](/docs/server/databases#databasesCreateCollection) API or
|
1037
|
-
# directly from your database console.
|
1108
|
+
# Create IP address attribute.
|
1109
|
+
#
|
1038
1110
|
#
|
1039
1111
|
# @param [String] database_id Database ID.
|
1040
|
-
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1041
|
-
# @param [String]
|
1042
|
-
# @param [
|
1043
|
-
# @param [
|
1112
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1113
|
+
# @param [String] key Attribute Key.
|
1114
|
+
# @param [] required Is attribute required?
|
1115
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1116
|
+
# @param [] array Is attribute an array?
|
1044
1117
|
#
|
1045
|
-
# @return [
|
1046
|
-
def
|
1047
|
-
path = '/databases/{databaseId}/collections/{collectionId}/
|
1118
|
+
# @return [AttributeIp]
|
1119
|
+
def create_ip_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
1120
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'
|
1048
1121
|
.gsub('{databaseId}', database_id)
|
1049
1122
|
.gsub('{collectionId}', collection_id)
|
1050
1123
|
|
@@ -1056,12 +1129,571 @@ module Appwrite
|
|
1056
1129
|
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1057
1130
|
end
|
1058
1131
|
|
1059
|
-
if
|
1060
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
1132
|
+
if key.nil?
|
1133
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1061
1134
|
end
|
1062
1135
|
|
1063
|
-
if
|
1064
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
1136
|
+
if required.nil?
|
1137
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
params = {
|
1141
|
+
key: key,
|
1142
|
+
required: required,
|
1143
|
+
default: default,
|
1144
|
+
array: array,
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
headers = {
|
1148
|
+
"content-type": 'application/json',
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
@client.call(
|
1152
|
+
method: 'POST',
|
1153
|
+
path: path,
|
1154
|
+
headers: headers,
|
1155
|
+
params: params,
|
1156
|
+
response_type: Models::AttributeIp
|
1157
|
+
)
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
|
1161
|
+
# Update an ip attribute. Changing the `default` value will not update
|
1162
|
+
# already existing documents.
|
1163
|
+
#
|
1164
|
+
#
|
1165
|
+
# @param [String] database_id Database ID.
|
1166
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1167
|
+
# @param [String] key Attribute Key.
|
1168
|
+
# @param [] required Is attribute required?
|
1169
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1170
|
+
#
|
1171
|
+
# @return [AttributeIp]
|
1172
|
+
def update_ip_attribute(database_id:, collection_id:, key:, required:, default:)
|
1173
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'
|
1174
|
+
.gsub('{databaseId}', database_id)
|
1175
|
+
.gsub('{collectionId}', collection_id)
|
1176
|
+
.gsub('{key}', key)
|
1177
|
+
|
1178
|
+
if database_id.nil?
|
1179
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
if collection_id.nil?
|
1183
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
if key.nil?
|
1187
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
if required.nil?
|
1191
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
if default.nil?
|
1195
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
params = {
|
1199
|
+
required: required,
|
1200
|
+
default: default,
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
headers = {
|
1204
|
+
"content-type": 'application/json',
|
1205
|
+
}
|
1206
|
+
|
1207
|
+
@client.call(
|
1208
|
+
method: 'PATCH',
|
1209
|
+
path: path,
|
1210
|
+
headers: headers,
|
1211
|
+
params: params,
|
1212
|
+
response_type: Models::AttributeIp
|
1213
|
+
)
|
1214
|
+
end
|
1215
|
+
|
1216
|
+
|
1217
|
+
# Create relationship attribute. [Learn more about relationship
|
1218
|
+
# attributes](docs/databases-relationships#relationship-attributes).
|
1219
|
+
#
|
1220
|
+
#
|
1221
|
+
# @param [String] database_id Database ID.
|
1222
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1223
|
+
# @param [String] related_collection_id Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1224
|
+
# @param [String] type Relation type
|
1225
|
+
# @param [] two_way Is Two Way?
|
1226
|
+
# @param [String] key Attribute Key.
|
1227
|
+
# @param [String] two_way_key Two Way Attribute Key.
|
1228
|
+
# @param [String] on_delete Constraints option
|
1229
|
+
#
|
1230
|
+
# @return [AttributeRelationship]
|
1231
|
+
def create_relationship_attribute(database_id:, collection_id:, related_collection_id:, type:, two_way: nil, key: nil, two_way_key: nil, on_delete: nil)
|
1232
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'
|
1233
|
+
.gsub('{databaseId}', database_id)
|
1234
|
+
.gsub('{collectionId}', collection_id)
|
1235
|
+
|
1236
|
+
if database_id.nil?
|
1237
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1238
|
+
end
|
1239
|
+
|
1240
|
+
if collection_id.nil?
|
1241
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
if related_collection_id.nil?
|
1245
|
+
raise Appwrite::Exception.new('Missing required parameter: "relatedCollectionId"')
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
if type.nil?
|
1249
|
+
raise Appwrite::Exception.new('Missing required parameter: "type"')
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
params = {
|
1253
|
+
relatedCollectionId: related_collection_id,
|
1254
|
+
type: type,
|
1255
|
+
twoWay: two_way,
|
1256
|
+
key: key,
|
1257
|
+
twoWayKey: two_way_key,
|
1258
|
+
onDelete: on_delete,
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
headers = {
|
1262
|
+
"content-type": 'application/json',
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
@client.call(
|
1266
|
+
method: 'POST',
|
1267
|
+
path: path,
|
1268
|
+
headers: headers,
|
1269
|
+
params: params,
|
1270
|
+
response_type: Models::AttributeRelationship
|
1271
|
+
)
|
1272
|
+
end
|
1273
|
+
|
1274
|
+
|
1275
|
+
# Create a string attribute.
|
1276
|
+
#
|
1277
|
+
#
|
1278
|
+
# @param [String] database_id Database ID.
|
1279
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1280
|
+
# @param [String] key Attribute Key.
|
1281
|
+
# @param [Integer] size Attribute size for text attributes, in number of characters.
|
1282
|
+
# @param [] required Is attribute required?
|
1283
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1284
|
+
# @param [] array Is attribute an array?
|
1285
|
+
#
|
1286
|
+
# @return [AttributeString]
|
1287
|
+
def create_string_attribute(database_id:, collection_id:, key:, size:, required:, default: nil, array: nil)
|
1288
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/string'
|
1289
|
+
.gsub('{databaseId}', database_id)
|
1290
|
+
.gsub('{collectionId}', collection_id)
|
1291
|
+
|
1292
|
+
if database_id.nil?
|
1293
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
if collection_id.nil?
|
1297
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
if key.nil?
|
1301
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
if size.nil?
|
1305
|
+
raise Appwrite::Exception.new('Missing required parameter: "size"')
|
1306
|
+
end
|
1307
|
+
|
1308
|
+
if required.nil?
|
1309
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
params = {
|
1313
|
+
key: key,
|
1314
|
+
size: size,
|
1315
|
+
required: required,
|
1316
|
+
default: default,
|
1317
|
+
array: array,
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
headers = {
|
1321
|
+
"content-type": 'application/json',
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
@client.call(
|
1325
|
+
method: 'POST',
|
1326
|
+
path: path,
|
1327
|
+
headers: headers,
|
1328
|
+
params: params,
|
1329
|
+
response_type: Models::AttributeString
|
1330
|
+
)
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
|
1334
|
+
# Update a string attribute. Changing the `default` value will not update
|
1335
|
+
# already existing documents.
|
1336
|
+
#
|
1337
|
+
#
|
1338
|
+
# @param [String] database_id Database ID.
|
1339
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1340
|
+
# @param [String] key Attribute Key.
|
1341
|
+
# @param [] required Is attribute required?
|
1342
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1343
|
+
#
|
1344
|
+
# @return [AttributeString]
|
1345
|
+
def update_string_attribute(database_id:, collection_id:, key:, required:, default:)
|
1346
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'
|
1347
|
+
.gsub('{databaseId}', database_id)
|
1348
|
+
.gsub('{collectionId}', collection_id)
|
1349
|
+
.gsub('{key}', key)
|
1350
|
+
|
1351
|
+
if database_id.nil?
|
1352
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
if collection_id.nil?
|
1356
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1357
|
+
end
|
1358
|
+
|
1359
|
+
if key.nil?
|
1360
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
if required.nil?
|
1364
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
if default.nil?
|
1368
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
params = {
|
1372
|
+
required: required,
|
1373
|
+
default: default,
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
headers = {
|
1377
|
+
"content-type": 'application/json',
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
@client.call(
|
1381
|
+
method: 'PATCH',
|
1382
|
+
path: path,
|
1383
|
+
headers: headers,
|
1384
|
+
params: params,
|
1385
|
+
response_type: Models::AttributeString
|
1386
|
+
)
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
|
1390
|
+
# Create a URL attribute.
|
1391
|
+
#
|
1392
|
+
#
|
1393
|
+
# @param [String] database_id Database ID.
|
1394
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1395
|
+
# @param [String] key Attribute Key.
|
1396
|
+
# @param [] required Is attribute required?
|
1397
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1398
|
+
# @param [] array Is attribute an array?
|
1399
|
+
#
|
1400
|
+
# @return [AttributeUrl]
|
1401
|
+
def create_url_attribute(database_id:, collection_id:, key:, required:, default: nil, array: nil)
|
1402
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/url'
|
1403
|
+
.gsub('{databaseId}', database_id)
|
1404
|
+
.gsub('{collectionId}', collection_id)
|
1405
|
+
|
1406
|
+
if database_id.nil?
|
1407
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1408
|
+
end
|
1409
|
+
|
1410
|
+
if collection_id.nil?
|
1411
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
if key.nil?
|
1415
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1416
|
+
end
|
1417
|
+
|
1418
|
+
if required.nil?
|
1419
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
params = {
|
1423
|
+
key: key,
|
1424
|
+
required: required,
|
1425
|
+
default: default,
|
1426
|
+
array: array,
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
headers = {
|
1430
|
+
"content-type": 'application/json',
|
1431
|
+
}
|
1432
|
+
|
1433
|
+
@client.call(
|
1434
|
+
method: 'POST',
|
1435
|
+
path: path,
|
1436
|
+
headers: headers,
|
1437
|
+
params: params,
|
1438
|
+
response_type: Models::AttributeUrl
|
1439
|
+
)
|
1440
|
+
end
|
1441
|
+
|
1442
|
+
|
1443
|
+
# Update an url attribute. Changing the `default` value will not update
|
1444
|
+
# already existing documents.
|
1445
|
+
#
|
1446
|
+
#
|
1447
|
+
# @param [String] database_id Database ID.
|
1448
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1449
|
+
# @param [String] key Attribute Key.
|
1450
|
+
# @param [] required Is attribute required?
|
1451
|
+
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
|
1452
|
+
#
|
1453
|
+
# @return [AttributeUrl]
|
1454
|
+
def update_url_attribute(database_id:, collection_id:, key:, required:, default:)
|
1455
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'
|
1456
|
+
.gsub('{databaseId}', database_id)
|
1457
|
+
.gsub('{collectionId}', collection_id)
|
1458
|
+
.gsub('{key}', key)
|
1459
|
+
|
1460
|
+
if database_id.nil?
|
1461
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1462
|
+
end
|
1463
|
+
|
1464
|
+
if collection_id.nil?
|
1465
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
if key.nil?
|
1469
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
if required.nil?
|
1473
|
+
raise Appwrite::Exception.new('Missing required parameter: "required"')
|
1474
|
+
end
|
1475
|
+
|
1476
|
+
if default.nil?
|
1477
|
+
raise Appwrite::Exception.new('Missing required parameter: "default"')
|
1478
|
+
end
|
1479
|
+
|
1480
|
+
params = {
|
1481
|
+
required: required,
|
1482
|
+
default: default,
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
headers = {
|
1486
|
+
"content-type": 'application/json',
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
@client.call(
|
1490
|
+
method: 'PATCH',
|
1491
|
+
path: path,
|
1492
|
+
headers: headers,
|
1493
|
+
params: params,
|
1494
|
+
response_type: Models::AttributeUrl
|
1495
|
+
)
|
1496
|
+
end
|
1497
|
+
|
1498
|
+
|
1499
|
+
#
|
1500
|
+
#
|
1501
|
+
# @param [String] database_id Database ID.
|
1502
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1503
|
+
# @param [String] key Attribute Key.
|
1504
|
+
#
|
1505
|
+
# @return []
|
1506
|
+
def get_attribute(database_id:, collection_id:, key:)
|
1507
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
1508
|
+
.gsub('{databaseId}', database_id)
|
1509
|
+
.gsub('{collectionId}', collection_id)
|
1510
|
+
.gsub('{key}', key)
|
1511
|
+
|
1512
|
+
if database_id.nil?
|
1513
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1514
|
+
end
|
1515
|
+
|
1516
|
+
if collection_id.nil?
|
1517
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1518
|
+
end
|
1519
|
+
|
1520
|
+
if key.nil?
|
1521
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
params = {
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
headers = {
|
1528
|
+
"content-type": 'application/json',
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
@client.call(
|
1532
|
+
method: 'GET',
|
1533
|
+
path: path,
|
1534
|
+
headers: headers,
|
1535
|
+
params: params,
|
1536
|
+
)
|
1537
|
+
end
|
1538
|
+
|
1539
|
+
|
1540
|
+
#
|
1541
|
+
#
|
1542
|
+
# @param [String] database_id Database ID.
|
1543
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1544
|
+
# @param [String] key Attribute Key.
|
1545
|
+
#
|
1546
|
+
# @return []
|
1547
|
+
def delete_attribute(database_id:, collection_id:, key:)
|
1548
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'
|
1549
|
+
.gsub('{databaseId}', database_id)
|
1550
|
+
.gsub('{collectionId}', collection_id)
|
1551
|
+
.gsub('{key}', key)
|
1552
|
+
|
1553
|
+
if database_id.nil?
|
1554
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
if collection_id.nil?
|
1558
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1559
|
+
end
|
1560
|
+
|
1561
|
+
if key.nil?
|
1562
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
params = {
|
1566
|
+
}
|
1567
|
+
|
1568
|
+
headers = {
|
1569
|
+
"content-type": 'application/json',
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
@client.call(
|
1573
|
+
method: 'DELETE',
|
1574
|
+
path: path,
|
1575
|
+
headers: headers,
|
1576
|
+
params: params,
|
1577
|
+
)
|
1578
|
+
end
|
1579
|
+
|
1580
|
+
|
1581
|
+
# Update relationship attribute. [Learn more about relationship
|
1582
|
+
# attributes](docs/databases-relationships#relationship-attributes).
|
1583
|
+
#
|
1584
|
+
#
|
1585
|
+
# @param [String] database_id Database ID.
|
1586
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1587
|
+
# @param [String] key Attribute Key.
|
1588
|
+
# @param [String] on_delete Constraints option
|
1589
|
+
#
|
1590
|
+
# @return [AttributeRelationship]
|
1591
|
+
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil)
|
1592
|
+
path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
|
1593
|
+
.gsub('{databaseId}', database_id)
|
1594
|
+
.gsub('{collectionId}', collection_id)
|
1595
|
+
.gsub('{key}', key)
|
1596
|
+
|
1597
|
+
if database_id.nil?
|
1598
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1599
|
+
end
|
1600
|
+
|
1601
|
+
if collection_id.nil?
|
1602
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1603
|
+
end
|
1604
|
+
|
1605
|
+
if key.nil?
|
1606
|
+
raise Appwrite::Exception.new('Missing required parameter: "key"')
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
params = {
|
1610
|
+
onDelete: on_delete,
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
headers = {
|
1614
|
+
"content-type": 'application/json',
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
@client.call(
|
1618
|
+
method: 'PATCH',
|
1619
|
+
path: path,
|
1620
|
+
headers: headers,
|
1621
|
+
params: params,
|
1622
|
+
response_type: Models::AttributeRelationship
|
1623
|
+
)
|
1624
|
+
end
|
1625
|
+
|
1626
|
+
|
1627
|
+
# Get a list of all the user's documents in a given collection. You can use
|
1628
|
+
# the query params to filter your results.
|
1629
|
+
#
|
1630
|
+
# @param [String] database_id Database ID.
|
1631
|
+
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1632
|
+
# @param [Array] 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.
|
1633
|
+
#
|
1634
|
+
# @return [DocumentList]
|
1635
|
+
def list_documents(database_id:, collection_id:, queries: nil)
|
1636
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
1637
|
+
.gsub('{databaseId}', database_id)
|
1638
|
+
.gsub('{collectionId}', collection_id)
|
1639
|
+
|
1640
|
+
if database_id.nil?
|
1641
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1642
|
+
end
|
1643
|
+
|
1644
|
+
if collection_id.nil?
|
1645
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1646
|
+
end
|
1647
|
+
|
1648
|
+
params = {
|
1649
|
+
queries: queries,
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
headers = {
|
1653
|
+
"content-type": 'application/json',
|
1654
|
+
}
|
1655
|
+
|
1656
|
+
@client.call(
|
1657
|
+
method: 'GET',
|
1658
|
+
path: path,
|
1659
|
+
headers: headers,
|
1660
|
+
params: params,
|
1661
|
+
response_type: Models::DocumentList
|
1662
|
+
)
|
1663
|
+
end
|
1664
|
+
|
1665
|
+
|
1666
|
+
# Create a new Document. Before using this route, you should create a new
|
1667
|
+
# collection resource using either a [server
|
1668
|
+
# integration](/docs/server/databases#databasesCreateCollection) API or
|
1669
|
+
# directly from your database console.
|
1670
|
+
#
|
1671
|
+
# @param [String] database_id Database ID.
|
1672
|
+
# @param [String] collection_id 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.
|
1673
|
+
# @param [String] document_id 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.
|
1674
|
+
# @param [Hash] data Document data as JSON object.
|
1675
|
+
# @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](/docs/permissions).
|
1676
|
+
#
|
1677
|
+
# @return [Document]
|
1678
|
+
def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
|
1679
|
+
path = '/databases/{databaseId}/collections/{collectionId}/documents'
|
1680
|
+
.gsub('{databaseId}', database_id)
|
1681
|
+
.gsub('{collectionId}', collection_id)
|
1682
|
+
|
1683
|
+
if database_id.nil?
|
1684
|
+
raise Appwrite::Exception.new('Missing required parameter: "databaseId"')
|
1685
|
+
end
|
1686
|
+
|
1687
|
+
if collection_id.nil?
|
1688
|
+
raise Appwrite::Exception.new('Missing required parameter: "collectionId"')
|
1689
|
+
end
|
1690
|
+
|
1691
|
+
if document_id.nil?
|
1692
|
+
raise Appwrite::Exception.new('Missing required parameter: "documentId"')
|
1693
|
+
end
|
1694
|
+
|
1695
|
+
if data.nil?
|
1696
|
+
raise Appwrite::Exception.new('Missing required parameter: "data"')
|
1065
1697
|
end
|
1066
1698
|
|
1067
1699
|
params = {
|
@@ -1090,9 +1722,10 @@ module Appwrite
|
|
1090
1722
|
# @param [String] database_id Database ID.
|
1091
1723
|
# @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
|
1092
1724
|
# @param [String] document_id Document ID.
|
1725
|
+
# @param [Array] 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.
|
1093
1726
|
#
|
1094
1727
|
# @return [Document]
|
1095
|
-
def get_document(database_id:, collection_id:, document_id:)
|
1728
|
+
def get_document(database_id:, collection_id:, document_id:, queries: nil)
|
1096
1729
|
path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
|
1097
1730
|
.gsub('{databaseId}', database_id)
|
1098
1731
|
.gsub('{collectionId}', collection_id)
|
@@ -1111,6 +1744,7 @@ module Appwrite
|
|
1111
1744
|
end
|
1112
1745
|
|
1113
1746
|
params = {
|
1747
|
+
queries: queries,
|
1114
1748
|
}
|
1115
1749
|
|
1116
1750
|
headers = {
|
@@ -1134,7 +1768,7 @@ module Appwrite
|
|
1134
1768
|
# @param [String] collection_id Collection ID.
|
1135
1769
|
# @param [String] document_id Document ID.
|
1136
1770
|
# @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
|
1137
|
-
# @param [Array] permissions An array of permissions strings. By default the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
1771
|
+
# @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
|
1138
1772
|
#
|
1139
1773
|
# @return [Document]
|
1140
1774
|
def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil)
|