Skip to content

Commit 37d2188

Browse files
authored
Merge pull request #29 from appwrite/dev
Update attributes
2 parents c3777a7 + ac440e6 commit 37d2188

13 files changed

+55
-22
lines changed

appwrite.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |spec|
22

33
spec.name = 'appwrite'
4-
spec.version = '12.0.0'
4+
spec.version = '12.1.0'
55
spec.license = 'BSD-3-Clause'
66
spec.summary = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API'
77
spec.author = 'Appwrite Team'

docs/examples/databases/update-boolean-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_boolean_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: false
17+
default: false,
18+
new_key: '' # optional
1819
)

docs/examples/databases/update-datetime-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_datetime_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: ''
17+
default: '',
18+
new_key: '' # optional
1819
)

docs/examples/databases/update-email-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_email_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: '[email protected]'
17+
default: '[email protected]',
18+
new_key: '' # optional
1819
)

docs/examples/databases/update-enum-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ result = databases.update_enum_attribute(
1515
key: '',
1616
elements: [],
1717
required: false,
18-
default: '<DEFAULT>'
18+
default: '<DEFAULT>',
19+
new_key: '' # optional
1920
)

docs/examples/databases/update-float-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ result = databases.update_float_attribute(
1616
required: false,
1717
min: null,
1818
max: null,
19-
default: null
19+
default: null,
20+
new_key: '' # optional
2021
)

docs/examples/databases/update-integer-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ result = databases.update_integer_attribute(
1616
required: false,
1717
min: null,
1818
max: null,
19-
default: null
19+
default: null,
20+
new_key: '' # optional
2021
)

docs/examples/databases/update-ip-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_ip_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: ''
17+
default: '',
18+
new_key: '' # optional
1819
)

docs/examples/databases/update-relationship-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ result = databases.update_relationship_attribute(
1313
database_id: '<DATABASE_ID>',
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
16-
on_delete: RelationMutate::CASCADE # optional
16+
on_delete: RelationMutate::CASCADE, # optional
17+
new_key: '' # optional
1718
)

docs/examples/databases/update-string-attribute.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ result = databases.update_string_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: '<DEFAULT>'
17+
default: '<DEFAULT>',
18+
size: null, # optional
19+
new_key: '' # optional
1820
)

docs/examples/databases/update-url-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_url_attribute(
1414
collection_id: '<COLLECTION_ID>',
1515
key: '',
1616
required: false,
17-
default: 'https://example.com'
17+
default: 'https://example.com',
18+
new_key: '' # optional
1819
)

lib/appwrite/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize
1515
'x-sdk-name'=> 'Ruby',
1616
'x-sdk-platform'=> 'server',
1717
'x-sdk-language'=> 'ruby',
18-
'x-sdk-version'=> '12.0.0',
18+
'x-sdk-version'=> '12.1.0',
1919
'X-Appwrite-Response-Format' => '1.6.0'
2020
}
2121
@endpoint = 'https://cloud.appwrite.io/v1'

lib/appwrite/services/databases.rb

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ def create_boolean_attribute(database_id:, collection_id:, key:, required:, defa
480480
# @param [String] key Attribute Key.
481481
# @param [] required Is attribute required?
482482
# @param [] default Default value for attribute when not provided. Cannot be set when attribute is required.
483+
# @param [String] new_key New attribute key.
483484
#
484485
# @return [AttributeBoolean]
485-
def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:)
486+
def update_boolean_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
486487
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'
487488
.gsub('{databaseId}', database_id)
488489
.gsub('{collectionId}', collection_id)
@@ -511,6 +512,7 @@ def update_boolean_attribute(database_id:, collection_id:, key:, required:, defa
511512
api_params = {
512513
required: required,
513514
default: default,
515+
newKey: new_key,
514516
}
515517

516518
api_headers = {
@@ -587,9 +589,10 @@ def create_datetime_attribute(database_id:, collection_id:, key:, required:, def
587589
# @param [String] key Attribute Key.
588590
# @param [] required Is attribute required?
589591
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
592+
# @param [String] new_key New attribute key.
590593
#
591594
# @return [AttributeDatetime]
592-
def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:)
595+
def update_datetime_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
593596
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'
594597
.gsub('{databaseId}', database_id)
595598
.gsub('{collectionId}', collection_id)
@@ -618,6 +621,7 @@ def update_datetime_attribute(database_id:, collection_id:, key:, required:, def
618621
api_params = {
619622
required: required,
620623
default: default,
624+
newKey: new_key,
621625
}
622626

623627
api_headers = {
@@ -696,9 +700,10 @@ def create_email_attribute(database_id:, collection_id:, key:, required:, defaul
696700
# @param [String] key Attribute Key.
697701
# @param [] required Is attribute required?
698702
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
703+
# @param [String] new_key New attribute key.
699704
#
700705
# @return [AttributeEmail]
701-
def update_email_attribute(database_id:, collection_id:, key:, required:, default:)
706+
def update_email_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
702707
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'
703708
.gsub('{databaseId}', database_id)
704709
.gsub('{collectionId}', collection_id)
@@ -727,6 +732,7 @@ def update_email_attribute(database_id:, collection_id:, key:, required:, defaul
727732
api_params = {
728733
required: required,
729734
default: default,
735+
newKey: new_key,
730736
}
731737

732738
api_headers = {
@@ -813,9 +819,10 @@ def create_enum_attribute(database_id:, collection_id:, key:, elements:, require
813819
# @param [Array] elements Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
814820
# @param [] required Is attribute required?
815821
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
822+
# @param [String] new_key New attribute key.
816823
#
817824
# @return [AttributeEnum]
818-
def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)
825+
def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:, new_key: nil)
819826
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'
820827
.gsub('{databaseId}', database_id)
821828
.gsub('{collectionId}', collection_id)
@@ -849,6 +856,7 @@ def update_enum_attribute(database_id:, collection_id:, key:, elements:, require
849856
elements: elements,
850857
required: required,
851858
default: default,
859+
newKey: new_key,
852860
}
853861

854862
api_headers = {
@@ -934,9 +942,10 @@ def create_float_attribute(database_id:, collection_id:, key:, required:, min: n
934942
# @param [Float] min Minimum value to enforce on new documents
935943
# @param [Float] max Maximum value to enforce on new documents
936944
# @param [Float] default Default value for attribute when not provided. Cannot be set when attribute is required.
945+
# @param [String] new_key New attribute key.
937946
#
938947
# @return [AttributeFloat]
939-
def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
948+
def update_float_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil)
940949
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'
941950
.gsub('{databaseId}', database_id)
942951
.gsub('{collectionId}', collection_id)
@@ -975,6 +984,7 @@ def update_float_attribute(database_id:, collection_id:, key:, required:, min:,
975984
min: min,
976985
max: max,
977986
default: default,
987+
newKey: new_key,
978988
}
979989

980990
api_headers = {
@@ -1060,9 +1070,10 @@ def create_integer_attribute(database_id:, collection_id:, key:, required:, min:
10601070
# @param [Integer] min Minimum value to enforce on new documents
10611071
# @param [Integer] max Maximum value to enforce on new documents
10621072
# @param [Integer] default Default value for attribute when not provided. Cannot be set when attribute is required.
1073+
# @param [String] new_key New attribute key.
10631074
#
10641075
# @return [AttributeInteger]
1065-
def update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:)
1076+
def update_integer_attribute(database_id:, collection_id:, key:, required:, min:, max:, default:, new_key: nil)
10661077
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'
10671078
.gsub('{databaseId}', database_id)
10681079
.gsub('{collectionId}', collection_id)
@@ -1101,6 +1112,7 @@ def update_integer_attribute(database_id:, collection_id:, key:, required:, min:
11011112
min: min,
11021113
max: max,
11031114
default: default,
1115+
newKey: new_key,
11041116
}
11051117

11061118
api_headers = {
@@ -1179,9 +1191,10 @@ def create_ip_attribute(database_id:, collection_id:, key:, required:, default:
11791191
# @param [String] key Attribute Key.
11801192
# @param [] required Is attribute required?
11811193
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
1194+
# @param [String] new_key New attribute key.
11821195
#
11831196
# @return [AttributeIp]
1184-
def update_ip_attribute(database_id:, collection_id:, key:, required:, default:)
1197+
def update_ip_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
11851198
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'
11861199
.gsub('{databaseId}', database_id)
11871200
.gsub('{collectionId}', collection_id)
@@ -1210,6 +1223,7 @@ def update_ip_attribute(database_id:, collection_id:, key:, required:, default:)
12101223
api_params = {
12111224
required: required,
12121225
default: default,
1226+
newKey: new_key,
12131227
}
12141228

12151229
api_headers = {
@@ -1354,9 +1368,11 @@ def create_string_attribute(database_id:, collection_id:, key:, size:, required:
13541368
# @param [String] key Attribute Key.
13551369
# @param [] required Is attribute required?
13561370
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
1371+
# @param [Integer] size Maximum size of the string attribute.
1372+
# @param [String] new_key New attribute key.
13571373
#
13581374
# @return [AttributeString]
1359-
def update_string_attribute(database_id:, collection_id:, key:, required:, default:)
1375+
def update_string_attribute(database_id:, collection_id:, key:, required:, default:, size: nil, new_key: nil)
13601376
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'
13611377
.gsub('{databaseId}', database_id)
13621378
.gsub('{collectionId}', collection_id)
@@ -1385,6 +1401,8 @@ def update_string_attribute(database_id:, collection_id:, key:, required:, defau
13851401
api_params = {
13861402
required: required,
13871403
default: default,
1404+
size: size,
1405+
newKey: new_key,
13881406
}
13891407

13901408
api_headers = {
@@ -1463,9 +1481,10 @@ def create_url_attribute(database_id:, collection_id:, key:, required:, default:
14631481
# @param [String] key Attribute Key.
14641482
# @param [] required Is attribute required?
14651483
# @param [String] default Default value for attribute when not provided. Cannot be set when attribute is required.
1484+
# @param [String] new_key New attribute key.
14661485
#
14671486
# @return [AttributeUrl]
1468-
def update_url_attribute(database_id:, collection_id:, key:, required:, default:)
1487+
def update_url_attribute(database_id:, collection_id:, key:, required:, default:, new_key: nil)
14691488
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'
14701489
.gsub('{databaseId}', database_id)
14711490
.gsub('{collectionId}', collection_id)
@@ -1494,6 +1513,7 @@ def update_url_attribute(database_id:, collection_id:, key:, required:, default:
14941513
api_params = {
14951514
required: required,
14961515
default: default,
1516+
newKey: new_key,
14971517
}
14981518

14991519
api_headers = {
@@ -1600,9 +1620,10 @@ def delete_attribute(database_id:, collection_id:, key:)
16001620
# @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).
16011621
# @param [String] key Attribute Key.
16021622
# @param [RelationMutate] on_delete Constraints option
1623+
# @param [String] new_key New attribute key.
16031624
#
16041625
# @return [AttributeRelationship]
1605-
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil)
1626+
def update_relationship_attribute(database_id:, collection_id:, key:, on_delete: nil, new_key: nil)
16061627
api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'
16071628
.gsub('{databaseId}', database_id)
16081629
.gsub('{collectionId}', collection_id)
@@ -1622,6 +1643,7 @@ def update_relationship_attribute(database_id:, collection_id:, key:, on_delete:
16221643

16231644
api_params = {
16241645
onDelete: on_delete,
1646+
newKey: new_key,
16251647
}
16261648

16271649
api_headers = {

0 commit comments

Comments
 (0)