diff --git a/appwrite/client.py b/appwrite/client.py index f85ab9f..9c96d2e 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -13,11 +13,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : 'AppwritePythonSDK/6.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/6.1.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '6.0.0', + 'x-sdk-version': '6.1.0', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 801b19b..aa47e4e 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -257,7 +257,7 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de 'content-type': 'application/json', }, api_params) - def update_boolean_attribute(self, database_id, collection_id, key, required, default): + def update_boolean_attribute(self, database_id, collection_id, key, required, default, new_key = None): """Update boolean attribute""" @@ -281,6 +281,7 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -316,7 +317,7 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d 'content-type': 'application/json', }, api_params) - def update_datetime_attribute(self, database_id, collection_id, key, required, default): + def update_datetime_attribute(self, database_id, collection_id, key, required, default, new_key = None): """Update dateTime attribute""" @@ -340,6 +341,7 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -375,7 +377,7 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa 'content-type': 'application/json', }, api_params) - def update_email_attribute(self, database_id, collection_id, key, required, default): + def update_email_attribute(self, database_id, collection_id, key, required, default, new_key = None): """Update email attribute""" @@ -399,6 +401,7 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -438,7 +441,7 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi 'content-type': 'application/json', }, api_params) - def update_enum_attribute(self, database_id, collection_id, key, elements, required, default): + def update_enum_attribute(self, database_id, collection_id, key, elements, required, default, new_key = None): """Update enum attribute""" @@ -466,6 +469,7 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi api_params['elements'] = elements api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -503,7 +507,7 @@ def create_float_attribute(self, database_id, collection_id, key, required, min 'content-type': 'application/json', }, api_params) - def update_float_attribute(self, database_id, collection_id, key, required, min, max, default): + def update_float_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None): """Update float attribute""" @@ -535,6 +539,7 @@ def update_float_attribute(self, database_id, collection_id, key, required, min, api_params['min'] = min api_params['max'] = max api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -572,7 +577,7 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi 'content-type': 'application/json', }, api_params) - def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default): + def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None): """Update integer attribute""" @@ -604,6 +609,7 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi api_params['min'] = min api_params['max'] = max api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -639,7 +645,7 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default 'content-type': 'application/json', }, api_params) - def update_ip_attribute(self, database_id, collection_id, key, required, default): + def update_ip_attribute(self, database_id, collection_id, key, required, default, new_key = None): """Update IP address attribute""" @@ -663,6 +669,7 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -735,7 +742,7 @@ def create_string_attribute(self, database_id, collection_id, key, size, require 'content-type': 'application/json', }, api_params) - def update_string_attribute(self, database_id, collection_id, key, required, default): + def update_string_attribute(self, database_id, collection_id, key, required, default, size = None, new_key = None): """Update string attribute""" @@ -759,6 +766,8 @@ def update_string_attribute(self, database_id, collection_id, key, required, def api_params['required'] = required api_params['default'] = default + api_params['size'] = size + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -794,7 +803,7 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul 'content-type': 'application/json', }, api_params) - def update_url_attribute(self, database_id, collection_id, key, required, default): + def update_url_attribute(self, database_id, collection_id, key, required, default, new_key = None): """Update URL attribute""" @@ -818,6 +827,7 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul api_params['required'] = required api_params['default'] = default + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', @@ -871,7 +881,7 @@ def delete_attribute(self, database_id, collection_id, key): 'content-type': 'application/json', }, api_params) - def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None): + def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None, new_key = None): """Update relationship attribute""" @@ -891,6 +901,7 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele api_path = api_path.replace('{key}', key) api_params['onDelete'] = on_delete + api_params['newKey'] = new_key return self.client.call('patch', api_path, { 'content-type': 'application/json', diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 8afccf9..553d94b 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -12,5 +12,6 @@ result = databases.update_boolean_attribute( collection_id = '', key = '', required = False, - default = False + default = False, + new_key = '' # optional ) diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index c85a60e..f9056d2 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -12,5 +12,6 @@ result = databases.update_datetime_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index cb9bc42..45a8d0d 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -12,5 +12,6 @@ result = databases.update_email_attribute( collection_id = '', key = '', required = False, - default = 'email@example.com' + default = 'email@example.com', + new_key = '' # optional ) diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 5336cbf..c07f375 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -13,5 +13,6 @@ result = databases.update_enum_attribute( key = '', elements = [], required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 23d1f81..fa1767e 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -14,5 +14,6 @@ result = databases.update_float_attribute( required = False, min = None, max = None, - default = None + default = None, + new_key = '' # optional ) diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index d9206af..0db9707 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -14,5 +14,6 @@ result = databases.update_integer_attribute( required = False, min = None, max = None, - default = None + default = None, + new_key = '' # optional ) diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 7370d09..135dbd8 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -12,5 +12,6 @@ result = databases.update_ip_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 3221865..bc528f1 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -11,5 +11,6 @@ result = databases.update_relationship_attribute( database_id = '', collection_id = '', key = '', - on_delete = RelationMutate.CASCADE # optional + on_delete = RelationMutate.CASCADE, # optional + new_key = '' # optional ) diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 0741d36..bbe7ddb 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -12,5 +12,7 @@ result = databases.update_string_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + size = None, # optional + new_key = '' # optional ) diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index d240be2..8e3a28d 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -12,5 +12,6 @@ result = databases.update_url_attribute( collection_id = '', key = '', required = False, - default = 'https://example.com' + default = 'https://example.com', + new_key = '' # optional ) diff --git a/setup.py b/setup.py index 498598f..8064d17 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '6.0.0', + version = '6.1.0', license='BSD-3-Clause', 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', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/6.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/6.1.0.tar.gz', install_requires=[ 'requests', ],