Skip to content

Commit dba5c5d

Browse files
authored
Merge pull request #93 from appwrite/dev
Update attributes
2 parents 1cf23ad + fd53dd4 commit dba5c5d

13 files changed

+46
-24
lines changed

appwrite/client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ def __init__(self):
1313
self._endpoint = 'https://cloud.appwrite.io/v1'
1414
self._global_headers = {
1515
'content-type': '',
16-
'user-agent' : 'AppwritePythonSDK/6.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
16+
'user-agent' : 'AppwritePythonSDK/6.1.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})',
1717
'x-sdk-name': 'Python',
1818
'x-sdk-platform': 'server',
1919
'x-sdk-language': 'python',
20-
'x-sdk-version': '6.0.0',
20+
'x-sdk-version': '6.1.0',
2121
'X-Appwrite-Response-Format' : '1.6.0',
2222
}
2323

appwrite/services/databases.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de
257257
'content-type': 'application/json',
258258
}, api_params)
259259

260-
def update_boolean_attribute(self, database_id, collection_id, key, required, default):
260+
def update_boolean_attribute(self, database_id, collection_id, key, required, default, new_key = None):
261261
"""Update boolean attribute"""
262262

263263

@@ -281,6 +281,7 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de
281281

282282
api_params['required'] = required
283283
api_params['default'] = default
284+
api_params['newKey'] = new_key
284285

285286
return self.client.call('patch', api_path, {
286287
'content-type': 'application/json',
@@ -316,7 +317,7 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d
316317
'content-type': 'application/json',
317318
}, api_params)
318319

319-
def update_datetime_attribute(self, database_id, collection_id, key, required, default):
320+
def update_datetime_attribute(self, database_id, collection_id, key, required, default, new_key = None):
320321
"""Update dateTime attribute"""
321322

322323

@@ -340,6 +341,7 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d
340341

341342
api_params['required'] = required
342343
api_params['default'] = default
344+
api_params['newKey'] = new_key
343345

344346
return self.client.call('patch', api_path, {
345347
'content-type': 'application/json',
@@ -375,7 +377,7 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa
375377
'content-type': 'application/json',
376378
}, api_params)
377379

378-
def update_email_attribute(self, database_id, collection_id, key, required, default):
380+
def update_email_attribute(self, database_id, collection_id, key, required, default, new_key = None):
379381
"""Update email attribute"""
380382

381383

@@ -399,6 +401,7 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa
399401

400402
api_params['required'] = required
401403
api_params['default'] = default
404+
api_params['newKey'] = new_key
402405

403406
return self.client.call('patch', api_path, {
404407
'content-type': 'application/json',
@@ -438,7 +441,7 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi
438441
'content-type': 'application/json',
439442
}, api_params)
440443

441-
def update_enum_attribute(self, database_id, collection_id, key, elements, required, default):
444+
def update_enum_attribute(self, database_id, collection_id, key, elements, required, default, new_key = None):
442445
"""Update enum attribute"""
443446

444447

@@ -466,6 +469,7 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi
466469
api_params['elements'] = elements
467470
api_params['required'] = required
468471
api_params['default'] = default
472+
api_params['newKey'] = new_key
469473

470474
return self.client.call('patch', api_path, {
471475
'content-type': 'application/json',
@@ -503,7 +507,7 @@ def create_float_attribute(self, database_id, collection_id, key, required, min
503507
'content-type': 'application/json',
504508
}, api_params)
505509

506-
def update_float_attribute(self, database_id, collection_id, key, required, min, max, default):
510+
def update_float_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None):
507511
"""Update float attribute"""
508512

509513

@@ -535,6 +539,7 @@ def update_float_attribute(self, database_id, collection_id, key, required, min,
535539
api_params['min'] = min
536540
api_params['max'] = max
537541
api_params['default'] = default
542+
api_params['newKey'] = new_key
538543

539544
return self.client.call('patch', api_path, {
540545
'content-type': 'application/json',
@@ -572,7 +577,7 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi
572577
'content-type': 'application/json',
573578
}, api_params)
574579

575-
def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default):
580+
def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None):
576581
"""Update integer attribute"""
577582

578583

@@ -604,6 +609,7 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi
604609
api_params['min'] = min
605610
api_params['max'] = max
606611
api_params['default'] = default
612+
api_params['newKey'] = new_key
607613

608614
return self.client.call('patch', api_path, {
609615
'content-type': 'application/json',
@@ -639,7 +645,7 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default
639645
'content-type': 'application/json',
640646
}, api_params)
641647

642-
def update_ip_attribute(self, database_id, collection_id, key, required, default):
648+
def update_ip_attribute(self, database_id, collection_id, key, required, default, new_key = None):
643649
"""Update IP address attribute"""
644650

645651

@@ -663,6 +669,7 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default
663669

664670
api_params['required'] = required
665671
api_params['default'] = default
672+
api_params['newKey'] = new_key
666673

667674
return self.client.call('patch', api_path, {
668675
'content-type': 'application/json',
@@ -735,7 +742,7 @@ def create_string_attribute(self, database_id, collection_id, key, size, require
735742
'content-type': 'application/json',
736743
}, api_params)
737744

738-
def update_string_attribute(self, database_id, collection_id, key, required, default):
745+
def update_string_attribute(self, database_id, collection_id, key, required, default, size = None, new_key = None):
739746
"""Update string attribute"""
740747

741748

@@ -759,6 +766,8 @@ def update_string_attribute(self, database_id, collection_id, key, required, def
759766

760767
api_params['required'] = required
761768
api_params['default'] = default
769+
api_params['size'] = size
770+
api_params['newKey'] = new_key
762771

763772
return self.client.call('patch', api_path, {
764773
'content-type': 'application/json',
@@ -794,7 +803,7 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul
794803
'content-type': 'application/json',
795804
}, api_params)
796805

797-
def update_url_attribute(self, database_id, collection_id, key, required, default):
806+
def update_url_attribute(self, database_id, collection_id, key, required, default, new_key = None):
798807
"""Update URL attribute"""
799808

800809

@@ -818,6 +827,7 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul
818827

819828
api_params['required'] = required
820829
api_params['default'] = default
830+
api_params['newKey'] = new_key
821831

822832
return self.client.call('patch', api_path, {
823833
'content-type': 'application/json',
@@ -871,7 +881,7 @@ def delete_attribute(self, database_id, collection_id, key):
871881
'content-type': 'application/json',
872882
}, api_params)
873883

874-
def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None):
884+
def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None, new_key = None):
875885
"""Update relationship attribute"""
876886

877887

@@ -891,6 +901,7 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele
891901
api_path = api_path.replace('{key}', key)
892902

893903
api_params['onDelete'] = on_delete
904+
api_params['newKey'] = new_key
894905

895906
return self.client.call('patch', api_path, {
896907
'content-type': 'application/json',

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ result = databases.update_boolean_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = False
15+
default = False,
16+
new_key = '' # optional
1617
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ result = databases.update_datetime_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = ''
15+
default = '',
16+
new_key = '' # optional
1617
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ result = databases.update_email_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = '[email protected]'
15+
default = '[email protected]',
16+
new_key = '' # optional
1617
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ result = databases.update_enum_attribute(
1313
key = '',
1414
elements = [],
1515
required = False,
16-
default = '<DEFAULT>'
16+
default = '<DEFAULT>',
17+
new_key = '' # optional
1718
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_float_attribute(
1414
required = False,
1515
min = None,
1616
max = None,
17-
default = None
17+
default = None,
18+
new_key = '' # optional
1819
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ result = databases.update_integer_attribute(
1414
required = False,
1515
min = None,
1616
max = None,
17-
default = None
17+
default = None,
18+
new_key = '' # optional
1819
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ result = databases.update_ip_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = ''
15+
default = '',
16+
new_key = '' # optional
1617
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ result = databases.update_relationship_attribute(
1111
database_id = '<DATABASE_ID>',
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
14-
on_delete = RelationMutate.CASCADE # optional
14+
on_delete = RelationMutate.CASCADE, # optional
15+
new_key = '' # optional
1516
)

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ result = databases.update_string_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = '<DEFAULT>'
15+
default = '<DEFAULT>',
16+
size = None, # optional
17+
new_key = '' # optional
1618
)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ result = databases.update_url_attribute(
1212
collection_id = '<COLLECTION_ID>',
1313
key = '',
1414
required = False,
15-
default = 'https://example.com'
15+
default = 'https://example.com',
16+
new_key = '' # optional
1617
)

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'appwrite/encoders',
1414
'appwrite/enums',
1515
],
16-
version = '6.0.0',
16+
version = '6.1.0',
1717
license='BSD-3-Clause',
1818
description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API',
1919
long_description = long_description,
@@ -23,7 +23,7 @@
2323
maintainer = 'Appwrite Team',
2424
maintainer_email = '[email protected]',
2525
url = 'https://appwrite.io/support',
26-
download_url='https://github.com/appwrite/sdk-for-python/archive/6.0.0.tar.gz',
26+
download_url='https://github.com/appwrite/sdk-for-python/archive/6.1.0.tar.gz',
2727
install_requires=[
2828
'requests',
2929
],

0 commit comments

Comments
 (0)