From f24f9b2dcd8f8fa1a5608a4191e5f016067af51c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 30 Aug 2023 11:13:48 +0200 Subject: [PATCH 1/2] feat: release 1.4.x --- README.md | 4 +- appwrite/client.py | 6 +- appwrite/services/account.py | 109 ++++++---- appwrite/services/avatars.py | 28 +-- appwrite/services/databases.py | 186 +++++++++--------- appwrite/services/functions.py | 147 +++++++++----- appwrite/services/graphql.py | 8 +- appwrite/services/health.py | 62 ++++-- appwrite/services/locale.py | 39 ++-- appwrite/services/project.py | 91 +++++++++ appwrite/services/proxy.py | 90 +++++++++ appwrite/services/storage.py | 55 +++--- appwrite/services/teams.py | 56 +++--- appwrite/services/users.py | 150 +++++++++----- docs/examples/account/delete-identity.md | 14 ++ docs/examples/account/list-identities.md | 14 ++ docs/examples/functions/create-deployment.md | 2 +- .../examples/functions/download-deployment.md | 14 ++ docs/examples/functions/update.md | 2 +- docs/examples/health/get-pub-sub.md | 14 ++ docs/examples/health/get-queue.md | 14 ++ docs/examples/locale/list-codes.md | 14 ++ docs/examples/project/create-variable.md | 14 ++ docs/examples/project/delete-variable.md | 14 ++ docs/examples/project/get-variable.md | 14 ++ docs/examples/project/list-variables.md | 14 ++ docs/examples/project/update-variable.md | 14 ++ docs/examples/proxy/create-rule.md | 14 ++ docs/examples/proxy/delete-rule.md | 14 ++ docs/examples/proxy/get-rule.md | 14 ++ docs/examples/proxy/list-rules.md | 14 ++ .../proxy/update-rule-verification.md | 14 ++ ...mbership-roles.md => update-membership.md} | 2 +- docs/examples/users/delete-identity.md | 14 ++ docs/examples/users/list-identities.md | 14 ++ docs/examples/users/update-labels.md | 14 ++ requirements.txt | 2 +- setup.py | 4 +- 38 files changed, 960 insertions(+), 349 deletions(-) create mode 100644 appwrite/services/project.py create mode 100644 appwrite/services/proxy.py create mode 100644 docs/examples/account/delete-identity.md create mode 100644 docs/examples/account/list-identities.md create mode 100644 docs/examples/functions/download-deployment.md create mode 100644 docs/examples/health/get-pub-sub.md create mode 100644 docs/examples/health/get-queue.md create mode 100644 docs/examples/locale/list-codes.md create mode 100644 docs/examples/project/create-variable.md create mode 100644 docs/examples/project/delete-variable.md create mode 100644 docs/examples/project/get-variable.md create mode 100644 docs/examples/project/list-variables.md create mode 100644 docs/examples/project/update-variable.md create mode 100644 docs/examples/proxy/create-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-verification.md rename docs/examples/teams/{update-membership-roles.md => update-membership.md} (80%) create mode 100644 docs/examples/users/delete-identity.md create mode 100644 docs/examples/users/list-identities.md create mode 100644 docs/examples/users/update-labels.md diff --git a/README.md b/README.md index ff7f246..b09c748 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.3.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** +**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite/client.py b/appwrite/client.py index 61248fa..8796040 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -11,12 +11,12 @@ def __init__(self): self._endpoint = 'https://HOSTNAME/v1' self._global_headers = { 'content-type': '', - 'user-agent' : 'AppwritePythonSDK/2.0.2 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/3.0.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': '2.0.2', - 'X-Appwrite-Response-Format' : '1.0.0', + 'x-sdk-version': '3.0.0', + 'X-Appwrite-Response-Format' : '1.4.0', } def set_self_signed(self, status=True): diff --git a/appwrite/services/account.py b/appwrite/services/account.py index aa1ea7f..1944d7c 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -10,10 +10,10 @@ def get(self): """Get Account""" - path = '/account' + api_path = '/account' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -21,7 +21,7 @@ def update_email(self, email, password): """Update Email""" - path = '/account/email' + api_path = '/account/email' params = {} if email is None: raise AppwriteException('Missing required parameter: "email"') @@ -33,7 +33,36 @@ def update_email(self, email, password): params['email'] = email params['password'] = password - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, params) + + def list_identities(self, queries = None): + """List Identities""" + + + api_path = '/account/identities' + params = {} + + params['queries'] = queries + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def delete_identity(self, identity_id): + """Delete Identity""" + + + api_path = '/account/identities/{identityId}' + params = {} + if identity_id is None: + raise AppwriteException('Missing required parameter: "identity_id"') + + path = path.replace('{identityId}', identity_id) + + + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -41,12 +70,12 @@ def list_logs(self, queries = None): """List Logs""" - path = '/account/logs' + api_path = '/account/logs' params = {} params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -54,7 +83,7 @@ def update_name(self, name): """Update Name""" - path = '/account/name' + api_path = '/account/name' params = {} if name is None: raise AppwriteException('Missing required parameter: "name"') @@ -62,7 +91,7 @@ def update_name(self, name): params['name'] = name - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -70,7 +99,7 @@ def update_password(self, password, old_password = None): """Update Password""" - path = '/account/password' + api_path = '/account/password' params = {} if password is None: raise AppwriteException('Missing required parameter: "password"') @@ -79,7 +108,7 @@ def update_password(self, password, old_password = None): params['password'] = password params['oldPassword'] = old_password - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -87,7 +116,7 @@ def update_phone(self, phone, password): """Update Phone""" - path = '/account/phone' + api_path = '/account/phone' params = {} if phone is None: raise AppwriteException('Missing required parameter: "phone"') @@ -99,7 +128,7 @@ def update_phone(self, phone, password): params['phone'] = phone params['password'] = password - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -107,10 +136,10 @@ def get_prefs(self): """Get Account Preferences""" - path = '/account/prefs' + api_path = '/account/prefs' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -118,7 +147,7 @@ def update_prefs(self, prefs): """Update Preferences""" - path = '/account/prefs' + api_path = '/account/prefs' params = {} if prefs is None: raise AppwriteException('Missing required parameter: "prefs"') @@ -126,7 +155,7 @@ def update_prefs(self, prefs): params['prefs'] = prefs - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -134,7 +163,7 @@ def create_recovery(self, email, url): """Create Password Recovery""" - path = '/account/recovery' + api_path = '/account/recovery' params = {} if email is None: raise AppwriteException('Missing required parameter: "email"') @@ -146,7 +175,7 @@ def create_recovery(self, email, url): params['email'] = email params['url'] = url - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -154,7 +183,7 @@ def update_recovery(self, user_id, secret, password, password_again): """Create Password Recovery (confirmation)""" - path = '/account/recovery' + api_path = '/account/recovery' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -174,7 +203,7 @@ def update_recovery(self, user_id, secret, password, password_again): params['password'] = password params['passwordAgain'] = password_again - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -182,10 +211,10 @@ def list_sessions(self): """List Sessions""" - path = '/account/sessions' + api_path = '/account/sessions' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -193,10 +222,10 @@ def delete_sessions(self): """Delete Sessions""" - path = '/account/sessions' + api_path = '/account/sessions' params = {} - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -204,7 +233,7 @@ def get_session(self, session_id): """Get Session""" - path = '/account/sessions/{sessionId}' + api_path = '/account/sessions/{sessionId}' params = {} if session_id is None: raise AppwriteException('Missing required parameter: "session_id"') @@ -212,7 +241,7 @@ def get_session(self, session_id): path = path.replace('{sessionId}', session_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -220,7 +249,7 @@ def update_session(self, session_id): """Update OAuth Session (Refresh Tokens)""" - path = '/account/sessions/{sessionId}' + api_path = '/account/sessions/{sessionId}' params = {} if session_id is None: raise AppwriteException('Missing required parameter: "session_id"') @@ -228,7 +257,7 @@ def update_session(self, session_id): path = path.replace('{sessionId}', session_id) - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -236,7 +265,7 @@ def delete_session(self, session_id): """Delete Session""" - path = '/account/sessions/{sessionId}' + api_path = '/account/sessions/{sessionId}' params = {} if session_id is None: raise AppwriteException('Missing required parameter: "session_id"') @@ -244,7 +273,7 @@ def delete_session(self, session_id): path = path.replace('{sessionId}', session_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -252,10 +281,10 @@ def update_status(self): """Update Status""" - path = '/account/status' + api_path = '/account/status' params = {} - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -263,7 +292,7 @@ def create_verification(self, url): """Create Email Verification""" - path = '/account/verification' + api_path = '/account/verification' params = {} if url is None: raise AppwriteException('Missing required parameter: "url"') @@ -271,7 +300,7 @@ def create_verification(self, url): params['url'] = url - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -279,7 +308,7 @@ def update_verification(self, user_id, secret): """Create Email Verification (confirmation)""" - path = '/account/verification' + api_path = '/account/verification' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -291,7 +320,7 @@ def update_verification(self, user_id, secret): params['userId'] = user_id params['secret'] = secret - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -299,10 +328,10 @@ def create_phone_verification(self): """Create Phone Verification""" - path = '/account/verification/phone' + api_path = '/account/verification/phone' params = {} - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -310,7 +339,7 @@ def update_phone_verification(self, user_id, secret): """Create Phone Verification (confirmation)""" - path = '/account/verification/phone' + api_path = '/account/verification/phone' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -322,6 +351,6 @@ def update_phone_verification(self, user_id, secret): params['userId'] = user_id params['secret'] = secret - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 64d9bf4..de9e0ed 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -10,7 +10,7 @@ def get_browser(self, code, width = None, height = None, quality = None): """Get Browser Icon""" - path = '/avatars/browsers/{code}' + api_path = '/avatars/browsers/{code}' params = {} if code is None: raise AppwriteException('Missing required parameter: "code"') @@ -21,7 +21,7 @@ def get_browser(self, code, width = None, height = None, quality = None): params['height'] = height params['quality'] = quality - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -29,7 +29,7 @@ def get_credit_card(self, code, width = None, height = None, quality = None): """Get Credit Card Icon""" - path = '/avatars/credit-cards/{code}' + api_path = '/avatars/credit-cards/{code}' params = {} if code is None: raise AppwriteException('Missing required parameter: "code"') @@ -40,7 +40,7 @@ def get_credit_card(self, code, width = None, height = None, quality = None): params['height'] = height params['quality'] = quality - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -48,7 +48,7 @@ def get_favicon(self, url): """Get Favicon""" - path = '/avatars/favicon' + api_path = '/avatars/favicon' params = {} if url is None: raise AppwriteException('Missing required parameter: "url"') @@ -56,7 +56,7 @@ def get_favicon(self, url): params['url'] = url - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -64,7 +64,7 @@ def get_flag(self, code, width = None, height = None, quality = None): """Get Country Flag""" - path = '/avatars/flags/{code}' + api_path = '/avatars/flags/{code}' params = {} if code is None: raise AppwriteException('Missing required parameter: "code"') @@ -75,7 +75,7 @@ def get_flag(self, code, width = None, height = None, quality = None): params['height'] = height params['quality'] = quality - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -83,7 +83,7 @@ def get_image(self, url, width = None, height = None): """Get Image from URL""" - path = '/avatars/image' + api_path = '/avatars/image' params = {} if url is None: raise AppwriteException('Missing required parameter: "url"') @@ -93,7 +93,7 @@ def get_image(self, url, width = None, height = None): params['width'] = width params['height'] = height - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -101,7 +101,7 @@ def get_initials(self, name = None, width = None, height = None, background = No """Get User Initials""" - path = '/avatars/initials' + api_path = '/avatars/initials' params = {} params['name'] = name @@ -109,7 +109,7 @@ def get_initials(self, name = None, width = None, height = None, background = No params['height'] = height params['background'] = background - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -117,7 +117,7 @@ def get_qr(self, text, size = None, margin = None, download = None): """Get QR Code""" - path = '/avatars/qr' + api_path = '/avatars/qr' params = {} if text is None: raise AppwriteException('Missing required parameter: "text"') @@ -128,6 +128,6 @@ def get_qr(self, text, size = None, margin = None, download = None): params['margin'] = margin params['download'] = download - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 6d1b932..689d002 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -10,21 +10,21 @@ def list(self, queries = None, search = None): """List Databases""" - path = '/databases' + api_path = '/databases' params = {} params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def create(self, database_id, name): + def create(self, database_id, name, enabled = None): """Create Database""" - path = '/databases' + api_path = '/databases' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -35,8 +35,9 @@ def create(self, database_id, name): params['databaseId'] = database_id params['name'] = name + params['enabled'] = enabled - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -44,7 +45,7 @@ def get(self, database_id): """Get Database""" - path = '/databases/{databaseId}' + api_path = '/databases/{databaseId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -52,15 +53,15 @@ def get(self, database_id): path = path.replace('{databaseId}', database_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def update(self, database_id, name): + def update(self, database_id, name, enabled = None): """Update Database""" - path = '/databases/{databaseId}' + api_path = '/databases/{databaseId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -71,8 +72,9 @@ def update(self, database_id, name): path = path.replace('{databaseId}', database_id) params['name'] = name + params['enabled'] = enabled - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -80,7 +82,7 @@ def delete(self, database_id): """Delete Database""" - path = '/databases/{databaseId}' + api_path = '/databases/{databaseId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -88,7 +90,7 @@ def delete(self, database_id): path = path.replace('{databaseId}', database_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -96,7 +98,7 @@ def list_collections(self, database_id, queries = None, search = None): """List Collections""" - path = '/databases/{databaseId}/collections' + api_path = '/databases/{databaseId}/collections' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -106,15 +108,15 @@ def list_collections(self, database_id, queries = None, search = None): params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def create_collection(self, database_id, collection_id, name, permissions = None, document_security = None): + def create_collection(self, database_id, collection_id, name, permissions = None, document_security = None, enabled = None): """Create Collection""" - path = '/databases/{databaseId}/collections' + api_path = '/databases/{databaseId}/collections' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -131,8 +133,9 @@ def create_collection(self, database_id, collection_id, name, permissions = None params['name'] = name params['permissions'] = permissions params['documentSecurity'] = document_security + params['enabled'] = enabled - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -140,7 +143,7 @@ def get_collection(self, database_id, collection_id): """Get Collection""" - path = '/databases/{databaseId}/collections/{collectionId}' + api_path = '/databases/{databaseId}/collections/{collectionId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -152,7 +155,7 @@ def get_collection(self, database_id, collection_id): path = path.replace('{collectionId}', collection_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -160,7 +163,7 @@ def update_collection(self, database_id, collection_id, name, permissions = None """Update Collection""" - path = '/databases/{databaseId}/collections/{collectionId}' + api_path = '/databases/{databaseId}/collections/{collectionId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -179,7 +182,7 @@ def update_collection(self, database_id, collection_id, name, permissions = None params['documentSecurity'] = document_security params['enabled'] = enabled - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -187,7 +190,7 @@ def delete_collection(self, database_id, collection_id): """Delete Collection""" - path = '/databases/{databaseId}/collections/{collectionId}' + api_path = '/databases/{databaseId}/collections/{collectionId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -199,15 +202,15 @@ def delete_collection(self, database_id, collection_id): path = path.replace('{collectionId}', collection_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) - def list_attributes(self, database_id, collection_id): + def list_attributes(self, database_id, collection_id, queries = None): """List Attributes""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -218,8 +221,9 @@ def list_attributes(self, database_id, collection_id): path = path.replace('{databaseId}', database_id) path = path.replace('{collectionId}', collection_id) + params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -227,7 +231,7 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de """Create Boolean Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -249,7 +253,7 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -257,7 +261,7 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de """Update Boolean Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -278,7 +282,7 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -286,7 +290,7 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d """Create DateTime Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -308,7 +312,7 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -316,7 +320,7 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d """Update DateTime Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -337,7 +341,7 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -345,7 +349,7 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa """Create Email Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -367,7 +371,7 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -375,7 +379,7 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa """Update Email Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -396,7 +400,7 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -404,7 +408,7 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi """Create Enum Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -430,7 +434,7 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -438,7 +442,7 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi """Update Enum Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -463,7 +467,7 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -471,7 +475,7 @@ def create_float_attribute(self, database_id, collection_id, key, required, min """Create Float Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -495,7 +499,7 @@ def create_float_attribute(self, database_id, collection_id, key, required, min params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -503,7 +507,7 @@ def update_float_attribute(self, database_id, collection_id, key, required, min, """Update Float Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -532,7 +536,7 @@ def update_float_attribute(self, database_id, collection_id, key, required, min, params['max'] = max params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -540,7 +544,7 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi """Create Integer Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -564,7 +568,7 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -572,7 +576,7 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi """Update Integer Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -601,7 +605,7 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi params['max'] = max params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -609,7 +613,7 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default """Create IP Address Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -631,7 +635,7 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -639,7 +643,7 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default """Update IP Address Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -660,7 +664,7 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -668,7 +672,7 @@ def create_relationship_attribute(self, database_id, collection_id, related_coll """Create Relationship Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -692,15 +696,15 @@ def create_relationship_attribute(self, database_id, collection_id, related_coll params['twoWayKey'] = two_way_key params['onDelete'] = on_delete - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) - def create_string_attribute(self, database_id, collection_id, key, size, required, default = None, array = None): + def create_string_attribute(self, database_id, collection_id, key, size, required, default = None, array = None, encrypt = None): """Create String Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -725,8 +729,9 @@ def create_string_attribute(self, database_id, collection_id, key, size, require params['required'] = required params['default'] = default params['array'] = array + params['encrypt'] = encrypt - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -734,7 +739,7 @@ def update_string_attribute(self, database_id, collection_id, key, required, def """Update String Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -755,7 +760,7 @@ def update_string_attribute(self, database_id, collection_id, key, required, def params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -763,7 +768,7 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul """Create URL Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -785,7 +790,7 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul params['default'] = default params['array'] = array - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -793,7 +798,7 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul """Update URL Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -814,7 +819,7 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul params['required'] = required params['default'] = default - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -822,7 +827,7 @@ def get_attribute(self, database_id, collection_id, key): """Get Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -838,7 +843,7 @@ def get_attribute(self, database_id, collection_id, key): path = path.replace('{key}', key) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -846,7 +851,7 @@ def delete_attribute(self, database_id, collection_id, key): """Delete Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -862,7 +867,7 @@ def delete_attribute(self, database_id, collection_id, key): path = path.replace('{key}', key) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -870,7 +875,7 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele """Update Relationship Attribute""" - path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' + api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -887,7 +892,7 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele params['onDelete'] = on_delete - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -895,7 +900,7 @@ def list_documents(self, database_id, collection_id, queries = None): """List Documents""" - path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -908,7 +913,7 @@ def list_documents(self, database_id, collection_id, queries = None): params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -916,7 +921,7 @@ def create_document(self, database_id, collection_id, document_id, data, permiss """Create Document""" - path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -937,7 +942,7 @@ def create_document(self, database_id, collection_id, document_id, data, permiss params['data'] = data params['permissions'] = permissions - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -945,7 +950,7 @@ def get_document(self, database_id, collection_id, document_id, queries = None): """Get Document""" - path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -962,7 +967,7 @@ def get_document(self, database_id, collection_id, document_id, queries = None): params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -970,7 +975,7 @@ def update_document(self, database_id, collection_id, document_id, data = None, """Update Document""" - path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -988,7 +993,7 @@ def update_document(self, database_id, collection_id, document_id, data = None, params['data'] = data params['permissions'] = permissions - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -996,7 +1001,7 @@ def delete_document(self, database_id, collection_id, document_id): """Delete Document""" - path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -1012,15 +1017,15 @@ def delete_document(self, database_id, collection_id, document_id): path = path.replace('{documentId}', document_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) - def list_indexes(self, database_id, collection_id): + def list_indexes(self, database_id, collection_id, queries = None): """List Indexes""" - path = '/databases/{databaseId}/collections/{collectionId}/indexes' + api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -1031,8 +1036,9 @@ def list_indexes(self, database_id, collection_id): path = path.replace('{databaseId}', database_id) path = path.replace('{collectionId}', collection_id) + params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -1040,7 +1046,7 @@ def create_index(self, database_id, collection_id, key, type, attributes, orders """Create Index""" - path = '/databases/{databaseId}/collections/{collectionId}/indexes' + api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -1065,7 +1071,7 @@ def create_index(self, database_id, collection_id, key, type, attributes, orders params['attributes'] = attributes params['orders'] = orders - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -1073,7 +1079,7 @@ def get_index(self, database_id, collection_id, key): """Get Index""" - path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -1089,7 +1095,7 @@ def get_index(self, database_id, collection_id, key): path = path.replace('{key}', key) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -1097,7 +1103,7 @@ def delete_index(self, database_id, collection_id, key): """Delete Index""" - path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' + api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' params = {} if database_id is None: raise AppwriteException('Missing required parameter: "database_id"') @@ -1113,6 +1119,6 @@ def delete_index(self, database_id, collection_id, key): path = path.replace('{key}', key) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index ce5468d..af4efd5 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -10,21 +10,21 @@ def list(self, queries = None, search = None): """List Functions""" - path = '/functions' + api_path = '/functions' params = {} params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def create(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None): + def create(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None, template_repository = None, template_owner = None, template_root_directory = None, template_branch = None): """Create Function""" - path = '/functions' + api_path = '/functions' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -38,14 +38,26 @@ def create(self, function_id, name, runtime, execute = None, events = None, sche params['functionId'] = function_id params['name'] = name - params['execute'] = execute params['runtime'] = runtime + params['execute'] = execute params['events'] = events params['schedule'] = schedule params['timeout'] = timeout params['enabled'] = enabled - - return self.client.call('post', path, { + params['logging'] = logging + params['entrypoint'] = entrypoint + params['commands'] = commands + params['installationId'] = installation_id + params['providerRepositoryId'] = provider_repository_id + params['providerBranch'] = provider_branch + params['providerSilentMode'] = provider_silent_mode + params['providerRootDirectory'] = provider_root_directory + params['templateRepository'] = template_repository + params['templateOwner'] = template_owner + params['templateRootDirectory'] = template_root_directory + params['templateBranch'] = template_branch + + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -53,10 +65,10 @@ def list_runtimes(self): """List runtimes""" - path = '/functions/runtimes' + api_path = '/functions/runtimes' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -64,7 +76,7 @@ def get(self, function_id): """Get Function""" - path = '/functions/{functionId}' + api_path = '/functions/{functionId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -72,15 +84,15 @@ def get(self, function_id): path = path.replace('{functionId}', function_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def update(self, function_id, name, execute = None, events = None, schedule = None, timeout = None, enabled = None): + def update(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None): """Update Function""" - path = '/functions/{functionId}' + api_path = '/functions/{functionId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -88,16 +100,28 @@ def update(self, function_id, name, execute = None, events = None, schedule = No if name is None: raise AppwriteException('Missing required parameter: "name"') + if runtime is None: + raise AppwriteException('Missing required parameter: "runtime"') + path = path.replace('{functionId}', function_id) params['name'] = name + params['runtime'] = runtime params['execute'] = execute params['events'] = events params['schedule'] = schedule params['timeout'] = timeout params['enabled'] = enabled - - return self.client.call('put', path, { + params['logging'] = logging + params['entrypoint'] = entrypoint + params['commands'] = commands + params['installationId'] = installation_id + params['providerRepositoryId'] = provider_repository_id + params['providerBranch'] = provider_branch + params['providerSilentMode'] = provider_silent_mode + params['providerRootDirectory'] = provider_root_directory + + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -105,7 +129,7 @@ def delete(self, function_id): """Delete Function""" - path = '/functions/{functionId}' + api_path = '/functions/{functionId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -113,7 +137,7 @@ def delete(self, function_id): path = path.replace('{functionId}', function_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -121,7 +145,7 @@ def list_deployments(self, function_id, queries = None, search = None): """List Deployments""" - path = '/functions/{functionId}/deployments' + api_path = '/functions/{functionId}/deployments' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -131,22 +155,19 @@ def list_deployments(self, function_id, queries = None, search = None): params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def create_deployment(self, function_id, entrypoint, code, activate, on_progress = None): + def create_deployment(self, function_id, code, activate, entrypoint = None, commands = None, on_progress = None): """Create Deployment""" - path = '/functions/{functionId}/deployments' + api_path = '/functions/{functionId}/deployments' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') - if entrypoint is None: - raise AppwriteException('Missing required parameter: "entrypoint"') - if code is None: raise AppwriteException('Missing required parameter: "code"') @@ -156,6 +177,7 @@ def create_deployment(self, function_id, entrypoint, code, activate, on_progress path = path.replace('{functionId}', function_id) params['entrypoint'] = entrypoint + params['commands'] = commands params['code'] = str(code).lower() if type(code) is bool else code params['activate'] = str(activate).lower() if type(activate) is bool else activate @@ -164,7 +186,7 @@ def create_deployment(self, function_id, entrypoint, code, activate, on_progress upload_id = '' - return self.client.chunked_upload(path, { + return self.client.chunked_upload(api_path, { 'content-type': 'multipart/form-data', }, params, param_name, on_progress, upload_id) @@ -172,7 +194,7 @@ def get_deployment(self, function_id, deployment_id): """Get Deployment""" - path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/{deploymentId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -184,7 +206,7 @@ def get_deployment(self, function_id, deployment_id): path = path.replace('{deploymentId}', deployment_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -192,7 +214,7 @@ def update_deployment(self, function_id, deployment_id): """Update Function Deployment""" - path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/{deploymentId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -204,7 +226,7 @@ def update_deployment(self, function_id, deployment_id): path = path.replace('{deploymentId}', deployment_id) - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -212,7 +234,7 @@ def delete_deployment(self, function_id, deployment_id): """Delete Deployment""" - path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/{deploymentId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -224,7 +246,7 @@ def delete_deployment(self, function_id, deployment_id): path = path.replace('{deploymentId}', deployment_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -232,7 +254,7 @@ def create_build(self, function_id, deployment_id, build_id): """Create Build""" - path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}' + api_path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -248,7 +270,27 @@ def create_build(self, function_id, deployment_id, build_id): path = path.replace('{buildId}', build_id) - return self.client.call('post', path, { + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, params) + + def download_deployment(self, function_id, deployment_id): + """Download Deployment""" + + + api_path = '/functions/{functionId}/deployments/{deploymentId}/download' + params = {} + if function_id is None: + raise AppwriteException('Missing required parameter: "function_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + path = path.replace('{functionId}', function_id) + path = path.replace('{deploymentId}', deployment_id) + + + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -256,7 +298,7 @@ def list_executions(self, function_id, queries = None, search = None): """List Executions""" - path = '/functions/{functionId}/executions' + api_path = '/functions/{functionId}/executions' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -266,25 +308,28 @@ def list_executions(self, function_id, queries = None, search = None): params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def create_execution(self, function_id, data = None, xasync = None): + def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None): """Create Execution""" - path = '/functions/{functionId}/executions' + api_path = '/functions/{functionId}/executions' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') path = path.replace('{functionId}', function_id) - params['data'] = data + params['body'] = body params['async'] = xasync + params['path'] = path + params['method'] = method + params['headers'] = headers - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -292,7 +337,7 @@ def get_execution(self, function_id, execution_id): """Get Execution""" - path = '/functions/{functionId}/executions/{executionId}' + api_path = '/functions/{functionId}/executions/{executionId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -304,7 +349,7 @@ def get_execution(self, function_id, execution_id): path = path.replace('{executionId}', execution_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -312,7 +357,7 @@ def list_variables(self, function_id): """List Variables""" - path = '/functions/{functionId}/variables' + api_path = '/functions/{functionId}/variables' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -320,7 +365,7 @@ def list_variables(self, function_id): path = path.replace('{functionId}', function_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -328,7 +373,7 @@ def create_variable(self, function_id, key, value): """Create Variable""" - path = '/functions/{functionId}/variables' + api_path = '/functions/{functionId}/variables' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -344,7 +389,7 @@ def create_variable(self, function_id, key, value): params['key'] = key params['value'] = value - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -352,7 +397,7 @@ def get_variable(self, function_id, variable_id): """Get Variable""" - path = '/functions/{functionId}/variables/{variableId}' + api_path = '/functions/{functionId}/variables/{variableId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -364,7 +409,7 @@ def get_variable(self, function_id, variable_id): path = path.replace('{variableId}', variable_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -372,7 +417,7 @@ def update_variable(self, function_id, variable_id, key, value = None): """Update Variable""" - path = '/functions/{functionId}/variables/{variableId}' + api_path = '/functions/{functionId}/variables/{variableId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -389,7 +434,7 @@ def update_variable(self, function_id, variable_id, key, value = None): params['key'] = key params['value'] = value - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -397,7 +442,7 @@ def delete_variable(self, function_id, variable_id): """Delete Variable""" - path = '/functions/{functionId}/variables/{variableId}' + api_path = '/functions/{functionId}/variables/{variableId}' params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -409,6 +454,6 @@ def delete_variable(self, function_id, variable_id): path = path.replace('{variableId}', variable_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 4976f8c..04ef1e1 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -10,7 +10,7 @@ def query(self, query): """GraphQL Endpoint""" - path = '/graphql' + api_path = '/graphql' params = {} if query is None: raise AppwriteException('Missing required parameter: "query"') @@ -18,7 +18,7 @@ def query(self, query): params['query'] = query - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, params) @@ -27,7 +27,7 @@ def mutation(self, query): """GraphQL Endpoint""" - path = '/graphql/mutation' + api_path = '/graphql/mutation' params = {} if query is None: raise AppwriteException('Missing required parameter: "query"') @@ -35,7 +35,7 @@ def mutation(self, query): params['query'] = query - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'x-sdk-graphql': 'true', 'content-type': 'application/json', }, params) diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 8724985..b3dc538 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -10,10 +10,10 @@ def get(self): """Get HTTP""" - path = '/health' + api_path = '/health' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -21,10 +21,10 @@ def get_antivirus(self): """Get Antivirus""" - path = '/health/anti-virus' + api_path = '/health/anti-virus' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -32,10 +32,10 @@ def get_cache(self): """Get Cache""" - path = '/health/cache' + api_path = '/health/cache' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -43,10 +43,32 @@ def get_db(self): """Get DB""" - path = '/health/db' + api_path = '/health/db' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def get_pub_sub(self): + """Get PubSub""" + + + api_path = '/health/pubsub' + params = {} + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def get_queue(self): + """Get Queue""" + + + api_path = '/health/queue' + params = {} + + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -54,10 +76,10 @@ def get_queue_certificates(self): """Get Certificates Queue""" - path = '/health/queue/certificates' + api_path = '/health/queue/certificates' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -65,10 +87,10 @@ def get_queue_functions(self): """Get Functions Queue""" - path = '/health/queue/functions' + api_path = '/health/queue/functions' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -76,10 +98,10 @@ def get_queue_logs(self): """Get Logs Queue""" - path = '/health/queue/logs' + api_path = '/health/queue/logs' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -87,10 +109,10 @@ def get_queue_webhooks(self): """Get Webhooks Queue""" - path = '/health/queue/webhooks' + api_path = '/health/queue/webhooks' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -98,10 +120,10 @@ def get_storage_local(self): """Get Local Storage""" - path = '/health/storage/local' + api_path = '/health/storage/local' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -109,9 +131,9 @@ def get_time(self): """Get Time""" - path = '/health/time' + api_path = '/health/time' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 4dc02ac..f992b53 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -10,10 +10,21 @@ def get(self): """Get User Locale""" - path = '/locale' + api_path = '/locale' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def list_codes(self): + """List Locale Codes""" + + + api_path = '/locale/codes' + params = {} + + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -21,10 +32,10 @@ def list_continents(self): """List Continents""" - path = '/locale/continents' + api_path = '/locale/continents' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -32,10 +43,10 @@ def list_countries(self): """List Countries""" - path = '/locale/countries' + api_path = '/locale/countries' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -43,10 +54,10 @@ def list_countries_eu(self): """List EU Countries""" - path = '/locale/countries/eu' + api_path = '/locale/countries/eu' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -54,10 +65,10 @@ def list_countries_phones(self): """List Countries Phone Codes""" - path = '/locale/countries/phones' + api_path = '/locale/countries/phones' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -65,10 +76,10 @@ def list_currencies(self): """List Currencies""" - path = '/locale/currencies' + api_path = '/locale/currencies' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -76,9 +87,9 @@ def list_languages(self): """List Languages""" - path = '/locale/languages' + api_path = '/locale/languages' params = {} - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/project.py b/appwrite/services/project.py new file mode 100644 index 0000000..57d44f7 --- /dev/null +++ b/appwrite/services/project.py @@ -0,0 +1,91 @@ +from ..service import Service +from ..exception import AppwriteException + +class Project(Service): + + def __init__(self, client): + super(Project, self).__init__(client) + + def list_variables(self): + """List Variables""" + + + api_path = '/project/variables' + params = {} + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def create_variable(self, key, value): + """Create Variable""" + + + api_path = '/project/variables' + params = {} + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if value is None: + raise AppwriteException('Missing required parameter: "value"') + + + params['key'] = key + params['value'] = value + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, params) + + def get_variable(self, variable_id): + """Get Variable""" + + + api_path = '/project/variables/{variableId}' + params = {} + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + path = path.replace('{variableId}', variable_id) + + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def update_variable(self, variable_id, key, value = None): + """Update Variable""" + + + api_path = '/project/variables/{variableId}' + params = {} + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + path = path.replace('{variableId}', variable_id) + + params['key'] = key + params['value'] = value + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, params) + + def delete_variable(self, variable_id): + """Delete Variable""" + + + api_path = '/project/variables/{variableId}' + params = {} + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + path = path.replace('{variableId}', variable_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, params) diff --git a/appwrite/services/proxy.py b/appwrite/services/proxy.py new file mode 100644 index 0000000..9f41fce --- /dev/null +++ b/appwrite/services/proxy.py @@ -0,0 +1,90 @@ +from ..service import Service +from ..exception import AppwriteException + +class Proxy(Service): + + def __init__(self, client): + super(Proxy, self).__init__(client) + + def list_rules(self, queries = None, search = None): + """List Rules""" + + + api_path = '/proxy/rules' + params = {} + + params['queries'] = queries + params['search'] = search + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def create_rule(self, domain, resource_type, resource_id = None): + """Create Rule""" + + + api_path = '/proxy/rules' + params = {} + if domain is None: + raise AppwriteException('Missing required parameter: "domain"') + + if resource_type is None: + raise AppwriteException('Missing required parameter: "resource_type"') + + + params['domain'] = domain + params['resourceType'] = resource_type + params['resourceId'] = resource_id + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, params) + + def get_rule(self, rule_id): + """Get Rule""" + + + api_path = '/proxy/rules/{ruleId}' + params = {} + if rule_id is None: + raise AppwriteException('Missing required parameter: "rule_id"') + + path = path.replace('{ruleId}', rule_id) + + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def delete_rule(self, rule_id): + """Delete Rule""" + + + api_path = '/proxy/rules/{ruleId}' + params = {} + if rule_id is None: + raise AppwriteException('Missing required parameter: "rule_id"') + + path = path.replace('{ruleId}', rule_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, params) + + def update_rule_verification(self, rule_id): + """Update Rule Verification Status""" + + + api_path = '/proxy/rules/{ruleId}/verification' + params = {} + if rule_id is None: + raise AppwriteException('Missing required parameter: "rule_id"') + + path = path.replace('{ruleId}', rule_id) + + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 96427d3..4b8f38a 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -10,13 +10,13 @@ def list_buckets(self, queries = None, search = None): """List buckets""" - path = '/storage/buckets' + api_path = '/storage/buckets' params = {} params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -24,7 +24,7 @@ def create_bucket(self, bucket_id, name, permissions = None, file_security = Non """Create bucket""" - path = '/storage/buckets' + api_path = '/storage/buckets' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -44,7 +44,7 @@ def create_bucket(self, bucket_id, name, permissions = None, file_security = Non params['encryption'] = encryption params['antivirus'] = antivirus - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -52,7 +52,7 @@ def get_bucket(self, bucket_id): """Get Bucket""" - path = '/storage/buckets/{bucketId}' + api_path = '/storage/buckets/{bucketId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -60,7 +60,7 @@ def get_bucket(self, bucket_id): path = path.replace('{bucketId}', bucket_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -68,7 +68,7 @@ def update_bucket(self, bucket_id, name, permissions = None, file_security = Non """Update Bucket""" - path = '/storage/buckets/{bucketId}' + api_path = '/storage/buckets/{bucketId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -88,7 +88,7 @@ def update_bucket(self, bucket_id, name, permissions = None, file_security = Non params['encryption'] = encryption params['antivirus'] = antivirus - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -96,7 +96,7 @@ def delete_bucket(self, bucket_id): """Delete Bucket""" - path = '/storage/buckets/{bucketId}' + api_path = '/storage/buckets/{bucketId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -104,7 +104,7 @@ def delete_bucket(self, bucket_id): path = path.replace('{bucketId}', bucket_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -112,7 +112,7 @@ def list_files(self, bucket_id, queries = None, search = None): """List Files""" - path = '/storage/buckets/{bucketId}/files' + api_path = '/storage/buckets/{bucketId}/files' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -122,7 +122,7 @@ def list_files(self, bucket_id, queries = None, search = None): params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -130,7 +130,7 @@ def create_file(self, bucket_id, file_id, file, permissions = None, on_progress """Create File""" - path = '/storage/buckets/{bucketId}/files' + api_path = '/storage/buckets/{bucketId}/files' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -153,7 +153,7 @@ def create_file(self, bucket_id, file_id, file, permissions = None, on_progress upload_id = '' upload_id = file_id - return self.client.chunked_upload(path, { + return self.client.chunked_upload(api_path, { 'content-type': 'multipart/form-data', }, params, param_name, on_progress, upload_id) @@ -161,7 +161,7 @@ def get_file(self, bucket_id, file_id): """Get File""" - path = '/storage/buckets/{bucketId}/files/{fileId}' + api_path = '/storage/buckets/{bucketId}/files/{fileId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -173,15 +173,15 @@ def get_file(self, bucket_id, file_id): path = path.replace('{fileId}', file_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def update_file(self, bucket_id, file_id, permissions = None): + def update_file(self, bucket_id, file_id, name = None, permissions = None): """Update File""" - path = '/storage/buckets/{bucketId}/files/{fileId}' + api_path = '/storage/buckets/{bucketId}/files/{fileId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -192,9 +192,10 @@ def update_file(self, bucket_id, file_id, permissions = None): path = path.replace('{bucketId}', bucket_id) path = path.replace('{fileId}', file_id) + params['name'] = name params['permissions'] = permissions - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -202,7 +203,7 @@ def delete_file(self, bucket_id, file_id): """Delete File""" - path = '/storage/buckets/{bucketId}/files/{fileId}' + api_path = '/storage/buckets/{bucketId}/files/{fileId}' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -214,7 +215,7 @@ def delete_file(self, bucket_id, file_id): path = path.replace('{fileId}', file_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -222,7 +223,7 @@ def get_file_download(self, bucket_id, file_id): """Get File for Download""" - path = '/storage/buckets/{bucketId}/files/{fileId}/download' + api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -234,7 +235,7 @@ def get_file_download(self, bucket_id, file_id): path = path.replace('{fileId}', file_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -242,7 +243,7 @@ def get_file_preview(self, bucket_id, file_id, width = None, height = None, grav """Get File Preview""" - path = '/storage/buckets/{bucketId}/files/{fileId}/preview' + api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -265,7 +266,7 @@ def get_file_preview(self, bucket_id, file_id, width = None, height = None, grav params['background'] = background params['output'] = output - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -273,7 +274,7 @@ def get_file_view(self, bucket_id, file_id): """Get File for View""" - path = '/storage/buckets/{bucketId}/files/{fileId}/view' + api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' params = {} if bucket_id is None: raise AppwriteException('Missing required parameter: "bucket_id"') @@ -285,6 +286,6 @@ def get_file_view(self, bucket_id, file_id): path = path.replace('{fileId}', file_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 514fa51..ebc23ff 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -10,13 +10,13 @@ def list(self, queries = None, search = None): """List Teams""" - path = '/teams' + api_path = '/teams' params = {} params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -24,7 +24,7 @@ def create(self, team_id, name, roles = None): """Create Team""" - path = '/teams' + api_path = '/teams' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -37,7 +37,7 @@ def create(self, team_id, name, roles = None): params['name'] = name params['roles'] = roles - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -45,7 +45,7 @@ def get(self, team_id): """Get Team""" - path = '/teams/{teamId}' + api_path = '/teams/{teamId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -53,7 +53,7 @@ def get(self, team_id): path = path.replace('{teamId}', team_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -61,7 +61,7 @@ def update_name(self, team_id, name): """Update Name""" - path = '/teams/{teamId}' + api_path = '/teams/{teamId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -73,7 +73,7 @@ def update_name(self, team_id, name): params['name'] = name - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -81,7 +81,7 @@ def delete(self, team_id): """Delete Team""" - path = '/teams/{teamId}' + api_path = '/teams/{teamId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -89,7 +89,7 @@ def delete(self, team_id): path = path.replace('{teamId}', team_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -97,7 +97,7 @@ def list_memberships(self, team_id, queries = None, search = None): """List Team Memberships""" - path = '/teams/{teamId}/memberships' + api_path = '/teams/{teamId}/memberships' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -107,7 +107,7 @@ def list_memberships(self, team_id, queries = None, search = None): params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -115,7 +115,7 @@ def create_membership(self, team_id, roles, url, email = None, user_id = None, p """Create Team Membership""" - path = '/teams/{teamId}/memberships' + api_path = '/teams/{teamId}/memberships' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -135,7 +135,7 @@ def create_membership(self, team_id, roles, url, email = None, user_id = None, p params['url'] = url params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -143,7 +143,7 @@ def get_membership(self, team_id, membership_id): """Get Team Membership""" - path = '/teams/{teamId}/memberships/{membershipId}' + api_path = '/teams/{teamId}/memberships/{membershipId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -155,15 +155,15 @@ def get_membership(self, team_id, membership_id): path = path.replace('{membershipId}', membership_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) - def update_membership_roles(self, team_id, membership_id, roles): - """Update Membership Roles""" + def update_membership(self, team_id, membership_id, roles): + """Update Membership""" - path = '/teams/{teamId}/memberships/{membershipId}' + api_path = '/teams/{teamId}/memberships/{membershipId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -179,7 +179,7 @@ def update_membership_roles(self, team_id, membership_id, roles): params['roles'] = roles - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -187,7 +187,7 @@ def delete_membership(self, team_id, membership_id): """Delete Team Membership""" - path = '/teams/{teamId}/memberships/{membershipId}' + api_path = '/teams/{teamId}/memberships/{membershipId}' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -199,7 +199,7 @@ def delete_membership(self, team_id, membership_id): path = path.replace('{membershipId}', membership_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -207,7 +207,7 @@ def update_membership_status(self, team_id, membership_id, user_id, secret): """Update Team Membership Status""" - path = '/teams/{teamId}/memberships/{membershipId}/status' + api_path = '/teams/{teamId}/memberships/{membershipId}/status' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -227,7 +227,7 @@ def update_membership_status(self, team_id, membership_id, user_id, secret): params['userId'] = user_id params['secret'] = secret - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -235,7 +235,7 @@ def get_prefs(self, team_id): """Get Team Preferences""" - path = '/teams/{teamId}/prefs' + api_path = '/teams/{teamId}/prefs' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -243,7 +243,7 @@ def get_prefs(self, team_id): path = path.replace('{teamId}', team_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -251,7 +251,7 @@ def update_prefs(self, team_id, prefs): """Update Preferences""" - path = '/teams/{teamId}/prefs' + api_path = '/teams/{teamId}/prefs' params = {} if team_id is None: raise AppwriteException('Missing required parameter: "team_id"') @@ -263,6 +263,6 @@ def update_prefs(self, team_id, prefs): params['prefs'] = prefs - return self.client.call('put', path, { + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 1587955..ca8db1f 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -10,13 +10,13 @@ def list(self, queries = None, search = None): """List Users""" - path = '/users' + api_path = '/users' params = {} params['queries'] = queries params['search'] = search - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -24,7 +24,7 @@ def create(self, user_id, email = None, phone = None, password = None, name = No """Create User""" - path = '/users' + api_path = '/users' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -36,7 +36,7 @@ def create(self, user_id, email = None, phone = None, password = None, name = No params['password'] = password params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -44,7 +44,7 @@ def create_argon2_user(self, user_id, email, password, name = None): """Create User with Argon2 Password""" - path = '/users/argon2' + api_path = '/users/argon2' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -61,7 +61,7 @@ def create_argon2_user(self, user_id, email, password, name = None): params['password'] = password params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -69,7 +69,7 @@ def create_bcrypt_user(self, user_id, email, password, name = None): """Create User with Bcrypt Password""" - path = '/users/bcrypt' + api_path = '/users/bcrypt' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -86,7 +86,37 @@ def create_bcrypt_user(self, user_id, email, password, name = None): params['password'] = password params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, params) + + def list_identities(self, queries = None, search = None): + """List Identities""" + + + api_path = '/users/identities' + params = {} + + params['queries'] = queries + params['search'] = search + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, params) + + def delete_identity(self, identity_id): + """Delete Identity""" + + + api_path = '/users/identities/{identityId}' + params = {} + if identity_id is None: + raise AppwriteException('Missing required parameter: "identity_id"') + + path = path.replace('{identityId}', identity_id) + + + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -94,7 +124,7 @@ def create_md5_user(self, user_id, email, password, name = None): """Create User with MD5 Password""" - path = '/users/md5' + api_path = '/users/md5' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -111,7 +141,7 @@ def create_md5_user(self, user_id, email, password, name = None): params['password'] = password params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -119,7 +149,7 @@ def create_ph_pass_user(self, user_id, email, password, name = None): """Create User with PHPass Password""" - path = '/users/phpass' + api_path = '/users/phpass' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -136,7 +166,7 @@ def create_ph_pass_user(self, user_id, email, password, name = None): params['password'] = password params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -144,7 +174,7 @@ def create_scrypt_user(self, user_id, email, password, password_salt, password_c """Create User with Scrypt Password""" - path = '/users/scrypt' + api_path = '/users/scrypt' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -181,7 +211,7 @@ def create_scrypt_user(self, user_id, email, password, password_salt, password_c params['passwordLength'] = password_length params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -189,7 +219,7 @@ def create_scrypt_modified_user(self, user_id, email, password, password_salt, p """Create User with Scrypt Modified Password""" - path = '/users/scrypt-modified' + api_path = '/users/scrypt-modified' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -218,7 +248,7 @@ def create_scrypt_modified_user(self, user_id, email, password, password_salt, p params['passwordSignerKey'] = password_signer_key params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -226,7 +256,7 @@ def create_sha_user(self, user_id, email, password, password_version = None, nam """Create User with SHA Password""" - path = '/users/sha' + api_path = '/users/sha' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -244,7 +274,7 @@ def create_sha_user(self, user_id, email, password, password_version = None, nam params['passwordVersion'] = password_version params['name'] = name - return self.client.call('post', path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, params) @@ -252,7 +282,7 @@ def get(self, user_id): """Get User""" - path = '/users/{userId}' + api_path = '/users/{userId}' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -260,7 +290,7 @@ def get(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -268,7 +298,7 @@ def delete(self, user_id): """Delete User""" - path = '/users/{userId}' + api_path = '/users/{userId}' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -276,7 +306,7 @@ def delete(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -284,7 +314,7 @@ def update_email(self, user_id, email): """Update Email""" - path = '/users/{userId}/email' + api_path = '/users/{userId}/email' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -296,7 +326,27 @@ def update_email(self, user_id, email): params['email'] = email - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, params) + + def update_labels(self, user_id, labels): + """Update User Labels""" + + + api_path = '/users/{userId}/labels' + params = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + if labels is None: + raise AppwriteException('Missing required parameter: "labels"') + + path = path.replace('{userId}', user_id) + + params['labels'] = labels + + return self.client.call('put', api_path, { 'content-type': 'application/json', }, params) @@ -304,7 +354,7 @@ def list_logs(self, user_id, queries = None): """List User Logs""" - path = '/users/{userId}/logs' + api_path = '/users/{userId}/logs' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -313,7 +363,7 @@ def list_logs(self, user_id, queries = None): params['queries'] = queries - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -321,7 +371,7 @@ def list_memberships(self, user_id): """List User Memberships""" - path = '/users/{userId}/memberships' + api_path = '/users/{userId}/memberships' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -329,7 +379,7 @@ def list_memberships(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -337,7 +387,7 @@ def update_name(self, user_id, name): """Update Name""" - path = '/users/{userId}/name' + api_path = '/users/{userId}/name' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -349,7 +399,7 @@ def update_name(self, user_id, name): params['name'] = name - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -357,7 +407,7 @@ def update_password(self, user_id, password): """Update Password""" - path = '/users/{userId}/password' + api_path = '/users/{userId}/password' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -369,7 +419,7 @@ def update_password(self, user_id, password): params['password'] = password - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -377,7 +427,7 @@ def update_phone(self, user_id, number): """Update Phone""" - path = '/users/{userId}/phone' + api_path = '/users/{userId}/phone' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -389,7 +439,7 @@ def update_phone(self, user_id, number): params['number'] = number - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -397,7 +447,7 @@ def get_prefs(self, user_id): """Get User Preferences""" - path = '/users/{userId}/prefs' + api_path = '/users/{userId}/prefs' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -405,7 +455,7 @@ def get_prefs(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -413,7 +463,7 @@ def update_prefs(self, user_id, prefs): """Update User Preferences""" - path = '/users/{userId}/prefs' + api_path = '/users/{userId}/prefs' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -425,7 +475,7 @@ def update_prefs(self, user_id, prefs): params['prefs'] = prefs - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -433,7 +483,7 @@ def list_sessions(self, user_id): """List User Sessions""" - path = '/users/{userId}/sessions' + api_path = '/users/{userId}/sessions' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -441,7 +491,7 @@ def list_sessions(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('get', path, { + return self.client.call('get', api_path, { 'content-type': 'application/json', }, params) @@ -449,7 +499,7 @@ def delete_sessions(self, user_id): """Delete User Sessions""" - path = '/users/{userId}/sessions' + api_path = '/users/{userId}/sessions' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -457,7 +507,7 @@ def delete_sessions(self, user_id): path = path.replace('{userId}', user_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -465,7 +515,7 @@ def delete_session(self, user_id, session_id): """Delete User Session""" - path = '/users/{userId}/sessions/{sessionId}' + api_path = '/users/{userId}/sessions/{sessionId}' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -477,7 +527,7 @@ def delete_session(self, user_id, session_id): path = path.replace('{sessionId}', session_id) - return self.client.call('delete', path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, params) @@ -485,7 +535,7 @@ def update_status(self, user_id, status): """Update User Status""" - path = '/users/{userId}/status' + api_path = '/users/{userId}/status' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -497,7 +547,7 @@ def update_status(self, user_id, status): params['status'] = status - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -505,7 +555,7 @@ def update_email_verification(self, user_id, email_verification): """Update Email Verification""" - path = '/users/{userId}/verification' + api_path = '/users/{userId}/verification' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -517,7 +567,7 @@ def update_email_verification(self, user_id, email_verification): params['emailVerification'] = email_verification - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) @@ -525,7 +575,7 @@ def update_phone_verification(self, user_id, phone_verification): """Update Phone Verification""" - path = '/users/{userId}/verification/phone' + api_path = '/users/{userId}/verification/phone' params = {} if user_id is None: raise AppwriteException('Missing required parameter: "user_id"') @@ -537,6 +587,6 @@ def update_phone_verification(self, user_id, phone_verification): params['phoneVerification'] = phone_verification - return self.client.call('patch', path, { + return self.client.call('patch', api_path, { 'content-type': 'application/json', }, params) diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 0000000..bac4334 --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token +) + +account = Account(client) + +result = account.delete_identity('[IDENTITY_ID]') diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 0000000..3c166d1 --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') # Your secret JSON Web Token +) + +account = Account(client) + +result = account.list_identities() diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index d29c43f..1ee1be0 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -12,4 +12,4 @@ client = Client() functions = Functions(client) -result = functions.create_deployment('[FUNCTION_ID]', '[ENTRYPOINT]', InputFile.from_path('file.png'), False) +result = functions.create_deployment('[FUNCTION_ID]', InputFile.from_path('file.png'), False) diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md new file mode 100644 index 0000000..ee51f67 --- /dev/null +++ b/docs/examples/functions/download-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.download_deployment('[FUNCTION_ID]', '[DEPLOYMENT_ID]') diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 3960054..1da9008 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -11,4 +11,4 @@ client = Client() functions = Functions(client) -result = functions.update('[FUNCTION_ID]', '[NAME]') +result = functions.update('[FUNCTION_ID]', '[NAME]', 'node-14.5') diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 0000000..43ada69 --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_pub_sub() diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md new file mode 100644 index 0000000..5a35588 --- /dev/null +++ b/docs/examples/health/get-queue.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue() diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 0000000..3dc6cf8 --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.list_codes() diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 0000000..5c0f623 --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.project import Project + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +project = Project(client) + +result = project.create_variable('[KEY]', '[VALUE]') diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 0000000..6d32481 --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.project import Project + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +project = Project(client) + +result = project.delete_variable('[VARIABLE_ID]') diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 0000000..d99646a --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.project import Project + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +project = Project(client) + +result = project.get_variable('[VARIABLE_ID]') diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 0000000..d095053 --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.project import Project + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +project = Project(client) + +result = project.list_variables() diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 0000000..62f3bc3 --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.project import Project + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +project = Project(client) + +result = project.update_variable('[VARIABLE_ID]', '[KEY]') diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md new file mode 100644 index 0000000..e7bfc57 --- /dev/null +++ b/docs/examples/proxy/create-rule.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.proxy import Proxy + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +proxy = Proxy(client) + +result = proxy.create_rule('', 'api') diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 0000000..cc4820f --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.proxy import Proxy + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +proxy = Proxy(client) + +result = proxy.delete_rule('[RULE_ID]') diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 0000000..81eedaa --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.proxy import Proxy + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +proxy = Proxy(client) + +result = proxy.get_rule('[RULE_ID]') diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 0000000..5e710f3 --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.proxy import Proxy + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +proxy = Proxy(client) + +result = proxy.list_rules() diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md new file mode 100644 index 0000000..0abf226 --- /dev/null +++ b/docs/examples/proxy/update-rule-verification.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.proxy import Proxy + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +proxy = Proxy(client) + +result = proxy.update_rule_verification('[RULE_ID]') diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership.md similarity index 80% rename from docs/examples/teams/update-membership-roles.md rename to docs/examples/teams/update-membership.md index dcfd7a4..816c6ad 100644 --- a/docs/examples/teams/update-membership-roles.md +++ b/docs/examples/teams/update-membership.md @@ -11,4 +11,4 @@ client = Client() teams = Teams(client) -result = teams.update_membership_roles('[TEAM_ID]', '[MEMBERSHIP_ID]', []) +result = teams.update_membership('[TEAM_ID]', '[MEMBERSHIP_ID]', []) diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 0000000..d103824 --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_identity('[IDENTITY_ID]') diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 0000000..0addd3e --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.list_identities() diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 0000000..b2d4c2d --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.update_labels('[USER_ID]', []) diff --git a/requirements.txt b/requirements.txt index 077c95d..2c24336 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -requests==2.31.0 \ No newline at end of file +requests==2.31.0 diff --git a/setup.py b/setup.py index 67f7899..c4b8184 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = ['appwrite', 'appwrite/services'], - version = '2.0.2', + version = '3.0.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, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/2.0.2.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/3.0.0.tar.gz', # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], install_requires=[ 'requests', From 6e858aa2c9cc9120e94e676e9b57a3d0870fb721 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 30 Aug 2023 13:27:03 +0200 Subject: [PATCH 2/2] feat: release 1.4.x --- appwrite/services/project.py | 91 ------------------- appwrite/services/proxy.py | 90 ------------------ docs/examples/project/create-variable.md | 14 --- docs/examples/project/delete-variable.md | 14 --- docs/examples/project/get-variable.md | 14 --- docs/examples/project/list-variables.md | 14 --- docs/examples/project/update-variable.md | 14 --- docs/examples/proxy/create-rule.md | 14 --- docs/examples/proxy/delete-rule.md | 14 --- docs/examples/proxy/get-rule.md | 14 --- docs/examples/proxy/list-rules.md | 14 --- .../proxy/update-rule-verification.md | 14 --- 12 files changed, 321 deletions(-) delete mode 100644 appwrite/services/project.py delete mode 100644 appwrite/services/proxy.py delete mode 100644 docs/examples/project/create-variable.md delete mode 100644 docs/examples/project/delete-variable.md delete mode 100644 docs/examples/project/get-variable.md delete mode 100644 docs/examples/project/list-variables.md delete mode 100644 docs/examples/project/update-variable.md delete mode 100644 docs/examples/proxy/create-rule.md delete mode 100644 docs/examples/proxy/delete-rule.md delete mode 100644 docs/examples/proxy/get-rule.md delete mode 100644 docs/examples/proxy/list-rules.md delete mode 100644 docs/examples/proxy/update-rule-verification.md diff --git a/appwrite/services/project.py b/appwrite/services/project.py deleted file mode 100644 index 57d44f7..0000000 --- a/appwrite/services/project.py +++ /dev/null @@ -1,91 +0,0 @@ -from ..service import Service -from ..exception import AppwriteException - -class Project(Service): - - def __init__(self, client): - super(Project, self).__init__(client) - - def list_variables(self): - """List Variables""" - - - api_path = '/project/variables' - params = {} - - return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, params) - - def create_variable(self, key, value): - """Create Variable""" - - - api_path = '/project/variables' - params = {} - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if value is None: - raise AppwriteException('Missing required parameter: "value"') - - - params['key'] = key - params['value'] = value - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, params) - - def get_variable(self, variable_id): - """Get Variable""" - - - api_path = '/project/variables/{variableId}' - params = {} - if variable_id is None: - raise AppwriteException('Missing required parameter: "variable_id"') - - path = path.replace('{variableId}', variable_id) - - - return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, params) - - def update_variable(self, variable_id, key, value = None): - """Update Variable""" - - - api_path = '/project/variables/{variableId}' - params = {} - if variable_id is None: - raise AppwriteException('Missing required parameter: "variable_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - path = path.replace('{variableId}', variable_id) - - params['key'] = key - params['value'] = value - - return self.client.call('put', api_path, { - 'content-type': 'application/json', - }, params) - - def delete_variable(self, variable_id): - """Delete Variable""" - - - api_path = '/project/variables/{variableId}' - params = {} - if variable_id is None: - raise AppwriteException('Missing required parameter: "variable_id"') - - path = path.replace('{variableId}', variable_id) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, params) diff --git a/appwrite/services/proxy.py b/appwrite/services/proxy.py deleted file mode 100644 index 9f41fce..0000000 --- a/appwrite/services/proxy.py +++ /dev/null @@ -1,90 +0,0 @@ -from ..service import Service -from ..exception import AppwriteException - -class Proxy(Service): - - def __init__(self, client): - super(Proxy, self).__init__(client) - - def list_rules(self, queries = None, search = None): - """List Rules""" - - - api_path = '/proxy/rules' - params = {} - - params['queries'] = queries - params['search'] = search - - return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, params) - - def create_rule(self, domain, resource_type, resource_id = None): - """Create Rule""" - - - api_path = '/proxy/rules' - params = {} - if domain is None: - raise AppwriteException('Missing required parameter: "domain"') - - if resource_type is None: - raise AppwriteException('Missing required parameter: "resource_type"') - - - params['domain'] = domain - params['resourceType'] = resource_type - params['resourceId'] = resource_id - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, params) - - def get_rule(self, rule_id): - """Get Rule""" - - - api_path = '/proxy/rules/{ruleId}' - params = {} - if rule_id is None: - raise AppwriteException('Missing required parameter: "rule_id"') - - path = path.replace('{ruleId}', rule_id) - - - return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, params) - - def delete_rule(self, rule_id): - """Delete Rule""" - - - api_path = '/proxy/rules/{ruleId}' - params = {} - if rule_id is None: - raise AppwriteException('Missing required parameter: "rule_id"') - - path = path.replace('{ruleId}', rule_id) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, params) - - def update_rule_verification(self, rule_id): - """Update Rule Verification Status""" - - - api_path = '/proxy/rules/{ruleId}/verification' - params = {} - if rule_id is None: - raise AppwriteException('Missing required parameter: "rule_id"') - - path = path.replace('{ruleId}', rule_id) - - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, params) diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md deleted file mode 100644 index 5c0f623..0000000 --- a/docs/examples/project/create-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.project import Project - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -project = Project(client) - -result = project.create_variable('[KEY]', '[VALUE]') diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md deleted file mode 100644 index 6d32481..0000000 --- a/docs/examples/project/delete-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.project import Project - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -project = Project(client) - -result = project.delete_variable('[VARIABLE_ID]') diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md deleted file mode 100644 index d99646a..0000000 --- a/docs/examples/project/get-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.project import Project - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -project = Project(client) - -result = project.get_variable('[VARIABLE_ID]') diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md deleted file mode 100644 index d095053..0000000 --- a/docs/examples/project/list-variables.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.project import Project - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -project = Project(client) - -result = project.list_variables() diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md deleted file mode 100644 index 62f3bc3..0000000 --- a/docs/examples/project/update-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.project import Project - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -project = Project(client) - -result = project.update_variable('[VARIABLE_ID]', '[KEY]') diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md deleted file mode 100644 index e7bfc57..0000000 --- a/docs/examples/proxy/create-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.proxy import Proxy - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -proxy = Proxy(client) - -result = proxy.create_rule('', 'api') diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md deleted file mode 100644 index cc4820f..0000000 --- a/docs/examples/proxy/delete-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.proxy import Proxy - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -proxy = Proxy(client) - -result = proxy.delete_rule('[RULE_ID]') diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md deleted file mode 100644 index 81eedaa..0000000 --- a/docs/examples/proxy/get-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.proxy import Proxy - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -proxy = Proxy(client) - -result = proxy.get_rule('[RULE_ID]') diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md deleted file mode 100644 index 5e710f3..0000000 --- a/docs/examples/proxy/list-rules.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.proxy import Proxy - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -proxy = Proxy(client) - -result = proxy.list_rules() diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md deleted file mode 100644 index 0abf226..0000000 --- a/docs/examples/proxy/update-rule-verification.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.proxy import Proxy - -client = Client() - -(client - .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint - .set_project('5df5acd0d48c2') # Your project ID - .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key -) - -proxy = Proxy(client) - -result = proxy.update_rule_verification('[RULE_ID]')