From fdbd19f9940e828f9eba78269ef32adb48a00289 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 10 Mar 2025 10:27:51 +0000 Subject: [PATCH 1/2] feat: add types to parameters --- appwrite/client.py | 8 +- appwrite/enums/credit_card.py | 1 + appwrite/enums/name.py | 5 +- appwrite/services/account.py | 151 ++++---------- appwrite/services/avatars.py | 31 +-- appwrite/services/databases.py | 183 +++++------------ appwrite/services/functions.py | 95 +++------ appwrite/services/graphql.py | 8 +- appwrite/services/health.py | 99 +++------- appwrite/services/locale.py | 16 -- appwrite/services/messaging.py | 186 +++++------------- appwrite/services/storage.py | 56 ++---- appwrite/services/teams.py | 52 ++--- appwrite/services/users.py | 171 +++++----------- .../databases/update-float-attribute.md | 4 +- .../databases/update-integer-attribute.md | 4 +- ...e-dump.md => get-queue-stats-resources.md} | 2 +- ...queue.md => get-queue-stats-usage-dump.md} | 4 +- setup.py | 4 +- 19 files changed, 285 insertions(+), 795 deletions(-) rename docs/examples/health/{get-queue-usage-dump.md => get-queue-stats-resources.md} (88%) rename docs/examples/health/{get-queue.md => get-queue-stats-usage-dump.md} (79%) diff --git a/appwrite/client.py b/appwrite/client.py index be73fb8..cd37ff9 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -13,11 +13,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : 'AppwritePythonSDK/8.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/9.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': '8.0.0', + 'x-sdk-version': '9.0.0', 'X-Appwrite-Response-Format' : '1.6.0', } @@ -131,9 +131,9 @@ def call(self, method, path='', headers=None, params=None, response_type='json') if response != None: content_type = response.headers['Content-Type'] if content_type.startswith('application/json'): - raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json()) + raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.text) else: - raise AppwriteException(response.text, response.status_code) + raise AppwriteException(response.text, response.status_code, None, response.text) else: raise AppwriteException(e) diff --git a/appwrite/enums/credit_card.py b/appwrite/enums/credit_card.py index 097ea64..3f770a3 100644 --- a/appwrite/enums/credit_card.py +++ b/appwrite/enums/credit_card.py @@ -17,3 +17,4 @@ class CreditCard(Enum): VISA = "visa" MIR = "mir" MAESTRO = "maestro" + RUPAY = "rupay" diff --git a/appwrite/enums/name.py b/appwrite/enums/name.py index c5ad74e..0ac227e 100644 --- a/appwrite/enums/name.py +++ b/appwrite/enums/name.py @@ -6,8 +6,9 @@ class Name(Enum): V1_AUDITS = "v1-audits" V1_MAILS = "v1-mails" V1_FUNCTIONS = "v1-functions" - V1_USAGE = "v1-usage" - V1_USAGE_DUMP = "v1-usage-dump" + V1_STATS_RESOURCES = "v1-stats-resources" + V1_STATS_USAGE = "v1-stats-usage" + V1_STATS_USAGE_DUMP = "v1-stats-usage-dump" V1_WEBHOOKS = "v1-webhooks" V1_CERTIFICATES = "v1-certificates" V1_BUILDS = "v1-builds" diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 10255b2..61f1f60 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1,5 +1,8 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.authenticator_type import AuthenticatorType; +from ..enums.authentication_factor import AuthenticationFactor; +from ..enums.o_auth_provider import OAuthProvider; class Account(Service): @@ -7,9 +10,7 @@ def __init__(self, client): super(Account, self).__init__(client) def get(self): - """Get account""" - api_path = '/account' api_params = {} @@ -17,10 +18,8 @@ def get(self): 'content-type': 'application/json', }, api_params) - def create(self, user_id, email, password, name = None): - """Create account""" + def create(self, user_id: str, email: str, password: str, name: str = None): - api_path = '/account' api_params = {} if user_id is None: @@ -42,10 +41,8 @@ def create(self, user_id, email, password, name = None): 'content-type': 'application/json', }, api_params) - def update_email(self, email, password): - """Update email""" + def update_email(self, email: str, password: str): - api_path = '/account/email' api_params = {} if email is None: @@ -62,10 +59,8 @@ def update_email(self, email, password): 'content-type': 'application/json', }, api_params) - def list_identities(self, queries = None): - """List identities""" + def list_identities(self, queries: list = None): - api_path = '/account/identities' api_params = {} @@ -75,10 +70,8 @@ def list_identities(self, queries = None): 'content-type': 'application/json', }, api_params) - def delete_identity(self, identity_id): - """Delete identity""" + def delete_identity(self, identity_id: str): - api_path = '/account/identities/{identityId}' api_params = {} if identity_id is None: @@ -92,9 +85,7 @@ def delete_identity(self, identity_id): }, api_params) def create_jwt(self): - """Create JWT""" - api_path = '/account/jwts' api_params = {} @@ -102,10 +93,8 @@ def create_jwt(self): 'content-type': 'application/json', }, api_params) - def list_logs(self, queries = None): - """List logs""" + def list_logs(self, queries: list = None): - api_path = '/account/logs' api_params = {} @@ -115,10 +104,8 @@ def list_logs(self, queries = None): 'content-type': 'application/json', }, api_params) - def update_mfa(self, mfa): - """Update MFA""" + def update_mfa(self, mfa: bool): - api_path = '/account/mfa' api_params = {} if mfa is None: @@ -131,10 +118,8 @@ def update_mfa(self, mfa): 'content-type': 'application/json', }, api_params) - def create_mfa_authenticator(self, type): - """Create authenticator""" + def create_mfa_authenticator(self, type: AuthenticatorType): - api_path = '/account/mfa/authenticators/{type}' api_params = {} if type is None: @@ -147,10 +132,8 @@ def create_mfa_authenticator(self, type): 'content-type': 'application/json', }, api_params) - def update_mfa_authenticator(self, type, otp): - """Verify authenticator""" + def update_mfa_authenticator(self, type: AuthenticatorType, otp: str): - api_path = '/account/mfa/authenticators/{type}' api_params = {} if type is None: @@ -167,10 +150,8 @@ def update_mfa_authenticator(self, type, otp): 'content-type': 'application/json', }, api_params) - def delete_mfa_authenticator(self, type): - """Delete authenticator""" + def delete_mfa_authenticator(self, type: AuthenticatorType): - api_path = '/account/mfa/authenticators/{type}' api_params = {} if type is None: @@ -183,10 +164,8 @@ def delete_mfa_authenticator(self, type): 'content-type': 'application/json', }, api_params) - def create_mfa_challenge(self, factor): - """Create MFA challenge""" + def create_mfa_challenge(self, factor: AuthenticationFactor): - api_path = '/account/mfa/challenge' api_params = {} if factor is None: @@ -199,10 +178,8 @@ def create_mfa_challenge(self, factor): 'content-type': 'application/json', }, api_params) - def update_mfa_challenge(self, challenge_id, otp): - """Create MFA challenge (confirmation)""" + def update_mfa_challenge(self, challenge_id: str, otp: str): - api_path = '/account/mfa/challenge' api_params = {} if challenge_id is None: @@ -220,9 +197,7 @@ def update_mfa_challenge(self, challenge_id, otp): }, api_params) def list_mfa_factors(self): - """List factors""" - api_path = '/account/mfa/factors' api_params = {} @@ -231,9 +206,7 @@ def list_mfa_factors(self): }, api_params) def get_mfa_recovery_codes(self): - """Get MFA recovery codes""" - api_path = '/account/mfa/recovery-codes' api_params = {} @@ -242,9 +215,7 @@ def get_mfa_recovery_codes(self): }, api_params) def create_mfa_recovery_codes(self): - """Create MFA recovery codes""" - api_path = '/account/mfa/recovery-codes' api_params = {} @@ -253,9 +224,7 @@ def create_mfa_recovery_codes(self): }, api_params) def update_mfa_recovery_codes(self): - """Regenerate MFA recovery codes""" - api_path = '/account/mfa/recovery-codes' api_params = {} @@ -263,10 +232,8 @@ def update_mfa_recovery_codes(self): 'content-type': 'application/json', }, api_params) - def update_name(self, name): - """Update name""" + def update_name(self, name: str): - api_path = '/account/name' api_params = {} if name is None: @@ -279,10 +246,8 @@ def update_name(self, name): 'content-type': 'application/json', }, api_params) - def update_password(self, password, old_password = None): - """Update password""" + def update_password(self, password: str, old_password: str = None): - api_path = '/account/password' api_params = {} if password is None: @@ -296,10 +261,8 @@ def update_password(self, password, old_password = None): 'content-type': 'application/json', }, api_params) - def update_phone(self, phone, password): - """Update phone""" + def update_phone(self, phone: str, password: str): - api_path = '/account/phone' api_params = {} if phone is None: @@ -317,9 +280,7 @@ def update_phone(self, phone, password): }, api_params) def get_prefs(self): - """Get account preferences""" - api_path = '/account/prefs' api_params = {} @@ -327,10 +288,8 @@ def get_prefs(self): 'content-type': 'application/json', }, api_params) - def update_prefs(self, prefs): - """Update preferences""" + def update_prefs(self, prefs: dict): - api_path = '/account/prefs' api_params = {} if prefs is None: @@ -343,10 +302,8 @@ def update_prefs(self, prefs): 'content-type': 'application/json', }, api_params) - def create_recovery(self, email, url): - """Create password recovery""" + def create_recovery(self, email: str, url: str): - api_path = '/account/recovery' api_params = {} if email is None: @@ -363,10 +320,8 @@ def create_recovery(self, email, url): 'content-type': 'application/json', }, api_params) - def update_recovery(self, user_id, secret, password): - """Create password recovery (confirmation)""" + def update_recovery(self, user_id: str, secret: str, password: str): - api_path = '/account/recovery' api_params = {} if user_id is None: @@ -388,9 +343,7 @@ def update_recovery(self, user_id, secret, password): }, api_params) def list_sessions(self): - """List sessions""" - api_path = '/account/sessions' api_params = {} @@ -399,9 +352,7 @@ def list_sessions(self): }, api_params) def delete_sessions(self): - """Delete sessions""" - api_path = '/account/sessions' api_params = {} @@ -410,9 +361,7 @@ def delete_sessions(self): }, api_params) def create_anonymous_session(self): - """Create anonymous session""" - api_path = '/account/sessions/anonymous' api_params = {} @@ -420,10 +369,8 @@ def create_anonymous_session(self): 'content-type': 'application/json', }, api_params) - def create_email_password_session(self, email, password): - """Create email password session""" + def create_email_password_session(self, email: str, password: str): - api_path = '/account/sessions/email' api_params = {} if email is None: @@ -440,10 +387,8 @@ def create_email_password_session(self, email, password): 'content-type': 'application/json', }, api_params) - def update_magic_url_session(self, user_id, secret): - """Update magic URL session""" + def update_magic_url_session(self, user_id: str, secret: str): - api_path = '/account/sessions/magic-url' api_params = {} if user_id is None: @@ -460,10 +405,8 @@ def update_magic_url_session(self, user_id, secret): 'content-type': 'application/json', }, api_params) - def update_phone_session(self, user_id, secret): - """Update phone session""" + def update_phone_session(self, user_id: str, secret: str): - api_path = '/account/sessions/phone' api_params = {} if user_id is None: @@ -480,10 +423,8 @@ def update_phone_session(self, user_id, secret): 'content-type': 'application/json', }, api_params) - def create_session(self, user_id, secret): - """Create session""" + def create_session(self, user_id: str, secret: str): - api_path = '/account/sessions/token' api_params = {} if user_id is None: @@ -500,10 +441,8 @@ def create_session(self, user_id, secret): 'content-type': 'application/json', }, api_params) - def get_session(self, session_id): - """Get session""" + def get_session(self, session_id: str): - api_path = '/account/sessions/{sessionId}' api_params = {} if session_id is None: @@ -516,10 +455,8 @@ def get_session(self, session_id): 'content-type': 'application/json', }, api_params) - def update_session(self, session_id): - """Update session""" + def update_session(self, session_id: str): - api_path = '/account/sessions/{sessionId}' api_params = {} if session_id is None: @@ -532,10 +469,8 @@ def update_session(self, session_id): 'content-type': 'application/json', }, api_params) - def delete_session(self, session_id): - """Delete session""" + def delete_session(self, session_id: str): - api_path = '/account/sessions/{sessionId}' api_params = {} if session_id is None: @@ -549,9 +484,7 @@ def delete_session(self, session_id): }, api_params) def update_status(self): - """Update status""" - api_path = '/account/status' api_params = {} @@ -559,10 +492,8 @@ def update_status(self): 'content-type': 'application/json', }, api_params) - def create_email_token(self, user_id, email, phrase = None): - """Create email token (OTP)""" + def create_email_token(self, user_id: str, email: str, phrase: bool = None): - api_path = '/account/tokens/email' api_params = {} if user_id is None: @@ -580,10 +511,8 @@ def create_email_token(self, user_id, email, phrase = None): 'content-type': 'application/json', }, api_params) - def create_magic_url_token(self, user_id, email, url = None, phrase = None): - """Create magic URL token""" + def create_magic_url_token(self, user_id: str, email: str, url: str = None, phrase: bool = None): - api_path = '/account/tokens/magic-url' api_params = {} if user_id is None: @@ -602,10 +531,8 @@ def create_magic_url_token(self, user_id, email, url = None, phrase = None): 'content-type': 'application/json', }, api_params) - def create_o_auth2_token(self, provider, success = None, failure = None, scopes = None): - """Create OAuth2 token""" + def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list = None): - api_path = '/account/tokens/oauth2/{provider}' api_params = {} if provider is None: @@ -621,10 +548,8 @@ def create_o_auth2_token(self, provider, success = None, failure = None, scopes 'content-type': 'application/json', }, api_params, response_type='location') - def create_phone_token(self, user_id, phone): - """Create phone token""" + def create_phone_token(self, user_id: str, phone: str): - api_path = '/account/tokens/phone' api_params = {} if user_id is None: @@ -641,10 +566,8 @@ def create_phone_token(self, user_id, phone): 'content-type': 'application/json', }, api_params) - def create_verification(self, url): - """Create email verification""" + def create_verification(self, url: str): - api_path = '/account/verification' api_params = {} if url is None: @@ -657,10 +580,8 @@ def create_verification(self, url): 'content-type': 'application/json', }, api_params) - def update_verification(self, user_id, secret): - """Create email verification (confirmation)""" + def update_verification(self, user_id: str, secret: str): - api_path = '/account/verification' api_params = {} if user_id is None: @@ -678,9 +599,7 @@ def update_verification(self, user_id, secret): }, api_params) def create_phone_verification(self): - """Create phone verification""" - api_path = '/account/verification/phone' api_params = {} @@ -688,10 +607,8 @@ def create_phone_verification(self): 'content-type': 'application/json', }, api_params) - def update_phone_verification(self, user_id, secret): - """Update phone verification (confirmation)""" + def update_phone_verification(self, user_id: str, secret: str): - api_path = '/account/verification/phone' api_params = {} if user_id is None: diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 0a9b400..e4752a6 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -1,15 +1,16 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.browser import Browser; +from ..enums.credit_card import CreditCard; +from ..enums.flag import Flag; class Avatars(Service): def __init__(self, client): super(Avatars, self).__init__(client) - def get_browser(self, code, width = None, height = None, quality = None): - """Get browser icon""" + def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None): - api_path = '/avatars/browsers/{code}' api_params = {} if code is None: @@ -25,10 +26,8 @@ def get_browser(self, code, width = None, height = None, quality = None): 'content-type': 'application/json', }, api_params) - def get_credit_card(self, code, width = None, height = None, quality = None): - """Get credit card icon""" + def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None): - api_path = '/avatars/credit-cards/{code}' api_params = {} if code is None: @@ -44,10 +43,8 @@ def get_credit_card(self, code, width = None, height = None, quality = None): 'content-type': 'application/json', }, api_params) - def get_favicon(self, url): - """Get favicon""" + def get_favicon(self, url: str): - api_path = '/avatars/favicon' api_params = {} if url is None: @@ -60,10 +57,8 @@ def get_favicon(self, url): 'content-type': 'application/json', }, api_params) - def get_flag(self, code, width = None, height = None, quality = None): - """Get country flag""" + def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None): - api_path = '/avatars/flags/{code}' api_params = {} if code is None: @@ -79,10 +74,8 @@ def get_flag(self, code, width = None, height = None, quality = None): 'content-type': 'application/json', }, api_params) - def get_image(self, url, width = None, height = None): - """Get image from URL""" + def get_image(self, url: str, width: float = None, height: float = None): - api_path = '/avatars/image' api_params = {} if url is None: @@ -97,10 +90,8 @@ def get_image(self, url, width = None, height = None): 'content-type': 'application/json', }, api_params) - def get_initials(self, name = None, width = None, height = None, background = None): - """Get user initials""" + def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None): - api_path = '/avatars/initials' api_params = {} @@ -113,10 +104,8 @@ def get_initials(self, name = None, width = None, height = None, background = No 'content-type': 'application/json', }, api_params) - def get_qr(self, text, size = None, margin = None, download = None): - """Get QR code""" + def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None): - api_path = '/avatars/qr' api_params = {} if text is None: diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index aa47e4e..85b2e86 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,15 +1,16 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.relationship_type import RelationshipType; +from ..enums.relation_mutate import RelationMutate; +from ..enums.index_type import IndexType; class Databases(Service): def __init__(self, client): super(Databases, self).__init__(client) - def list(self, queries = None, search = None): - """List databases""" + def list(self, queries: list = None, search: str = None): - api_path = '/databases' api_params = {} @@ -20,10 +21,8 @@ def list(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create(self, database_id, name, enabled = None): - """Create database""" + def create(self, database_id: str, name: str, enabled: bool = None): - api_path = '/databases' api_params = {} if database_id is None: @@ -41,10 +40,8 @@ def create(self, database_id, name, enabled = None): 'content-type': 'application/json', }, api_params) - def get(self, database_id): - """Get database""" + def get(self, database_id: str): - api_path = '/databases/{databaseId}' api_params = {} if database_id is None: @@ -57,10 +54,8 @@ def get(self, database_id): 'content-type': 'application/json', }, api_params) - def update(self, database_id, name, enabled = None): - """Update database""" + def update(self, database_id: str, name: str, enabled: bool = None): - api_path = '/databases/{databaseId}' api_params = {} if database_id is None: @@ -78,10 +73,8 @@ def update(self, database_id, name, enabled = None): 'content-type': 'application/json', }, api_params) - def delete(self, database_id): - """Delete database""" + def delete(self, database_id: str): - api_path = '/databases/{databaseId}' api_params = {} if database_id is None: @@ -94,10 +87,8 @@ def delete(self, database_id): 'content-type': 'application/json', }, api_params) - def list_collections(self, database_id, queries = None, search = None): - """List collections""" + def list_collections(self, database_id: str, queries: list = None, search: str = None): - api_path = '/databases/{databaseId}/collections' api_params = {} if database_id is None: @@ -112,10 +103,8 @@ def list_collections(self, database_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_collection(self, database_id, collection_id, name, permissions = None, document_security = None, enabled = None): - """Create collection""" + def create_collection(self, database_id: str, collection_id: str, name: str, permissions: list = None, document_security: bool = None, enabled: bool = None): - api_path = '/databases/{databaseId}/collections' api_params = {} if database_id is None: @@ -139,10 +128,8 @@ def create_collection(self, database_id, collection_id, name, permissions = None 'content-type': 'application/json', }, api_params) - def get_collection(self, database_id, collection_id): - """Get collection""" + def get_collection(self, database_id: str, collection_id: str): - api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} if database_id is None: @@ -159,10 +146,8 @@ def get_collection(self, database_id, collection_id): 'content-type': 'application/json', }, api_params) - def update_collection(self, database_id, collection_id, name, permissions = None, document_security = None, enabled = None): - """Update collection""" + def update_collection(self, database_id: str, collection_id: str, name: str, permissions: list = None, document_security: bool = None, enabled: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} if database_id is None: @@ -186,10 +171,8 @@ def update_collection(self, database_id, collection_id, name, permissions = None 'content-type': 'application/json', }, api_params) - def delete_collection(self, database_id, collection_id): - """Delete collection""" + def delete_collection(self, database_id: str, collection_id: str): - api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} if database_id is None: @@ -206,10 +189,8 @@ def delete_collection(self, database_id, collection_id): 'content-type': 'application/json', }, api_params) - def list_attributes(self, database_id, collection_id, queries = None): - """List attributes""" + def list_attributes(self, database_id: str, collection_id: str, queries: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' api_params = {} if database_id is None: @@ -227,10 +208,8 @@ def list_attributes(self, database_id, collection_id, queries = None): 'content-type': 'application/json', }, api_params) - def create_boolean_attribute(self, database_id, collection_id, key, required, default = None, array = None): - """Create boolean attribute""" + def create_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' api_params = {} if database_id is None: @@ -257,10 +236,8 @@ def create_boolean_attribute(self, database_id, collection_id, key, required, de 'content-type': 'application/json', }, api_params) - def update_boolean_attribute(self, database_id, collection_id, key, required, default, new_key = None): - """Update boolean attribute""" + def update_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' api_params = {} if database_id is None: @@ -287,10 +264,8 @@ def update_boolean_attribute(self, database_id, collection_id, key, required, de 'content-type': 'application/json', }, api_params) - def create_datetime_attribute(self, database_id, collection_id, key, required, default = None, array = None): - """Create datetime attribute""" + def create_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' api_params = {} if database_id is None: @@ -317,10 +292,8 @@ def create_datetime_attribute(self, database_id, collection_id, key, required, d 'content-type': 'application/json', }, api_params) - def update_datetime_attribute(self, database_id, collection_id, key, required, default, new_key = None): - """Update dateTime attribute""" + def update_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' api_params = {} if database_id is None: @@ -347,10 +320,8 @@ def update_datetime_attribute(self, database_id, collection_id, key, required, d 'content-type': 'application/json', }, api_params) - def create_email_attribute(self, database_id, collection_id, key, required, default = None, array = None): - """Create email attribute""" + def create_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' api_params = {} if database_id is None: @@ -377,10 +348,8 @@ def create_email_attribute(self, database_id, collection_id, key, required, defa 'content-type': 'application/json', }, api_params) - def update_email_attribute(self, database_id, collection_id, key, required, default, new_key = None): - """Update email attribute""" + def update_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' api_params = {} if database_id is None: @@ -407,10 +376,8 @@ def update_email_attribute(self, database_id, collection_id, key, required, defa 'content-type': 'application/json', }, api_params) - def create_enum_attribute(self, database_id, collection_id, key, elements, required, default = None, array = None): - """Create enum attribute""" + def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list, required: bool, default: str = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' api_params = {} if database_id is None: @@ -441,10 +408,8 @@ def create_enum_attribute(self, database_id, collection_id, key, elements, requi 'content-type': 'application/json', }, api_params) - def update_enum_attribute(self, database_id, collection_id, key, elements, required, default, new_key = None): - """Update enum attribute""" + def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list, required: bool, default: str, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' api_params = {} if database_id is None: @@ -475,10 +440,8 @@ def update_enum_attribute(self, database_id, collection_id, key, elements, requi 'content-type': 'application/json', }, api_params) - def create_float_attribute(self, database_id, collection_id, key, required, min = None, max = None, default = None, array = None): - """Create float attribute""" + def create_float_attribute(self, database_id: str, collection_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' api_params = {} if database_id is None: @@ -507,10 +470,8 @@ def create_float_attribute(self, database_id, collection_id, key, required, min 'content-type': 'application/json', }, api_params) - def update_float_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None): - """Update float attribute""" + def update_float_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' api_params = {} if database_id is None: @@ -525,12 +486,6 @@ def update_float_attribute(self, database_id, collection_id, key, required, min, if required is None: raise AppwriteException('Missing required parameter: "required"') - if min is None: - raise AppwriteException('Missing required parameter: "min"') - - if max is None: - raise AppwriteException('Missing required parameter: "max"') - api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{key}', key) @@ -545,10 +500,8 @@ def update_float_attribute(self, database_id, collection_id, key, required, min, 'content-type': 'application/json', }, api_params) - def create_integer_attribute(self, database_id, collection_id, key, required, min = None, max = None, default = None, array = None): - """Create integer attribute""" + def create_integer_attribute(self, database_id: str, collection_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' api_params = {} if database_id is None: @@ -577,10 +530,8 @@ def create_integer_attribute(self, database_id, collection_id, key, required, mi 'content-type': 'application/json', }, api_params) - def update_integer_attribute(self, database_id, collection_id, key, required, min, max, default, new_key = None): - """Update integer attribute""" + def update_integer_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' api_params = {} if database_id is None: @@ -595,12 +546,6 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi if required is None: raise AppwriteException('Missing required parameter: "required"') - if min is None: - raise AppwriteException('Missing required parameter: "min"') - - if max is None: - raise AppwriteException('Missing required parameter: "max"') - api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{key}', key) @@ -615,10 +560,8 @@ def update_integer_attribute(self, database_id, collection_id, key, required, mi 'content-type': 'application/json', }, api_params) - def create_ip_attribute(self, database_id, collection_id, key, required, default = None, array = None): - """Create IP address attribute""" + def create_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' api_params = {} if database_id is None: @@ -645,10 +588,8 @@ def create_ip_attribute(self, database_id, collection_id, key, required, default 'content-type': 'application/json', }, api_params) - def update_ip_attribute(self, database_id, collection_id, key, required, default, new_key = None): - """Update IP address attribute""" + def update_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' api_params = {} if database_id is None: @@ -675,10 +616,8 @@ def update_ip_attribute(self, database_id, collection_id, key, required, default 'content-type': 'application/json', }, api_params) - def create_relationship_attribute(self, database_id, collection_id, related_collection_id, type, two_way = None, key = None, two_way_key = None, on_delete = None): - """Create relationship attribute""" + def create_relationship_attribute(self, database_id: str, collection_id: str, related_collection_id: str, type: RelationshipType, two_way: bool = None, key: str = None, two_way_key: str = None, on_delete: RelationMutate = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' api_params = {} if database_id is None: @@ -707,10 +646,8 @@ def create_relationship_attribute(self, database_id, collection_id, related_coll 'content-type': 'application/json', }, api_params) - def create_string_attribute(self, database_id, collection_id, key, size, required, default = None, array = None, encrypt = None): - """Create string attribute""" + def create_string_attribute(self, database_id: str, collection_id: str, key: str, size: float, required: bool, default: str = None, array: bool = None, encrypt: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' api_params = {} if database_id is None: @@ -742,10 +679,8 @@ def create_string_attribute(self, database_id, collection_id, key, size, require 'content-type': 'application/json', }, api_params) - def update_string_attribute(self, database_id, collection_id, key, required, default, size = None, new_key = None): - """Update string attribute""" + def update_string_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, size: float = None, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' api_params = {} if database_id is None: @@ -773,10 +708,8 @@ def update_string_attribute(self, database_id, collection_id, key, required, def 'content-type': 'application/json', }, api_params) - def create_url_attribute(self, database_id, collection_id, key, required, default = None, array = None): - """Create URL attribute""" + def create_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' api_params = {} if database_id is None: @@ -803,10 +736,8 @@ def create_url_attribute(self, database_id, collection_id, key, required, defaul 'content-type': 'application/json', }, api_params) - def update_url_attribute(self, database_id, collection_id, key, required, default, new_key = None): - """Update URL attribute""" + def update_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' api_params = {} if database_id is None: @@ -833,10 +764,8 @@ def update_url_attribute(self, database_id, collection_id, key, required, defaul 'content-type': 'application/json', }, api_params) - def get_attribute(self, database_id, collection_id, key): - """Get attribute""" + def get_attribute(self, database_id: str, collection_id: str, key: str): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} if database_id is None: @@ -857,10 +786,8 @@ def get_attribute(self, database_id, collection_id, key): 'content-type': 'application/json', }, api_params) - def delete_attribute(self, database_id, collection_id, key): - """Delete attribute""" + def delete_attribute(self, database_id: str, collection_id: str, key: str): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} if database_id is None: @@ -881,10 +808,8 @@ def delete_attribute(self, database_id, collection_id, key): 'content-type': 'application/json', }, api_params) - def update_relationship_attribute(self, database_id, collection_id, key, on_delete = None, new_key = None): - """Update relationship attribute""" + def update_relationship_attribute(self, database_id: str, collection_id: str, key: str, on_delete: RelationMutate = None, new_key: str = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' api_params = {} if database_id is None: @@ -907,10 +832,8 @@ def update_relationship_attribute(self, database_id, collection_id, key, on_dele 'content-type': 'application/json', }, api_params) - def list_documents(self, database_id, collection_id, queries = None): - """List documents""" + def list_documents(self, database_id: str, collection_id: str, queries: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} if database_id is None: @@ -928,10 +851,8 @@ def list_documents(self, database_id, collection_id, queries = None): 'content-type': 'application/json', }, api_params) - def create_document(self, database_id, collection_id, document_id, data, permissions = None): - """Create document""" + def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} if database_id is None: @@ -957,10 +878,8 @@ def create_document(self, database_id, collection_id, document_id, data, permiss 'content-type': 'application/json', }, api_params) - def get_document(self, database_id, collection_id, document_id, queries = None): - """Get document""" + def get_document(self, database_id: str, collection_id: str, document_id: str, queries: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} if database_id is None: @@ -982,10 +901,8 @@ def get_document(self, database_id, collection_id, document_id, queries = None): 'content-type': 'application/json', }, api_params) - def update_document(self, database_id, collection_id, document_id, data = None, permissions = None): - """Update document""" + def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} if database_id is None: @@ -1008,10 +925,8 @@ def update_document(self, database_id, collection_id, document_id, data = None, 'content-type': 'application/json', }, api_params) - def delete_document(self, database_id, collection_id, document_id): - """Delete document""" + def delete_document(self, database_id: str, collection_id: str, document_id: str): - api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} if database_id is None: @@ -1032,10 +947,8 @@ def delete_document(self, database_id, collection_id, document_id): 'content-type': 'application/json', }, api_params) - def list_indexes(self, database_id, collection_id, queries = None): - """List indexes""" + def list_indexes(self, database_id: str, collection_id: str, queries: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} if database_id is None: @@ -1053,10 +966,8 @@ def list_indexes(self, database_id, collection_id, queries = None): 'content-type': 'application/json', }, api_params) - def create_index(self, database_id, collection_id, key, type, attributes, orders = None): - """Create index""" + def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: list, orders: list = None): - api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} if database_id is None: @@ -1086,10 +997,8 @@ def create_index(self, database_id, collection_id, key, type, attributes, orders 'content-type': 'application/json', }, api_params) - def get_index(self, database_id, collection_id, key): - """Get index""" + def get_index(self, database_id: str, collection_id: str, key: str): - api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} if database_id is None: @@ -1110,10 +1019,8 @@ def get_index(self, database_id, collection_id, key): 'content-type': 'application/json', }, api_params) - def delete_index(self, database_id, collection_id, key): - """Delete index""" + def delete_index(self, database_id: str, collection_id: str, key: str): - api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} if database_id is None: diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 34b13a9..326171c 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -1,15 +1,16 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.runtime import Runtime; +from ..input_file import InputFile +from ..enums.execution_method import ExecutionMethod; class Functions(Service): def __init__(self, client): super(Functions, self).__init__(client) - def list(self, queries = None, search = None): - """List functions""" + def list(self, queries: list = None, search: str = None): - api_path = '/functions' api_params = {} @@ -20,10 +21,8 @@ def list(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create(self, function_id, name, runtime, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, scopes = 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_version = None, specification = None): - """Create function""" + def create(self, function_id: str, name: str, runtime: Runtime, execute: list = None, events: list = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None): - api_path = '/functions' api_params = {} if function_id is None: @@ -64,9 +63,7 @@ def create(self, function_id, name, runtime, execute = None, events = None, sche }, api_params) def list_runtimes(self): - """List runtimes""" - api_path = '/functions/runtimes' api_params = {} @@ -75,9 +72,7 @@ def list_runtimes(self): }, api_params) def list_specifications(self): - """List available function runtime specifications""" - api_path = '/functions/specifications' api_params = {} @@ -85,10 +80,8 @@ def list_specifications(self): 'content-type': 'application/json', }, api_params) - def get(self, function_id): - """Get function""" + def get(self, function_id: str): - api_path = '/functions/{functionId}' api_params = {} if function_id is None: @@ -101,10 +94,8 @@ def get(self, function_id): 'content-type': 'application/json', }, api_params) - def update(self, function_id, name, runtime = None, execute = None, events = None, schedule = None, timeout = None, enabled = None, logging = None, entrypoint = None, commands = None, scopes = None, installation_id = None, provider_repository_id = None, provider_branch = None, provider_silent_mode = None, provider_root_directory = None, specification = None): - """Update function""" + def update(self, function_id: str, name: str, runtime: Runtime = None, execute: list = None, events: list = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None): - api_path = '/functions/{functionId}' api_params = {} if function_id is None: @@ -137,10 +128,8 @@ def update(self, function_id, name, runtime = None, execute = None, events = Non 'content-type': 'application/json', }, api_params) - def delete(self, function_id): - """Delete function""" + def delete(self, function_id: str): - api_path = '/functions/{functionId}' api_params = {} if function_id is None: @@ -153,10 +142,8 @@ def delete(self, function_id): 'content-type': 'application/json', }, api_params) - def list_deployments(self, function_id, queries = None, search = None): - """List deployments""" + def list_deployments(self, function_id: str, queries: list = None, search: str = None): - api_path = '/functions/{functionId}/deployments' api_params = {} if function_id is None: @@ -171,10 +158,8 @@ def list_deployments(self, function_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_deployment(self, function_id, code, activate, entrypoint = None, commands = None, on_progress = None): - """Create deployment""" + def create_deployment(self, function_id: str, code: InputFile, activate: bool, entrypoint: str = None, commands: str = None, on_progress = None): - api_path = '/functions/{functionId}/deployments' api_params = {} if function_id is None: @@ -202,10 +187,8 @@ def create_deployment(self, function_id, code, activate, entrypoint = None, comm 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) - def get_deployment(self, function_id, deployment_id): - """Get deployment""" + def get_deployment(self, function_id: str, deployment_id: str): - api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} if function_id is None: @@ -222,10 +205,8 @@ def get_deployment(self, function_id, deployment_id): 'content-type': 'application/json', }, api_params) - def update_deployment(self, function_id, deployment_id): - """Update deployment""" + def update_deployment(self, function_id: str, deployment_id: str): - api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} if function_id is None: @@ -242,10 +223,8 @@ def update_deployment(self, function_id, deployment_id): 'content-type': 'application/json', }, api_params) - def delete_deployment(self, function_id, deployment_id): - """Delete deployment""" + def delete_deployment(self, function_id: str, deployment_id: str): - api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} if function_id is None: @@ -262,10 +241,8 @@ def delete_deployment(self, function_id, deployment_id): 'content-type': 'application/json', }, api_params) - def create_build(self, function_id, deployment_id, build_id = None): - """Rebuild deployment""" + def create_build(self, function_id: str, deployment_id: str, build_id: str = None): - api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} if function_id is None: @@ -283,10 +260,8 @@ def create_build(self, function_id, deployment_id, build_id = None): 'content-type': 'application/json', }, api_params) - def update_deployment_build(self, function_id, deployment_id): - """Cancel deployment""" + def update_deployment_build(self, function_id: str, deployment_id: str): - api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} if function_id is None: @@ -303,10 +278,8 @@ def update_deployment_build(self, function_id, deployment_id): 'content-type': 'application/json', }, api_params) - def get_deployment_download(self, function_id, deployment_id): - """Download deployment""" + def get_deployment_download(self, function_id: str, deployment_id: str): - api_path = '/functions/{functionId}/deployments/{deploymentId}/download' api_params = {} if function_id is None: @@ -323,10 +296,8 @@ def get_deployment_download(self, function_id, deployment_id): 'content-type': 'application/json', }, api_params) - def list_executions(self, function_id, queries = None, search = None): - """List executions""" + def list_executions(self, function_id: str, queries: list = None, search: str = None): - api_path = '/functions/{functionId}/executions' api_params = {} if function_id is None: @@ -341,10 +312,8 @@ def list_executions(self, function_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_execution(self, function_id, body = None, xasync = None, path = None, method = None, headers = None, scheduled_at = None): - """Create execution""" + def create_execution(self, function_id: str, body: str = None, xasync: bool = None, path: str = None, method: ExecutionMethod = None, headers: dict = None, scheduled_at: str = None): - api_path = '/functions/{functionId}/executions' api_params = {} if function_id is None: @@ -363,10 +332,8 @@ def create_execution(self, function_id, body = None, xasync = None, path = None, 'content-type': 'application/json', }, api_params) - def get_execution(self, function_id, execution_id): - """Get execution""" + def get_execution(self, function_id: str, execution_id: str): - api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} if function_id is None: @@ -383,10 +350,8 @@ def get_execution(self, function_id, execution_id): 'content-type': 'application/json', }, api_params) - def delete_execution(self, function_id, execution_id): - """Delete execution""" + def delete_execution(self, function_id: str, execution_id: str): - api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} if function_id is None: @@ -403,10 +368,8 @@ def delete_execution(self, function_id, execution_id): 'content-type': 'application/json', }, api_params) - def list_variables(self, function_id): - """List variables""" + def list_variables(self, function_id: str): - api_path = '/functions/{functionId}/variables' api_params = {} if function_id is None: @@ -419,10 +382,8 @@ def list_variables(self, function_id): 'content-type': 'application/json', }, api_params) - def create_variable(self, function_id, key, value): - """Create variable""" + def create_variable(self, function_id: str, key: str, value: str): - api_path = '/functions/{functionId}/variables' api_params = {} if function_id is None: @@ -443,10 +404,8 @@ def create_variable(self, function_id, key, value): 'content-type': 'application/json', }, api_params) - def get_variable(self, function_id, variable_id): - """Get variable""" + def get_variable(self, function_id: str, variable_id: str): - api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} if function_id is None: @@ -463,10 +422,8 @@ def get_variable(self, function_id, variable_id): 'content-type': 'application/json', }, api_params) - def update_variable(self, function_id, variable_id, key, value = None): - """Update variable""" + def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None): - api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} if function_id is None: @@ -488,10 +445,8 @@ def update_variable(self, function_id, variable_id, key, value = None): 'content-type': 'application/json', }, api_params) - def delete_variable(self, function_id, variable_id): - """Delete variable""" + def delete_variable(self, function_id: str, variable_id: str): - api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} if function_id is None: diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 58a6e99..7d58b9e 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -6,10 +6,8 @@ class Graphql(Service): def __init__(self, client): super(Graphql, self).__init__(client) - def query(self, query): - """GraphQL endpoint""" + def query(self, query: dict): - api_path = '/graphql' api_params = {} if query is None: @@ -23,10 +21,8 @@ def query(self, query): 'content-type': 'application/json', }, api_params) - def mutation(self, query): - """GraphQL endpoint""" + def mutation(self, query: dict): - api_path = '/graphql/mutation' api_params = {} if query is None: diff --git a/appwrite/services/health.py b/appwrite/services/health.py index ef4b3cd..5be5d32 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -1,5 +1,6 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.name import Name; class Health(Service): @@ -7,9 +8,7 @@ def __init__(self, client): super(Health, self).__init__(client) def get(self): - """Get HTTP""" - api_path = '/health' api_params = {} @@ -18,9 +17,7 @@ def get(self): }, api_params) def get_antivirus(self): - """Get antivirus""" - api_path = '/health/anti-virus' api_params = {} @@ -29,9 +26,7 @@ def get_antivirus(self): }, api_params) def get_cache(self): - """Get cache""" - api_path = '/health/cache' api_params = {} @@ -39,10 +34,8 @@ def get_cache(self): 'content-type': 'application/json', }, api_params) - def get_certificate(self, domain = None): - """Get the SSL certificate for a domain""" + def get_certificate(self, domain: str = None): - api_path = '/health/certificate' api_params = {} @@ -53,9 +46,7 @@ def get_certificate(self, domain = None): }, api_params) def get_db(self): - """Get DB""" - api_path = '/health/db' api_params = {} @@ -64,9 +55,7 @@ def get_db(self): }, api_params) def get_pub_sub(self): - """Get pubsub""" - api_path = '/health/pubsub' api_params = {} @@ -74,21 +63,8 @@ def get_pub_sub(self): 'content-type': 'application/json', }, api_params) - def get_queue(self): - """Get queue""" + def get_queue_builds(self, threshold: float = None): - - api_path = '/health/queue' - api_params = {} - - return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_queue_builds(self, threshold = None): - """Get builds queue""" - - api_path = '/health/queue/builds' api_params = {} @@ -98,10 +74,8 @@ def get_queue_builds(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_certificates(self, threshold = None): - """Get certificates queue""" + def get_queue_certificates(self, threshold: float = None): - api_path = '/health/queue/certificates' api_params = {} @@ -111,10 +85,8 @@ def get_queue_certificates(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_databases(self, name = None, threshold = None): - """Get databases queue""" + def get_queue_databases(self, name: str = None, threshold: float = None): - api_path = '/health/queue/databases' api_params = {} @@ -125,10 +97,8 @@ def get_queue_databases(self, name = None, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_deletes(self, threshold = None): - """Get deletes queue""" + def get_queue_deletes(self, threshold: float = None): - api_path = '/health/queue/deletes' api_params = {} @@ -138,10 +108,8 @@ def get_queue_deletes(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_failed_jobs(self, name, threshold = None): - """Get number of failed queue jobs""" + def get_failed_jobs(self, name: Name, threshold: float = None): - api_path = '/health/queue/failed/{name}' api_params = {} if name is None: @@ -155,10 +123,8 @@ def get_failed_jobs(self, name, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_functions(self, threshold = None): - """Get functions queue""" + def get_queue_functions(self, threshold: float = None): - api_path = '/health/queue/functions' api_params = {} @@ -168,10 +134,8 @@ def get_queue_functions(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_logs(self, threshold = None): - """Get logs queue""" + def get_queue_logs(self, threshold: float = None): - api_path = '/health/queue/logs' api_params = {} @@ -181,10 +145,8 @@ def get_queue_logs(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_mails(self, threshold = None): - """Get mails queue""" + def get_queue_mails(self, threshold: float = None): - api_path = '/health/queue/mails' api_params = {} @@ -194,10 +156,8 @@ def get_queue_mails(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_messaging(self, threshold = None): - """Get messaging queue""" + def get_queue_messaging(self, threshold: float = None): - api_path = '/health/queue/messaging' api_params = {} @@ -207,10 +167,8 @@ def get_queue_messaging(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_migrations(self, threshold = None): - """Get migrations queue""" + def get_queue_migrations(self, threshold: float = None): - api_path = '/health/queue/migrations' api_params = {} @@ -220,11 +178,20 @@ def get_queue_migrations(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_usage(self, threshold = None): - """Get usage queue""" + def get_queue_stats_resources(self, threshold: float = None): + + api_path = '/health/queue/stats-resources' + api_params = {} + + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_queue_usage(self, threshold: float = None): - - api_path = '/health/queue/usage' + api_path = '/health/queue/stats-usage' api_params = {} api_params['threshold'] = threshold @@ -233,11 +200,9 @@ def get_queue_usage(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_usage_dump(self, threshold = None): - """Get usage dump queue""" + def get_queue_stats_usage_dump(self, threshold: float = None): - - api_path = '/health/queue/usage-dump' + api_path = '/health/queue/stats-usage-dump' api_params = {} api_params['threshold'] = threshold @@ -246,10 +211,8 @@ def get_queue_usage_dump(self, threshold = None): 'content-type': 'application/json', }, api_params) - def get_queue_webhooks(self, threshold = None): - """Get webhooks queue""" + def get_queue_webhooks(self, threshold: float = None): - api_path = '/health/queue/webhooks' api_params = {} @@ -260,9 +223,7 @@ def get_queue_webhooks(self, threshold = None): }, api_params) def get_storage(self): - """Get storage""" - api_path = '/health/storage' api_params = {} @@ -271,9 +232,7 @@ def get_storage(self): }, api_params) def get_storage_local(self): - """Get local storage""" - api_path = '/health/storage/local' api_params = {} @@ -282,9 +241,7 @@ def get_storage_local(self): }, api_params) def get_time(self): - """Get time""" - api_path = '/health/time' api_params = {} diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index db38754..e77cd93 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -7,9 +7,7 @@ def __init__(self, client): super(Locale, self).__init__(client) def get(self): - """Get user locale""" - api_path = '/locale' api_params = {} @@ -18,9 +16,7 @@ def get(self): }, api_params) def list_codes(self): - """List locale codes""" - api_path = '/locale/codes' api_params = {} @@ -29,9 +25,7 @@ def list_codes(self): }, api_params) def list_continents(self): - """List continents""" - api_path = '/locale/continents' api_params = {} @@ -40,9 +34,7 @@ def list_continents(self): }, api_params) def list_countries(self): - """List countries""" - api_path = '/locale/countries' api_params = {} @@ -51,9 +43,7 @@ def list_countries(self): }, api_params) def list_countries_eu(self): - """List EU countries""" - api_path = '/locale/countries/eu' api_params = {} @@ -62,9 +52,7 @@ def list_countries_eu(self): }, api_params) def list_countries_phones(self): - """List countries phone codes""" - api_path = '/locale/countries/phones' api_params = {} @@ -73,9 +61,7 @@ def list_countries_phones(self): }, api_params) def list_currencies(self): - """List currencies""" - api_path = '/locale/currencies' api_params = {} @@ -84,9 +70,7 @@ def list_currencies(self): }, api_params) def list_languages(self): - """List languages""" - api_path = '/locale/languages' api_params = {} diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index f8ce3bf..b62a706 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -1,15 +1,15 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.message_priority import MessagePriority; +from ..enums.smtp_encryption import SmtpEncryption; class Messaging(Service): def __init__(self, client): super(Messaging, self).__init__(client) - def list_messages(self, queries = None, search = None): - """List messages""" + def list_messages(self, queries: list = None, search: str = None): - api_path = '/messaging/messages' api_params = {} @@ -20,10 +20,8 @@ def list_messages(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_email(self, message_id, subject, content, topics = None, users = None, targets = None, cc = None, bcc = None, attachments = None, draft = None, html = None, scheduled_at = None): - """Create email""" + def create_email(self, message_id: str, subject: str, content: str, topics: list = None, users: list = None, targets: list = None, cc: list = None, bcc: list = None, attachments: list = None, draft: bool = None, html: bool = None, scheduled_at: str = None): - api_path = '/messaging/messages/email' api_params = {} if message_id is None: @@ -53,10 +51,8 @@ def create_email(self, message_id, subject, content, topics = None, users = None 'content-type': 'application/json', }, api_params) - def update_email(self, message_id, topics = None, users = None, targets = None, subject = None, content = None, draft = None, html = None, cc = None, bcc = None, scheduled_at = None, attachments = None): - """Update email""" + def update_email(self, message_id: str, topics: list = None, users: list = None, targets: list = None, subject: str = None, content: str = None, draft: bool = None, html: bool = None, cc: list = None, bcc: list = None, scheduled_at: str = None, attachments: list = None): - api_path = '/messaging/messages/email/{messageId}' api_params = {} if message_id is None: @@ -80,10 +76,8 @@ def update_email(self, message_id, topics = None, users = None, targets = None, 'content-type': 'application/json', }, api_params) - def create_push(self, message_id, title = None, body = None, topics = None, users = None, targets = None, data = None, action = None, image = None, icon = None, sound = None, color = None, tag = None, badge = None, draft = None, scheduled_at = None, content_available = None, critical = None, priority = None): - """Create push notification""" + def create_push(self, message_id: str, title: str = None, body: str = None, topics: list = None, users: list = None, targets: list = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): - api_path = '/messaging/messages/push' api_params = {} if message_id is None: @@ -114,10 +108,8 @@ def create_push(self, message_id, title = None, body = None, topics = None, user 'content-type': 'application/json', }, api_params) - def update_push(self, message_id, topics = None, users = None, targets = None, title = None, body = None, data = None, action = None, image = None, icon = None, sound = None, color = None, tag = None, badge = None, draft = None, scheduled_at = None, content_available = None, critical = None, priority = None): - """Update push notification""" + def update_push(self, message_id: str, topics: list = None, users: list = None, targets: list = None, title: str = None, body: str = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): - api_path = '/messaging/messages/push/{messageId}' api_params = {} if message_id is None: @@ -148,10 +140,8 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t 'content-type': 'application/json', }, api_params) - def create_sms(self, message_id, content, topics = None, users = None, targets = None, draft = None, scheduled_at = None): - """Create SMS""" + def create_sms(self, message_id: str, content: str, topics: list = None, users: list = None, targets: list = None, draft: bool = None, scheduled_at: str = None): - api_path = '/messaging/messages/sms' api_params = {} if message_id is None: @@ -173,10 +163,8 @@ def create_sms(self, message_id, content, topics = None, users = None, targets = 'content-type': 'application/json', }, api_params) - def update_sms(self, message_id, topics = None, users = None, targets = None, content = None, draft = None, scheduled_at = None): - """Update SMS""" + def update_sms(self, message_id: str, topics: list = None, users: list = None, targets: list = None, content: str = None, draft: bool = None, scheduled_at: str = None): - api_path = '/messaging/messages/sms/{messageId}' api_params = {} if message_id is None: @@ -195,10 +183,8 @@ def update_sms(self, message_id, topics = None, users = None, targets = None, co 'content-type': 'application/json', }, api_params) - def get_message(self, message_id): - """Get message""" + def get_message(self, message_id: str): - api_path = '/messaging/messages/{messageId}' api_params = {} if message_id is None: @@ -211,10 +197,8 @@ def get_message(self, message_id): 'content-type': 'application/json', }, api_params) - def delete(self, message_id): - """Delete message""" + def delete(self, message_id: str): - api_path = '/messaging/messages/{messageId}' api_params = {} if message_id is None: @@ -227,10 +211,8 @@ def delete(self, message_id): 'content-type': 'application/json', }, api_params) - def list_message_logs(self, message_id, queries = None): - """List message logs""" + def list_message_logs(self, message_id: str, queries: list = None): - api_path = '/messaging/messages/{messageId}/logs' api_params = {} if message_id is None: @@ -244,10 +226,8 @@ def list_message_logs(self, message_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_targets(self, message_id, queries = None): - """List message targets""" + def list_targets(self, message_id: str, queries: list = None): - api_path = '/messaging/messages/{messageId}/targets' api_params = {} if message_id is None: @@ -261,10 +241,8 @@ def list_targets(self, message_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_providers(self, queries = None, search = None): - """List providers""" + def list_providers(self, queries: list = None, search: str = None): - api_path = '/messaging/providers' api_params = {} @@ -275,10 +253,8 @@ def list_providers(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_apns_provider(self, provider_id, name, auth_key = None, auth_key_id = None, team_id = None, bundle_id = None, sandbox = None, enabled = None): - """Create APNS provider""" + def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None, auth_key_id: str = None, team_id: str = None, bundle_id: str = None, sandbox: bool = None, enabled: bool = None): - api_path = '/messaging/providers/apns' api_params = {} if provider_id is None: @@ -301,10 +277,8 @@ def create_apns_provider(self, provider_id, name, auth_key = None, auth_key_id = 'content-type': 'application/json', }, api_params) - def update_apns_provider(self, provider_id, name = None, enabled = None, auth_key = None, auth_key_id = None, team_id = None, bundle_id = None, sandbox = None): - """Update APNS provider""" + def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool = None, auth_key: str = None, auth_key_id: str = None, team_id: str = None, bundle_id: str = None, sandbox: bool = None): - api_path = '/messaging/providers/apns/{providerId}' api_params = {} if provider_id is None: @@ -324,10 +298,8 @@ def update_apns_provider(self, provider_id, name = None, enabled = None, auth_ke 'content-type': 'application/json', }, api_params) - def create_fcm_provider(self, provider_id, name, service_account_json = None, enabled = None): - """Create FCM provider""" + def create_fcm_provider(self, provider_id: str, name: str, service_account_json: dict = None, enabled: bool = None): - api_path = '/messaging/providers/fcm' api_params = {} if provider_id is None: @@ -346,10 +318,8 @@ def create_fcm_provider(self, provider_id, name, service_account_json = None, en 'content-type': 'application/json', }, api_params) - def update_fcm_provider(self, provider_id, name = None, enabled = None, service_account_json = None): - """Update FCM provider""" + def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool = None, service_account_json: dict = None): - api_path = '/messaging/providers/fcm/{providerId}' api_params = {} if provider_id is None: @@ -365,10 +335,8 @@ def update_fcm_provider(self, provider_id, name = None, enabled = None, service_ 'content-type': 'application/json', }, api_params) - def create_mailgun_provider(self, provider_id, name, api_key = None, domain = None, is_eu_region = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None, enabled = None): - """Create Mailgun provider""" + def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = None, domain: str = None, is_eu_region: bool = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): - api_path = '/messaging/providers/mailgun' api_params = {} if provider_id is None: @@ -393,10 +361,8 @@ def create_mailgun_provider(self, provider_id, name, api_key = None, domain = No 'content-type': 'application/json', }, api_params) - def update_mailgun_provider(self, provider_id, name = None, api_key = None, domain = None, is_eu_region = None, enabled = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None): - """Update Mailgun provider""" + def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: str = None, domain: str = None, is_eu_region: bool = None, enabled: bool = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None): - api_path = '/messaging/providers/mailgun/{providerId}' api_params = {} if provider_id is None: @@ -418,10 +384,8 @@ def update_mailgun_provider(self, provider_id, name = None, api_key = None, doma 'content-type': 'application/json', }, api_params) - def create_msg91_provider(self, provider_id, name, template_id = None, sender_id = None, auth_key = None, enabled = None): - """Create Msg91 provider""" + def create_msg91_provider(self, provider_id: str, name: str, template_id: str = None, sender_id: str = None, auth_key: str = None, enabled: bool = None): - api_path = '/messaging/providers/msg91' api_params = {} if provider_id is None: @@ -442,10 +406,8 @@ def create_msg91_provider(self, provider_id, name, template_id = None, sender_id 'content-type': 'application/json', }, api_params) - def update_msg91_provider(self, provider_id, name = None, enabled = None, template_id = None, sender_id = None, auth_key = None): - """Update Msg91 provider""" + def update_msg91_provider(self, provider_id: str, name: str = None, enabled: bool = None, template_id: str = None, sender_id: str = None, auth_key: str = None): - api_path = '/messaging/providers/msg91/{providerId}' api_params = {} if provider_id is None: @@ -463,10 +425,8 @@ def update_msg91_provider(self, provider_id, name = None, enabled = None, templa 'content-type': 'application/json', }, api_params) - def create_sendgrid_provider(self, provider_id, name, api_key = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None, enabled = None): - """Create Sendgrid provider""" + def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): - api_path = '/messaging/providers/sendgrid' api_params = {} if provider_id is None: @@ -489,10 +449,8 @@ def create_sendgrid_provider(self, provider_id, name, api_key = None, from_name 'content-type': 'application/json', }, api_params) - def update_sendgrid_provider(self, provider_id, name = None, enabled = None, api_key = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None): - """Update Sendgrid provider""" + def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: bool = None, api_key: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None): - api_path = '/messaging/providers/sendgrid/{providerId}' api_params = {} if provider_id is None: @@ -512,10 +470,8 @@ def update_sendgrid_provider(self, provider_id, name = None, enabled = None, api 'content-type': 'application/json', }, api_params) - def create_smtp_provider(self, provider_id, name, host, port = None, username = None, password = None, encryption = None, auto_tls = None, mailer = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None, enabled = None): - """Create SMTP provider""" + def create_smtp_provider(self, provider_id: str, name: str, host: str, port: float = None, username: str = None, password: str = None, encryption: SmtpEncryption = None, auto_tls: bool = None, mailer: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): - api_path = '/messaging/providers/smtp' api_params = {} if provider_id is None: @@ -547,10 +503,8 @@ def create_smtp_provider(self, provider_id, name, host, port = None, username = 'content-type': 'application/json', }, api_params) - def update_smtp_provider(self, provider_id, name = None, host = None, port = None, username = None, password = None, encryption = None, auto_tls = None, mailer = None, from_name = None, from_email = None, reply_to_name = None, reply_to_email = None, enabled = None): - """Update SMTP provider""" + def update_smtp_provider(self, provider_id: str, name: str = None, host: str = None, port: float = None, username: str = None, password: str = None, encryption: SmtpEncryption = None, auto_tls: bool = None, mailer: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): - api_path = '/messaging/providers/smtp/{providerId}' api_params = {} if provider_id is None: @@ -576,10 +530,8 @@ def update_smtp_provider(self, provider_id, name = None, host = None, port = Non 'content-type': 'application/json', }, api_params) - def create_telesign_provider(self, provider_id, name, xfrom = None, customer_id = None, api_key = None, enabled = None): - """Create Telesign provider""" + def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = None, customer_id: str = None, api_key: str = None, enabled: bool = None): - api_path = '/messaging/providers/telesign' api_params = {} if provider_id is None: @@ -600,10 +552,8 @@ def create_telesign_provider(self, provider_id, name, xfrom = None, customer_id 'content-type': 'application/json', }, api_params) - def update_telesign_provider(self, provider_id, name = None, enabled = None, customer_id = None, api_key = None, xfrom = None): - """Update Telesign provider""" + def update_telesign_provider(self, provider_id: str, name: str = None, enabled: bool = None, customer_id: str = None, api_key: str = None, xfrom: str = None): - api_path = '/messaging/providers/telesign/{providerId}' api_params = {} if provider_id is None: @@ -621,10 +571,8 @@ def update_telesign_provider(self, provider_id, name = None, enabled = None, cus 'content-type': 'application/json', }, api_params) - def create_textmagic_provider(self, provider_id, name, xfrom = None, username = None, api_key = None, enabled = None): - """Create Textmagic provider""" + def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = None, username: str = None, api_key: str = None, enabled: bool = None): - api_path = '/messaging/providers/textmagic' api_params = {} if provider_id is None: @@ -645,10 +593,8 @@ def create_textmagic_provider(self, provider_id, name, xfrom = None, username = 'content-type': 'application/json', }, api_params) - def update_textmagic_provider(self, provider_id, name = None, enabled = None, username = None, api_key = None, xfrom = None): - """Update Textmagic provider""" + def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: bool = None, username: str = None, api_key: str = None, xfrom: str = None): - api_path = '/messaging/providers/textmagic/{providerId}' api_params = {} if provider_id is None: @@ -666,10 +612,8 @@ def update_textmagic_provider(self, provider_id, name = None, enabled = None, us 'content-type': 'application/json', }, api_params) - def create_twilio_provider(self, provider_id, name, xfrom = None, account_sid = None, auth_token = None, enabled = None): - """Create Twilio provider""" + def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, account_sid: str = None, auth_token: str = None, enabled: bool = None): - api_path = '/messaging/providers/twilio' api_params = {} if provider_id is None: @@ -690,10 +634,8 @@ def create_twilio_provider(self, provider_id, name, xfrom = None, account_sid = 'content-type': 'application/json', }, api_params) - def update_twilio_provider(self, provider_id, name = None, enabled = None, account_sid = None, auth_token = None, xfrom = None): - """Update Twilio provider""" + def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bool = None, account_sid: str = None, auth_token: str = None, xfrom: str = None): - api_path = '/messaging/providers/twilio/{providerId}' api_params = {} if provider_id is None: @@ -711,10 +653,8 @@ def update_twilio_provider(self, provider_id, name = None, enabled = None, accou 'content-type': 'application/json', }, api_params) - def create_vonage_provider(self, provider_id, name, xfrom = None, api_key = None, api_secret = None, enabled = None): - """Create Vonage provider""" + def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, api_key: str = None, api_secret: str = None, enabled: bool = None): - api_path = '/messaging/providers/vonage' api_params = {} if provider_id is None: @@ -735,10 +675,8 @@ def create_vonage_provider(self, provider_id, name, xfrom = None, api_key = None 'content-type': 'application/json', }, api_params) - def update_vonage_provider(self, provider_id, name = None, enabled = None, api_key = None, api_secret = None, xfrom = None): - """Update Vonage provider""" + def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bool = None, api_key: str = None, api_secret: str = None, xfrom: str = None): - api_path = '/messaging/providers/vonage/{providerId}' api_params = {} if provider_id is None: @@ -756,10 +694,8 @@ def update_vonage_provider(self, provider_id, name = None, enabled = None, api_k 'content-type': 'application/json', }, api_params) - def get_provider(self, provider_id): - """Get provider""" + def get_provider(self, provider_id: str): - api_path = '/messaging/providers/{providerId}' api_params = {} if provider_id is None: @@ -772,10 +708,8 @@ def get_provider(self, provider_id): 'content-type': 'application/json', }, api_params) - def delete_provider(self, provider_id): - """Delete provider""" + def delete_provider(self, provider_id: str): - api_path = '/messaging/providers/{providerId}' api_params = {} if provider_id is None: @@ -788,10 +722,8 @@ def delete_provider(self, provider_id): 'content-type': 'application/json', }, api_params) - def list_provider_logs(self, provider_id, queries = None): - """List provider logs""" + def list_provider_logs(self, provider_id: str, queries: list = None): - api_path = '/messaging/providers/{providerId}/logs' api_params = {} if provider_id is None: @@ -805,10 +737,8 @@ def list_provider_logs(self, provider_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_subscriber_logs(self, subscriber_id, queries = None): - """List subscriber logs""" + def list_subscriber_logs(self, subscriber_id: str, queries: list = None): - api_path = '/messaging/subscribers/{subscriberId}/logs' api_params = {} if subscriber_id is None: @@ -822,10 +752,8 @@ def list_subscriber_logs(self, subscriber_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_topics(self, queries = None, search = None): - """List topics""" + def list_topics(self, queries: list = None, search: str = None): - api_path = '/messaging/topics' api_params = {} @@ -836,10 +764,8 @@ def list_topics(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_topic(self, topic_id, name, subscribe = None): - """Create topic""" + def create_topic(self, topic_id: str, name: str, subscribe: list = None): - api_path = '/messaging/topics' api_params = {} if topic_id is None: @@ -857,10 +783,8 @@ def create_topic(self, topic_id, name, subscribe = None): 'content-type': 'application/json', }, api_params) - def get_topic(self, topic_id): - """Get topic""" + def get_topic(self, topic_id: str): - api_path = '/messaging/topics/{topicId}' api_params = {} if topic_id is None: @@ -873,10 +797,8 @@ def get_topic(self, topic_id): 'content-type': 'application/json', }, api_params) - def update_topic(self, topic_id, name = None, subscribe = None): - """Update topic""" + def update_topic(self, topic_id: str, name: str = None, subscribe: list = None): - api_path = '/messaging/topics/{topicId}' api_params = {} if topic_id is None: @@ -891,10 +813,8 @@ def update_topic(self, topic_id, name = None, subscribe = None): 'content-type': 'application/json', }, api_params) - def delete_topic(self, topic_id): - """Delete topic""" + def delete_topic(self, topic_id: str): - api_path = '/messaging/topics/{topicId}' api_params = {} if topic_id is None: @@ -907,10 +827,8 @@ def delete_topic(self, topic_id): 'content-type': 'application/json', }, api_params) - def list_topic_logs(self, topic_id, queries = None): - """List topic logs""" + def list_topic_logs(self, topic_id: str, queries: list = None): - api_path = '/messaging/topics/{topicId}/logs' api_params = {} if topic_id is None: @@ -924,10 +842,8 @@ def list_topic_logs(self, topic_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_subscribers(self, topic_id, queries = None, search = None): - """List subscribers""" + def list_subscribers(self, topic_id: str, queries: list = None, search: str = None): - api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} if topic_id is None: @@ -942,10 +858,8 @@ def list_subscribers(self, topic_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_subscriber(self, topic_id, subscriber_id, target_id): - """Create subscriber""" + def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str): - api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} if topic_id is None: @@ -966,10 +880,8 @@ def create_subscriber(self, topic_id, subscriber_id, target_id): 'content-type': 'application/json', }, api_params) - def get_subscriber(self, topic_id, subscriber_id): - """Get subscriber""" + def get_subscriber(self, topic_id: str, subscriber_id: str): - api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} if topic_id is None: @@ -986,10 +898,8 @@ def get_subscriber(self, topic_id, subscriber_id): 'content-type': 'application/json', }, api_params) - def delete_subscriber(self, topic_id, subscriber_id): - """Delete subscriber""" + def delete_subscriber(self, topic_id: str, subscriber_id: str): - api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} if topic_id is None: diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 9acbb3a..0e57cfe 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -1,15 +1,17 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.compression import Compression; +from ..input_file import InputFile +from ..enums.image_gravity import ImageGravity; +from ..enums.image_format import ImageFormat; class Storage(Service): def __init__(self, client): super(Storage, self).__init__(client) - def list_buckets(self, queries = None, search = None): - """List buckets""" + def list_buckets(self, queries: list = None, search: str = None): - api_path = '/storage/buckets' api_params = {} @@ -20,10 +22,8 @@ def list_buckets(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_bucket(self, bucket_id, name, permissions = None, file_security = None, enabled = None, maximum_file_size = None, allowed_file_extensions = None, compression = None, encryption = None, antivirus = None): - """Create bucket""" + def create_bucket(self, bucket_id: str, name: str, permissions: list = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): - api_path = '/storage/buckets' api_params = {} if bucket_id is None: @@ -48,10 +48,8 @@ def create_bucket(self, bucket_id, name, permissions = None, file_security = Non 'content-type': 'application/json', }, api_params) - def get_bucket(self, bucket_id): - """Get bucket""" + def get_bucket(self, bucket_id: str): - api_path = '/storage/buckets/{bucketId}' api_params = {} if bucket_id is None: @@ -64,10 +62,8 @@ def get_bucket(self, bucket_id): 'content-type': 'application/json', }, api_params) - def update_bucket(self, bucket_id, name, permissions = None, file_security = None, enabled = None, maximum_file_size = None, allowed_file_extensions = None, compression = None, encryption = None, antivirus = None): - """Update bucket""" + def update_bucket(self, bucket_id: str, name: str, permissions: list = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): - api_path = '/storage/buckets/{bucketId}' api_params = {} if bucket_id is None: @@ -92,10 +88,8 @@ def update_bucket(self, bucket_id, name, permissions = None, file_security = Non 'content-type': 'application/json', }, api_params) - def delete_bucket(self, bucket_id): - """Delete bucket""" + def delete_bucket(self, bucket_id: str): - api_path = '/storage/buckets/{bucketId}' api_params = {} if bucket_id is None: @@ -108,10 +102,8 @@ def delete_bucket(self, bucket_id): 'content-type': 'application/json', }, api_params) - def list_files(self, bucket_id, queries = None, search = None): - """List files""" + def list_files(self, bucket_id: str, queries: list = None, search: str = None): - api_path = '/storage/buckets/{bucketId}/files' api_params = {} if bucket_id is None: @@ -126,10 +118,8 @@ def list_files(self, bucket_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_file(self, bucket_id, file_id, file, permissions = None, on_progress = None): - """Create file""" + def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: list = None, on_progress = None): - api_path = '/storage/buckets/{bucketId}/files' api_params = {} if bucket_id is None: @@ -157,10 +147,8 @@ def create_file(self, bucket_id, file_id, file, permissions = None, on_progress 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) - def get_file(self, bucket_id, file_id): - """Get file""" + def get_file(self, bucket_id: str, file_id: str): - api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} if bucket_id is None: @@ -177,10 +165,8 @@ def get_file(self, bucket_id, file_id): 'content-type': 'application/json', }, api_params) - def update_file(self, bucket_id, file_id, name = None, permissions = None): - """Update file""" + def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: list = None): - api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} if bucket_id is None: @@ -199,10 +185,8 @@ def update_file(self, bucket_id, file_id, name = None, permissions = None): 'content-type': 'application/json', }, api_params) - def delete_file(self, bucket_id, file_id): - """Delete file""" + def delete_file(self, bucket_id: str, file_id: str): - api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} if bucket_id is None: @@ -219,10 +203,8 @@ def delete_file(self, bucket_id, file_id): 'content-type': 'application/json', }, api_params) - def get_file_download(self, bucket_id, file_id): - """Get file for download""" + def get_file_download(self, bucket_id: str, file_id: str): - api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' api_params = {} if bucket_id is None: @@ -239,10 +221,8 @@ def get_file_download(self, bucket_id, file_id): 'content-type': 'application/json', }, api_params) - def get_file_preview(self, bucket_id, file_id, width = None, height = None, gravity = None, quality = None, border_width = None, border_color = None, border_radius = None, opacity = None, rotation = None, background = None, output = None): - """Get file preview""" + def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, height: float = None, gravity: ImageGravity = None, quality: float = None, border_width: float = None, border_color: str = None, border_radius: float = None, opacity: float = None, rotation: float = None, background: str = None, output: ImageFormat = None): - api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' api_params = {} if bucket_id is None: @@ -270,10 +250,8 @@ def get_file_preview(self, bucket_id, file_id, width = None, height = None, grav 'content-type': 'application/json', }, api_params) - def get_file_view(self, bucket_id, file_id): - """Get file for view""" + def get_file_view(self, bucket_id: str, file_id: str): - api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' api_params = {} if bucket_id is None: diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 2c387ed..988bf3c 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -6,10 +6,8 @@ class Teams(Service): def __init__(self, client): super(Teams, self).__init__(client) - def list(self, queries = None, search = None): - """List teams""" + def list(self, queries: list = None, search: str = None): - api_path = '/teams' api_params = {} @@ -20,10 +18,8 @@ def list(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create(self, team_id, name, roles = None): - """Create team""" + def create(self, team_id: str, name: str, roles: list = None): - api_path = '/teams' api_params = {} if team_id is None: @@ -41,10 +37,8 @@ def create(self, team_id, name, roles = None): 'content-type': 'application/json', }, api_params) - def get(self, team_id): - """Get team""" + def get(self, team_id: str): - api_path = '/teams/{teamId}' api_params = {} if team_id is None: @@ -57,10 +51,8 @@ def get(self, team_id): 'content-type': 'application/json', }, api_params) - def update_name(self, team_id, name): - """Update name""" + def update_name(self, team_id: str, name: str): - api_path = '/teams/{teamId}' api_params = {} if team_id is None: @@ -77,10 +69,8 @@ def update_name(self, team_id, name): 'content-type': 'application/json', }, api_params) - def delete(self, team_id): - """Delete team""" + def delete(self, team_id: str): - api_path = '/teams/{teamId}' api_params = {} if team_id is None: @@ -93,10 +83,8 @@ def delete(self, team_id): 'content-type': 'application/json', }, api_params) - def list_memberships(self, team_id, queries = None, search = None): - """List team memberships""" + def list_memberships(self, team_id: str, queries: list = None, search: str = None): - api_path = '/teams/{teamId}/memberships' api_params = {} if team_id is None: @@ -111,10 +99,8 @@ def list_memberships(self, team_id, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create_membership(self, team_id, roles, email = None, user_id = None, phone = None, url = None, name = None): - """Create team membership""" + def create_membership(self, team_id: str, roles: list, email: str = None, user_id: str = None, phone: str = None, url: str = None, name: str = None): - api_path = '/teams/{teamId}/memberships' api_params = {} if team_id is None: @@ -136,10 +122,8 @@ def create_membership(self, team_id, roles, email = None, user_id = None, phone 'content-type': 'application/json', }, api_params) - def get_membership(self, team_id, membership_id): - """Get team membership""" + def get_membership(self, team_id: str, membership_id: str): - api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} if team_id is None: @@ -156,10 +140,8 @@ def get_membership(self, team_id, membership_id): 'content-type': 'application/json', }, api_params) - def update_membership(self, team_id, membership_id, roles): - """Update membership""" + def update_membership(self, team_id: str, membership_id: str, roles: list): - api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} if team_id is None: @@ -180,10 +162,8 @@ def update_membership(self, team_id, membership_id, roles): 'content-type': 'application/json', }, api_params) - def delete_membership(self, team_id, membership_id): - """Delete team membership""" + def delete_membership(self, team_id: str, membership_id: str): - api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} if team_id is None: @@ -200,10 +180,8 @@ def delete_membership(self, team_id, membership_id): 'content-type': 'application/json', }, api_params) - def update_membership_status(self, team_id, membership_id, user_id, secret): - """Update team membership status""" + def update_membership_status(self, team_id: str, membership_id: str, user_id: str, secret: str): - api_path = '/teams/{teamId}/memberships/{membershipId}/status' api_params = {} if team_id is None: @@ -228,10 +206,8 @@ def update_membership_status(self, team_id, membership_id, user_id, secret): 'content-type': 'application/json', }, api_params) - def get_prefs(self, team_id): - """Get team preferences""" + def get_prefs(self, team_id: str): - api_path = '/teams/{teamId}/prefs' api_params = {} if team_id is None: @@ -244,10 +220,8 @@ def get_prefs(self, team_id): 'content-type': 'application/json', }, api_params) - def update_prefs(self, team_id, prefs): - """Update preferences""" + def update_prefs(self, team_id: str, prefs: dict): - api_path = '/teams/{teamId}/prefs' api_params = {} if team_id is None: diff --git a/appwrite/services/users.py b/appwrite/services/users.py index aa04a72..1a141db 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1,15 +1,16 @@ from ..service import Service from ..exception import AppwriteException +from ..enums.password_hash import PasswordHash; +from ..enums.authenticator_type import AuthenticatorType; +from ..enums.messaging_provider_type import MessagingProviderType; class Users(Service): def __init__(self, client): super(Users, self).__init__(client) - def list(self, queries = None, search = None): - """List users""" + def list(self, queries: list = None, search: str = None): - api_path = '/users' api_params = {} @@ -20,10 +21,8 @@ def list(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def create(self, user_id, email = None, phone = None, password = None, name = None): - """Create user""" + def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None): - api_path = '/users' api_params = {} if user_id is None: @@ -40,10 +39,8 @@ def create(self, user_id, email = None, phone = None, password = None, name = No 'content-type': 'application/json', }, api_params) - def create_argon2_user(self, user_id, email, password, name = None): - """Create user with Argon2 password""" + def create_argon2_user(self, user_id: str, email: str, password: str, name: str = None): - api_path = '/users/argon2' api_params = {} if user_id is None: @@ -65,10 +62,8 @@ def create_argon2_user(self, user_id, email, password, name = None): 'content-type': 'application/json', }, api_params) - def create_bcrypt_user(self, user_id, email, password, name = None): - """Create user with bcrypt password""" + def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str = None): - api_path = '/users/bcrypt' api_params = {} if user_id is None: @@ -90,10 +85,8 @@ def create_bcrypt_user(self, user_id, email, password, name = None): 'content-type': 'application/json', }, api_params) - def list_identities(self, queries = None, search = None): - """List identities""" + def list_identities(self, queries: list = None, search: str = None): - api_path = '/users/identities' api_params = {} @@ -104,10 +97,8 @@ def list_identities(self, queries = None, search = None): 'content-type': 'application/json', }, api_params) - def delete_identity(self, identity_id): - """Delete identity""" + def delete_identity(self, identity_id: str): - api_path = '/users/identities/{identityId}' api_params = {} if identity_id is None: @@ -120,10 +111,8 @@ def delete_identity(self, identity_id): 'content-type': 'application/json', }, api_params) - def create_md5_user(self, user_id, email, password, name = None): - """Create user with MD5 password""" + def create_md5_user(self, user_id: str, email: str, password: str, name: str = None): - api_path = '/users/md5' api_params = {} if user_id is None: @@ -145,10 +134,8 @@ def create_md5_user(self, user_id, email, password, name = None): 'content-type': 'application/json', }, api_params) - def create_ph_pass_user(self, user_id, email, password, name = None): - """Create user with PHPass password""" + def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str = None): - api_path = '/users/phpass' api_params = {} if user_id is None: @@ -170,10 +157,8 @@ def create_ph_pass_user(self, user_id, email, password, name = None): 'content-type': 'application/json', }, api_params) - def create_scrypt_user(self, user_id, email, password, password_salt, password_cpu, password_memory, password_parallel, password_length, name = None): - """Create user with Scrypt password""" + def create_scrypt_user(self, user_id: str, email: str, password: str, password_salt: str, password_cpu: float, password_memory: float, password_parallel: float, password_length: float, name: str = None): - api_path = '/users/scrypt' api_params = {} if user_id is None: @@ -215,10 +200,8 @@ def create_scrypt_user(self, user_id, email, password, password_salt, password_c 'content-type': 'application/json', }, api_params) - def create_scrypt_modified_user(self, user_id, email, password, password_salt, password_salt_separator, password_signer_key, name = None): - """Create user with Scrypt modified password""" + def create_scrypt_modified_user(self, user_id: str, email: str, password: str, password_salt: str, password_salt_separator: str, password_signer_key: str, name: str = None): - api_path = '/users/scrypt-modified' api_params = {} if user_id is None: @@ -252,10 +235,8 @@ def create_scrypt_modified_user(self, user_id, email, password, password_salt, p 'content-type': 'application/json', }, api_params) - def create_sha_user(self, user_id, email, password, password_version = None, name = None): - """Create user with SHA password""" + def create_sha_user(self, user_id: str, email: str, password: str, password_version: PasswordHash = None, name: str = None): - api_path = '/users/sha' api_params = {} if user_id is None: @@ -278,10 +259,8 @@ def create_sha_user(self, user_id, email, password, password_version = None, nam 'content-type': 'application/json', }, api_params) - def get(self, user_id): - """Get user""" + def get(self, user_id: str): - api_path = '/users/{userId}' api_params = {} if user_id is None: @@ -294,10 +273,8 @@ def get(self, user_id): 'content-type': 'application/json', }, api_params) - def delete(self, user_id): - """Delete user""" + def delete(self, user_id: str): - api_path = '/users/{userId}' api_params = {} if user_id is None: @@ -310,10 +287,8 @@ def delete(self, user_id): 'content-type': 'application/json', }, api_params) - def update_email(self, user_id, email): - """Update email""" + def update_email(self, user_id: str, email: str): - api_path = '/users/{userId}/email' api_params = {} if user_id is None: @@ -330,10 +305,8 @@ def update_email(self, user_id, email): 'content-type': 'application/json', }, api_params) - def create_jwt(self, user_id, session_id = None, duration = None): - """Create user JWT""" + def create_jwt(self, user_id: str, session_id: str = None, duration: float = None): - api_path = '/users/{userId}/jwts' api_params = {} if user_id is None: @@ -348,10 +321,8 @@ def create_jwt(self, user_id, session_id = None, duration = None): 'content-type': 'application/json', }, api_params) - def update_labels(self, user_id, labels): - """Update user labels""" + def update_labels(self, user_id: str, labels: list): - api_path = '/users/{userId}/labels' api_params = {} if user_id is None: @@ -368,10 +339,8 @@ def update_labels(self, user_id, labels): 'content-type': 'application/json', }, api_params) - def list_logs(self, user_id, queries = None): - """List user logs""" + def list_logs(self, user_id: str, queries: list = None): - api_path = '/users/{userId}/logs' api_params = {} if user_id is None: @@ -385,10 +354,8 @@ def list_logs(self, user_id, queries = None): 'content-type': 'application/json', }, api_params) - def list_memberships(self, user_id): - """List user memberships""" + def list_memberships(self, user_id: str): - api_path = '/users/{userId}/memberships' api_params = {} if user_id is None: @@ -401,10 +368,8 @@ def list_memberships(self, user_id): 'content-type': 'application/json', }, api_params) - def update_mfa(self, user_id, mfa): - """Update MFA""" + def update_mfa(self, user_id: str, mfa: bool): - api_path = '/users/{userId}/mfa' api_params = {} if user_id is None: @@ -421,10 +386,8 @@ def update_mfa(self, user_id, mfa): 'content-type': 'application/json', }, api_params) - def delete_mfa_authenticator(self, user_id, type): - """Delete authenticator""" + def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType): - api_path = '/users/{userId}/mfa/authenticators/{type}' api_params = {} if user_id is None: @@ -441,10 +404,8 @@ def delete_mfa_authenticator(self, user_id, type): 'content-type': 'application/json', }, api_params) - def list_mfa_factors(self, user_id): - """List factors""" + def list_mfa_factors(self, user_id: str): - api_path = '/users/{userId}/mfa/factors' api_params = {} if user_id is None: @@ -457,10 +418,8 @@ def list_mfa_factors(self, user_id): 'content-type': 'application/json', }, api_params) - def get_mfa_recovery_codes(self, user_id): - """Get MFA recovery codes""" + def get_mfa_recovery_codes(self, user_id: str): - api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} if user_id is None: @@ -473,10 +432,8 @@ def get_mfa_recovery_codes(self, user_id): 'content-type': 'application/json', }, api_params) - def update_mfa_recovery_codes(self, user_id): - """Regenerate MFA recovery codes""" + def update_mfa_recovery_codes(self, user_id: str): - api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} if user_id is None: @@ -489,10 +446,8 @@ def update_mfa_recovery_codes(self, user_id): 'content-type': 'application/json', }, api_params) - def create_mfa_recovery_codes(self, user_id): - """Create MFA recovery codes""" + def create_mfa_recovery_codes(self, user_id: str): - api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} if user_id is None: @@ -505,10 +460,8 @@ def create_mfa_recovery_codes(self, user_id): 'content-type': 'application/json', }, api_params) - def update_name(self, user_id, name): - """Update name""" + def update_name(self, user_id: str, name: str): - api_path = '/users/{userId}/name' api_params = {} if user_id is None: @@ -525,10 +478,8 @@ def update_name(self, user_id, name): 'content-type': 'application/json', }, api_params) - def update_password(self, user_id, password): - """Update password""" + def update_password(self, user_id: str, password: str): - api_path = '/users/{userId}/password' api_params = {} if user_id is None: @@ -545,10 +496,8 @@ def update_password(self, user_id, password): 'content-type': 'application/json', }, api_params) - def update_phone(self, user_id, number): - """Update phone""" + def update_phone(self, user_id: str, number: str): - api_path = '/users/{userId}/phone' api_params = {} if user_id is None: @@ -565,10 +514,8 @@ def update_phone(self, user_id, number): 'content-type': 'application/json', }, api_params) - def get_prefs(self, user_id): - """Get user preferences""" + def get_prefs(self, user_id: str): - api_path = '/users/{userId}/prefs' api_params = {} if user_id is None: @@ -581,10 +528,8 @@ def get_prefs(self, user_id): 'content-type': 'application/json', }, api_params) - def update_prefs(self, user_id, prefs): - """Update user preferences""" + def update_prefs(self, user_id: str, prefs: dict): - api_path = '/users/{userId}/prefs' api_params = {} if user_id is None: @@ -601,10 +546,8 @@ def update_prefs(self, user_id, prefs): 'content-type': 'application/json', }, api_params) - def list_sessions(self, user_id): - """List user sessions""" + def list_sessions(self, user_id: str): - api_path = '/users/{userId}/sessions' api_params = {} if user_id is None: @@ -617,10 +560,8 @@ def list_sessions(self, user_id): 'content-type': 'application/json', }, api_params) - def create_session(self, user_id): - """Create session""" + def create_session(self, user_id: str): - api_path = '/users/{userId}/sessions' api_params = {} if user_id is None: @@ -633,10 +574,8 @@ def create_session(self, user_id): 'content-type': 'application/json', }, api_params) - def delete_sessions(self, user_id): - """Delete user sessions""" + def delete_sessions(self, user_id: str): - api_path = '/users/{userId}/sessions' api_params = {} if user_id is None: @@ -649,10 +588,8 @@ def delete_sessions(self, user_id): 'content-type': 'application/json', }, api_params) - def delete_session(self, user_id, session_id): - """Delete user session""" + def delete_session(self, user_id: str, session_id: str): - api_path = '/users/{userId}/sessions/{sessionId}' api_params = {} if user_id is None: @@ -669,10 +606,8 @@ def delete_session(self, user_id, session_id): 'content-type': 'application/json', }, api_params) - def update_status(self, user_id, status): - """Update user status""" + def update_status(self, user_id: str, status: bool): - api_path = '/users/{userId}/status' api_params = {} if user_id is None: @@ -689,10 +624,8 @@ def update_status(self, user_id, status): 'content-type': 'application/json', }, api_params) - def list_targets(self, user_id, queries = None): - """List user targets""" + def list_targets(self, user_id: str, queries: list = None): - api_path = '/users/{userId}/targets' api_params = {} if user_id is None: @@ -706,10 +639,8 @@ def list_targets(self, user_id, queries = None): 'content-type': 'application/json', }, api_params) - def create_target(self, user_id, target_id, provider_type, identifier, provider_id = None, name = None): - """Create user target""" + def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None): - api_path = '/users/{userId}/targets' api_params = {} if user_id is None: @@ -736,10 +667,8 @@ def create_target(self, user_id, target_id, provider_type, identifier, provider_ 'content-type': 'application/json', }, api_params) - def get_target(self, user_id, target_id): - """Get user target""" + def get_target(self, user_id: str, target_id: str): - api_path = '/users/{userId}/targets/{targetId}' api_params = {} if user_id is None: @@ -756,10 +685,8 @@ def get_target(self, user_id, target_id): 'content-type': 'application/json', }, api_params) - def update_target(self, user_id, target_id, identifier = None, provider_id = None, name = None): - """Update user target""" + def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None): - api_path = '/users/{userId}/targets/{targetId}' api_params = {} if user_id is None: @@ -779,10 +706,8 @@ def update_target(self, user_id, target_id, identifier = None, provider_id = Non 'content-type': 'application/json', }, api_params) - def delete_target(self, user_id, target_id): - """Delete user target""" + def delete_target(self, user_id: str, target_id: str): - api_path = '/users/{userId}/targets/{targetId}' api_params = {} if user_id is None: @@ -799,10 +724,8 @@ def delete_target(self, user_id, target_id): 'content-type': 'application/json', }, api_params) - def create_token(self, user_id, length = None, expire = None): - """Create token""" + def create_token(self, user_id: str, length: float = None, expire: float = None): - api_path = '/users/{userId}/tokens' api_params = {} if user_id is None: @@ -817,10 +740,8 @@ def create_token(self, user_id, length = None, expire = None): 'content-type': 'application/json', }, api_params) - def update_email_verification(self, user_id, email_verification): - """Update email verification""" + def update_email_verification(self, user_id: str, email_verification: bool): - api_path = '/users/{userId}/verification' api_params = {} if user_id is None: @@ -837,10 +758,8 @@ def update_email_verification(self, user_id, email_verification): 'content-type': 'application/json', }, api_params) - def update_phone_verification(self, user_id, phone_verification): - """Update phone verification""" + def update_phone_verification(self, user_id: str, phone_verification: bool): - api_path = '/users/{userId}/verification/phone' api_params = {} if user_id is None: diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 8f8a35a..d16b9bb 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -13,8 +13,8 @@ result = databases.update_float_attribute( collection_id = '', key = '', required = False, - min = None, - max = None, default = None, + min = None, # optional + max = None, # optional new_key = '' # optional ) diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 125cf82..ab0ccd6 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -13,8 +13,8 @@ result = databases.update_integer_attribute( collection_id = '', key = '', required = False, - min = None, - max = None, default = None, + min = None, # optional + max = None, # optional new_key = '' # optional ) diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-stats-resources.md similarity index 88% rename from docs/examples/health/get-queue-usage-dump.md rename to docs/examples/health/get-queue-stats-resources.md index dabb79a..3b09342 100644 --- a/docs/examples/health/get-queue-usage-dump.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -8,6 +8,6 @@ client.set_key('') # Your secret API key health = Health(client) -result = health.get_queue_usage_dump( +result = health.get_queue_stats_resources( threshold = None # optional ) diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue-stats-usage-dump.md similarity index 79% rename from docs/examples/health/get-queue.md rename to docs/examples/health/get-queue-stats-usage-dump.md index aafe7c7..c58059e 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue-stats-usage-dump.md @@ -8,4 +8,6 @@ client.set_key('') # Your secret API key health = Health(client) -result = health.get_queue() +result = health.get_queue_stats_usage_dump( + threshold = None # optional +) diff --git a/setup.py b/setup.py index 558311d..40bc73f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '8.0.0' + version = '9.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, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/8.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.0.tar.gz', install_requires=[ 'requests', ], From 8e39f054b3e27cb9b792a0eb2fc347fdfb2f6d80 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Mon, 10 Mar 2025 11:07:16 +0000 Subject: [PATCH 2/2] fix: missing types for lists, and missing doc blocks --- appwrite/client.py | 2 +- appwrite/services/account.py | 49 +++++++++++++++++++-- appwrite/services/avatars.py | 7 +++ appwrite/services/databases.py | 68 +++++++++++++++++++++++------ appwrite/services/functions.py | 34 ++++++++++++--- appwrite/services/graphql.py | 2 + appwrite/services/health.py | 23 ++++++++++ appwrite/services/locale.py | 8 ++++ appwrite/services/messaging.py | 80 ++++++++++++++++++++++++++-------- appwrite/services/storage.py | 25 ++++++++--- appwrite/services/teams.py | 23 +++++++--- appwrite/services/users.py | 52 +++++++++++++++++++--- 12 files changed, 318 insertions(+), 55 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index cd37ff9..4e04484 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -13,7 +13,7 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : 'AppwritePythonSDK/9.0.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.0 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 61f1f60..7c248f3 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -10,6 +10,7 @@ def __init__(self, client): super(Account, self).__init__(client) def get(self): + """Get account""" api_path = '/account' api_params = {} @@ -19,6 +20,7 @@ def get(self): }, api_params) def create(self, user_id: str, email: str, password: str, name: str = None): + """Create account""" api_path = '/account' api_params = {} @@ -42,6 +44,7 @@ def create(self, user_id: str, email: str, password: str, name: str = None): }, api_params) def update_email(self, email: str, password: str): + """Update email""" api_path = '/account/email' api_params = {} @@ -59,7 +62,8 @@ def update_email(self, email: str, password: str): 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: list = None): + def list_identities(self, queries: list[str] = None): + """List identities""" api_path = '/account/identities' api_params = {} @@ -71,6 +75,7 @@ def list_identities(self, queries: list = None): }, api_params) def delete_identity(self, identity_id: str): + """Delete identity""" api_path = '/account/identities/{identityId}' api_params = {} @@ -85,6 +90,7 @@ def delete_identity(self, identity_id: str): }, api_params) def create_jwt(self): + """Create JWT""" api_path = '/account/jwts' api_params = {} @@ -93,7 +99,8 @@ def create_jwt(self): 'content-type': 'application/json', }, api_params) - def list_logs(self, queries: list = None): + def list_logs(self, queries: list[str] = None): + """List logs""" api_path = '/account/logs' api_params = {} @@ -105,6 +112,7 @@ def list_logs(self, queries: list = None): }, api_params) def update_mfa(self, mfa: bool): + """Update MFA""" api_path = '/account/mfa' api_params = {} @@ -119,6 +127,7 @@ def update_mfa(self, mfa: bool): }, api_params) def create_mfa_authenticator(self, type: AuthenticatorType): + """Create authenticator""" api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -133,6 +142,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType): }, api_params) def update_mfa_authenticator(self, type: AuthenticatorType, otp: str): + """Verify authenticator""" api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -151,6 +161,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str): }, api_params) def delete_mfa_authenticator(self, type: AuthenticatorType): + """Delete authenticator""" api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -165,6 +176,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType): }, api_params) def create_mfa_challenge(self, factor: AuthenticationFactor): + """Create MFA challenge""" api_path = '/account/mfa/challenge' api_params = {} @@ -179,6 +191,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor): }, api_params) def update_mfa_challenge(self, challenge_id: str, otp: str): + """Create MFA challenge (confirmation)""" api_path = '/account/mfa/challenge' api_params = {} @@ -197,6 +210,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str): }, api_params) def list_mfa_factors(self): + """List factors""" api_path = '/account/mfa/factors' api_params = {} @@ -206,6 +220,7 @@ def list_mfa_factors(self): }, api_params) def get_mfa_recovery_codes(self): + """Get MFA recovery codes""" api_path = '/account/mfa/recovery-codes' api_params = {} @@ -215,6 +230,7 @@ def get_mfa_recovery_codes(self): }, api_params) def create_mfa_recovery_codes(self): + """Create MFA recovery codes""" api_path = '/account/mfa/recovery-codes' api_params = {} @@ -224,6 +240,7 @@ def create_mfa_recovery_codes(self): }, api_params) def update_mfa_recovery_codes(self): + """Regenerate MFA recovery codes""" api_path = '/account/mfa/recovery-codes' api_params = {} @@ -233,6 +250,7 @@ def update_mfa_recovery_codes(self): }, api_params) def update_name(self, name: str): + """Update name""" api_path = '/account/name' api_params = {} @@ -247,6 +265,7 @@ def update_name(self, name: str): }, api_params) def update_password(self, password: str, old_password: str = None): + """Update password""" api_path = '/account/password' api_params = {} @@ -262,6 +281,7 @@ def update_password(self, password: str, old_password: str = None): }, api_params) def update_phone(self, phone: str, password: str): + """Update phone""" api_path = '/account/phone' api_params = {} @@ -280,6 +300,7 @@ def update_phone(self, phone: str, password: str): }, api_params) def get_prefs(self): + """Get account preferences""" api_path = '/account/prefs' api_params = {} @@ -289,6 +310,7 @@ def get_prefs(self): }, api_params) def update_prefs(self, prefs: dict): + """Update preferences""" api_path = '/account/prefs' api_params = {} @@ -303,6 +325,7 @@ def update_prefs(self, prefs: dict): }, api_params) def create_recovery(self, email: str, url: str): + """Create password recovery""" api_path = '/account/recovery' api_params = {} @@ -321,6 +344,7 @@ def create_recovery(self, email: str, url: str): }, api_params) def update_recovery(self, user_id: str, secret: str, password: str): + """Create password recovery (confirmation)""" api_path = '/account/recovery' api_params = {} @@ -343,6 +367,7 @@ def update_recovery(self, user_id: str, secret: str, password: str): }, api_params) def list_sessions(self): + """List sessions""" api_path = '/account/sessions' api_params = {} @@ -352,6 +377,7 @@ def list_sessions(self): }, api_params) def delete_sessions(self): + """Delete sessions""" api_path = '/account/sessions' api_params = {} @@ -361,6 +387,7 @@ def delete_sessions(self): }, api_params) def create_anonymous_session(self): + """Create anonymous session""" api_path = '/account/sessions/anonymous' api_params = {} @@ -370,6 +397,7 @@ def create_anonymous_session(self): }, api_params) def create_email_password_session(self, email: str, password: str): + """Create email password session""" api_path = '/account/sessions/email' api_params = {} @@ -388,6 +416,7 @@ def create_email_password_session(self, email: str, password: str): }, api_params) def update_magic_url_session(self, user_id: str, secret: str): + """Update magic URL session""" api_path = '/account/sessions/magic-url' api_params = {} @@ -406,6 +435,7 @@ def update_magic_url_session(self, user_id: str, secret: str): }, api_params) def update_phone_session(self, user_id: str, secret: str): + """Update phone session""" api_path = '/account/sessions/phone' api_params = {} @@ -424,6 +454,7 @@ def update_phone_session(self, user_id: str, secret: str): }, api_params) def create_session(self, user_id: str, secret: str): + """Create session""" api_path = '/account/sessions/token' api_params = {} @@ -442,6 +473,7 @@ def create_session(self, user_id: str, secret: str): }, api_params) def get_session(self, session_id: str): + """Get session""" api_path = '/account/sessions/{sessionId}' api_params = {} @@ -456,6 +488,7 @@ def get_session(self, session_id: str): }, api_params) def update_session(self, session_id: str): + """Update session""" api_path = '/account/sessions/{sessionId}' api_params = {} @@ -470,6 +503,7 @@ def update_session(self, session_id: str): }, api_params) def delete_session(self, session_id: str): + """Delete session""" api_path = '/account/sessions/{sessionId}' api_params = {} @@ -484,6 +518,7 @@ def delete_session(self, session_id: str): }, api_params) def update_status(self): + """Update status""" api_path = '/account/status' api_params = {} @@ -493,6 +528,7 @@ def update_status(self): }, api_params) def create_email_token(self, user_id: str, email: str, phrase: bool = None): + """Create email token (OTP)""" api_path = '/account/tokens/email' api_params = {} @@ -512,6 +548,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None): }, api_params) def create_magic_url_token(self, user_id: str, email: str, url: str = None, phrase: bool = None): + """Create magic URL token""" api_path = '/account/tokens/magic-url' api_params = {} @@ -531,7 +568,8 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra 'content-type': 'application/json', }, api_params) - def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list = None): + def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: list[str] = None): + """Create OAuth2 token""" api_path = '/account/tokens/oauth2/{provider}' api_params = {} @@ -549,6 +587,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai }, api_params, response_type='location') def create_phone_token(self, user_id: str, phone: str): + """Create phone token""" api_path = '/account/tokens/phone' api_params = {} @@ -567,6 +606,7 @@ def create_phone_token(self, user_id: str, phone: str): }, api_params) def create_verification(self, url: str): + """Create email verification""" api_path = '/account/verification' api_params = {} @@ -581,6 +621,7 @@ def create_verification(self, url: str): }, api_params) def update_verification(self, user_id: str, secret: str): + """Create email verification (confirmation)""" api_path = '/account/verification' api_params = {} @@ -599,6 +640,7 @@ def update_verification(self, user_id: str, secret: str): }, api_params) def create_phone_verification(self): + """Create phone verification""" api_path = '/account/verification/phone' api_params = {} @@ -608,6 +650,7 @@ def create_phone_verification(self): }, api_params) def update_phone_verification(self, user_id: str, secret: str): + """Update phone verification (confirmation)""" api_path = '/account/verification/phone' api_params = {} diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index e4752a6..40a0abb 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -10,6 +10,7 @@ def __init__(self, client): super(Avatars, self).__init__(client) def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None): + """Get browser icon""" api_path = '/avatars/browsers/{code}' api_params = {} @@ -27,6 +28,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, }, api_params) def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None): + """Get credit card icon""" api_path = '/avatars/credit-cards/{code}' api_params = {} @@ -44,6 +46,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = }, api_params) def get_favicon(self, url: str): + """Get favicon""" api_path = '/avatars/favicon' api_params = {} @@ -58,6 +61,7 @@ def get_favicon(self, url: str): }, api_params) def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None): + """Get country flag""" api_path = '/avatars/flags/{code}' api_params = {} @@ -75,6 +79,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit }, api_params) def get_image(self, url: str, width: float = None, height: float = None): + """Get image from URL""" api_path = '/avatars/image' api_params = {} @@ -91,6 +96,7 @@ def get_image(self, url: str, width: float = None, height: float = None): }, api_params) def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None): + """Get user initials""" api_path = '/avatars/initials' api_params = {} @@ -105,6 +111,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No }, api_params) def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None): + """Get QR code""" api_path = '/avatars/qr' api_params = {} diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 85b2e86..e1c63b2 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -9,7 +9,8 @@ class Databases(Service): def __init__(self, client): super(Databases, self).__init__(client) - def list(self, queries: list = None, search: str = None): + def list(self, queries: list[str] = None, search: str = None): + """List databases""" api_path = '/databases' api_params = {} @@ -22,6 +23,7 @@ def list(self, queries: list = None, search: str = None): }, api_params) def create(self, database_id: str, name: str, enabled: bool = None): + """Create database""" api_path = '/databases' api_params = {} @@ -41,6 +43,7 @@ def create(self, database_id: str, name: str, enabled: bool = None): }, api_params) def get(self, database_id: str): + """Get database""" api_path = '/databases/{databaseId}' api_params = {} @@ -55,6 +58,7 @@ def get(self, database_id: str): }, api_params) def update(self, database_id: str, name: str, enabled: bool = None): + """Update database""" api_path = '/databases/{databaseId}' api_params = {} @@ -74,6 +78,7 @@ def update(self, database_id: str, name: str, enabled: bool = None): }, api_params) def delete(self, database_id: str): + """Delete database""" api_path = '/databases/{databaseId}' api_params = {} @@ -87,7 +92,8 @@ def delete(self, database_id: str): 'content-type': 'application/json', }, api_params) - def list_collections(self, database_id: str, queries: list = None, search: str = None): + def list_collections(self, database_id: str, queries: list[str] = None, search: str = None): + """List collections""" api_path = '/databases/{databaseId}/collections' api_params = {} @@ -103,7 +109,8 @@ def list_collections(self, database_id: str, queries: list = None, search: str = 'content-type': 'application/json', }, api_params) - def create_collection(self, database_id: str, collection_id: str, name: str, permissions: list = None, document_security: bool = None, enabled: bool = None): + def create_collection(self, database_id: str, collection_id: str, name: str, permissions: list[str] = None, document_security: bool = None, enabled: bool = None): + """Create collection""" api_path = '/databases/{databaseId}/collections' api_params = {} @@ -129,6 +136,7 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per }, api_params) def get_collection(self, database_id: str, collection_id: str): + """Get collection""" api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -146,7 +154,8 @@ def get_collection(self, database_id: str, collection_id: str): 'content-type': 'application/json', }, api_params) - def update_collection(self, database_id: str, collection_id: str, name: str, permissions: list = None, document_security: bool = None, enabled: bool = None): + def update_collection(self, database_id: str, collection_id: str, name: str, permissions: list[str] = None, document_security: bool = None, enabled: bool = None): + """Update collection""" api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -172,6 +181,7 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per }, api_params) def delete_collection(self, database_id: str, collection_id: str): + """Delete collection""" api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -189,7 +199,8 @@ def delete_collection(self, database_id: str, collection_id: str): 'content-type': 'application/json', }, api_params) - def list_attributes(self, database_id: str, collection_id: str, queries: list = None): + def list_attributes(self, database_id: str, collection_id: str, queries: list[str] = None): + """List attributes""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' api_params = {} @@ -209,6 +220,7 @@ def list_attributes(self, database_id: str, collection_id: str, queries: list = }, api_params) def create_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool = None, array: bool = None): + """Create boolean attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' api_params = {} @@ -237,6 +249,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st }, api_params) def update_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool, new_key: str = None): + """Update boolean attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' api_params = {} @@ -265,6 +278,7 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st }, api_params) def create_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): + """Create datetime attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' api_params = {} @@ -293,6 +307,7 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s }, api_params) def update_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): + """Update dateTime attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' api_params = {} @@ -321,6 +336,7 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s }, api_params) def create_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): + """Create email attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' api_params = {} @@ -349,6 +365,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, }, api_params) def update_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): + """Update email attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' api_params = {} @@ -376,7 +393,8 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, api_params) - def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list, required: bool, default: str = None, array: bool = None): + def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list[str], required: bool, default: str = None, array: bool = None): + """Create enum attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' api_params = {} @@ -408,7 +426,8 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, api_params) - def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list, required: bool, default: str, new_key: str = None): + def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: list[str], required: bool, default: str, new_key: str = None): + """Update enum attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' api_params = {} @@ -441,6 +460,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, }, api_params) def create_float_attribute(self, database_id: str, collection_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None): + """Create float attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' api_params = {} @@ -471,6 +491,7 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, }, api_params) def update_float_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None): + """Update float attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' api_params = {} @@ -501,6 +522,7 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, }, api_params) def create_integer_attribute(self, database_id: str, collection_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None): + """Create integer attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' api_params = {} @@ -531,6 +553,7 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st }, api_params) def update_integer_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None): + """Update integer attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' api_params = {} @@ -561,6 +584,7 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st }, api_params) def create_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): + """Create IP address attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' api_params = {} @@ -589,6 +613,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re }, api_params) def update_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): + """Update IP address attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' api_params = {} @@ -617,6 +642,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re }, api_params) def create_relationship_attribute(self, database_id: str, collection_id: str, related_collection_id: str, type: RelationshipType, two_way: bool = None, key: str = None, two_way_key: str = None, on_delete: RelationMutate = None): + """Create relationship attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' api_params = {} @@ -647,6 +673,7 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re }, api_params) def create_string_attribute(self, database_id: str, collection_id: str, key: str, size: float, required: bool, default: str = None, array: bool = None, encrypt: bool = None): + """Create string attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' api_params = {} @@ -680,6 +707,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str }, api_params) def update_string_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, size: float = None, new_key: str = None): + """Update string attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' api_params = {} @@ -709,6 +737,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str }, api_params) def create_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None): + """Create URL attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' api_params = {} @@ -737,6 +766,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r }, api_params) def update_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None): + """Update URL attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' api_params = {} @@ -765,6 +795,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r }, api_params) def get_attribute(self, database_id: str, collection_id: str, key: str): + """Get attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} @@ -787,6 +818,7 @@ def get_attribute(self, database_id: str, collection_id: str, key: str): }, api_params) def delete_attribute(self, database_id: str, collection_id: str, key: str): + """Delete attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} @@ -809,6 +841,7 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str): }, api_params) def update_relationship_attribute(self, database_id: str, collection_id: str, key: str, on_delete: RelationMutate = None, new_key: str = None): + """Update relationship attribute""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' api_params = {} @@ -832,7 +865,8 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke 'content-type': 'application/json', }, api_params) - def list_documents(self, database_id: str, collection_id: str, queries: list = None): + def list_documents(self, database_id: str, collection_id: str, queries: list[str] = None): + """List documents""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} @@ -851,7 +885,8 @@ def list_documents(self, database_id: str, collection_id: str, queries: list = N 'content-type': 'application/json', }, api_params) - def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: list = None): + def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: list[str] = None): + """Create document""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} @@ -878,7 +913,8 @@ def create_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) - def get_document(self, database_id: str, collection_id: str, document_id: str, queries: list = None): + def get_document(self, database_id: str, collection_id: str, document_id: str, queries: list[str] = None): + """Get document""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -901,7 +937,8 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q 'content-type': 'application/json', }, api_params) - def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: list = None): + def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: list[str] = None): + """Update document""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -926,6 +963,7 @@ def update_document(self, database_id: str, collection_id: str, document_id: str }, api_params) def delete_document(self, database_id: str, collection_id: str, document_id: str): + """Delete document""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -947,7 +985,8 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) - def list_indexes(self, database_id: str, collection_id: str, queries: list = None): + def list_indexes(self, database_id: str, collection_id: str, queries: list[str] = None): + """List indexes""" api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} @@ -966,7 +1005,8 @@ def list_indexes(self, database_id: str, collection_id: str, queries: list = Non 'content-type': 'application/json', }, api_params) - def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: list, orders: list = None): + def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: list[str], orders: list[str] = None): + """Create index""" api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} @@ -998,6 +1038,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind }, api_params) def get_index(self, database_id: str, collection_id: str, key: str): + """Get index""" api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} @@ -1020,6 +1061,7 @@ def get_index(self, database_id: str, collection_id: str, key: str): }, api_params) def delete_index(self, database_id: str, collection_id: str, key: str): + """Delete index""" api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 326171c..6eb8bad 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -9,7 +9,8 @@ class Functions(Service): def __init__(self, client): super(Functions, self).__init__(client) - def list(self, queries: list = None, search: str = None): + def list(self, queries: list[str] = None, search: str = None): + """List functions""" api_path = '/functions' api_params = {} @@ -21,7 +22,8 @@ def list(self, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, function_id: str, name: str, runtime: Runtime, execute: list = None, events: list = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None): + def create(self, function_id: str, name: str, runtime: Runtime, execute: list[str] = None, events: list[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, template_repository: str = None, template_owner: str = None, template_root_directory: str = None, template_version: str = None, specification: str = None): + """Create function""" api_path = '/functions' api_params = {} @@ -63,6 +65,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: list = }, api_params) def list_runtimes(self): + """List runtimes""" api_path = '/functions/runtimes' api_params = {} @@ -72,6 +75,7 @@ def list_runtimes(self): }, api_params) def list_specifications(self): + """List available function runtime specifications""" api_path = '/functions/specifications' api_params = {} @@ -81,6 +85,7 @@ def list_specifications(self): }, api_params) def get(self, function_id: str): + """Get function""" api_path = '/functions/{functionId}' api_params = {} @@ -94,7 +99,8 @@ def get(self, function_id: str): 'content-type': 'application/json', }, api_params) - def update(self, function_id: str, name: str, runtime: Runtime = None, execute: list = None, events: list = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None): + def update(self, function_id: str, name: str, runtime: Runtime = None, execute: list[str] = None, events: list[str] = None, schedule: str = None, timeout: float = None, enabled: bool = None, logging: bool = None, entrypoint: str = None, commands: str = None, scopes: list[str] = None, installation_id: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None): + """Update function""" api_path = '/functions/{functionId}' api_params = {} @@ -129,6 +135,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: }, api_params) def delete(self, function_id: str): + """Delete function""" api_path = '/functions/{functionId}' api_params = {} @@ -142,7 +149,8 @@ def delete(self, function_id: str): 'content-type': 'application/json', }, api_params) - def list_deployments(self, function_id: str, queries: list = None, search: str = None): + def list_deployments(self, function_id: str, queries: list[str] = None, search: str = None): + """List deployments""" api_path = '/functions/{functionId}/deployments' api_params = {} @@ -159,6 +167,7 @@ def list_deployments(self, function_id: str, queries: list = None, search: str = }, api_params) def create_deployment(self, function_id: str, code: InputFile, activate: bool, entrypoint: str = None, commands: str = None, on_progress = None): + """Create deployment""" api_path = '/functions/{functionId}/deployments' api_params = {} @@ -188,6 +197,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e }, api_params, param_name, on_progress, upload_id) def get_deployment(self, function_id: str, deployment_id: str): + """Get deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -206,6 +216,7 @@ def get_deployment(self, function_id: str, deployment_id: str): }, api_params) def update_deployment(self, function_id: str, deployment_id: str): + """Update deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -224,6 +235,7 @@ def update_deployment(self, function_id: str, deployment_id: str): }, api_params) def delete_deployment(self, function_id: str, deployment_id: str): + """Delete deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -242,6 +254,7 @@ def delete_deployment(self, function_id: str, deployment_id: str): }, api_params) def create_build(self, function_id: str, deployment_id: str, build_id: str = None): + """Rebuild deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} @@ -261,6 +274,7 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non }, api_params) def update_deployment_build(self, function_id: str, deployment_id: str): + """Cancel deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} @@ -279,6 +293,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str): }, api_params) def get_deployment_download(self, function_id: str, deployment_id: str): + """Download deployment""" api_path = '/functions/{functionId}/deployments/{deploymentId}/download' api_params = {} @@ -296,7 +311,8 @@ def get_deployment_download(self, function_id: str, deployment_id: str): 'content-type': 'application/json', }, api_params) - def list_executions(self, function_id: str, queries: list = None, search: str = None): + def list_executions(self, function_id: str, queries: list[str] = None, search: str = None): + """List executions""" api_path = '/functions/{functionId}/executions' api_params = {} @@ -313,6 +329,7 @@ def list_executions(self, function_id: str, queries: list = None, search: str = }, api_params) def create_execution(self, function_id: str, body: str = None, xasync: bool = None, path: str = None, method: ExecutionMethod = None, headers: dict = None, scheduled_at: str = None): + """Create execution""" api_path = '/functions/{functionId}/executions' api_params = {} @@ -333,6 +350,7 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No }, api_params) def get_execution(self, function_id: str, execution_id: str): + """Get execution""" api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} @@ -351,6 +369,7 @@ def get_execution(self, function_id: str, execution_id: str): }, api_params) def delete_execution(self, function_id: str, execution_id: str): + """Delete execution""" api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} @@ -369,6 +388,7 @@ def delete_execution(self, function_id: str, execution_id: str): }, api_params) def list_variables(self, function_id: str): + """List variables""" api_path = '/functions/{functionId}/variables' api_params = {} @@ -383,6 +403,7 @@ def list_variables(self, function_id: str): }, api_params) def create_variable(self, function_id: str, key: str, value: str): + """Create variable""" api_path = '/functions/{functionId}/variables' api_params = {} @@ -405,6 +426,7 @@ def create_variable(self, function_id: str, key: str, value: str): }, api_params) def get_variable(self, function_id: str, variable_id: str): + """Get variable""" api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} @@ -423,6 +445,7 @@ def get_variable(self, function_id: str, variable_id: str): }, api_params) def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None): + """Update variable""" api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} @@ -446,6 +469,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s }, api_params) def delete_variable(self, function_id: str, variable_id: str): + """Delete variable""" api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 7d58b9e..41421bb 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -7,6 +7,7 @@ def __init__(self, client): super(Graphql, self).__init__(client) def query(self, query: dict): + """GraphQL endpoint""" api_path = '/graphql' api_params = {} @@ -22,6 +23,7 @@ def query(self, query: dict): }, api_params) def mutation(self, query: dict): + """GraphQL endpoint""" api_path = '/graphql/mutation' api_params = {} diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 5be5d32..d87dc57 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -8,6 +8,7 @@ def __init__(self, client): super(Health, self).__init__(client) def get(self): + """Get HTTP""" api_path = '/health' api_params = {} @@ -17,6 +18,7 @@ def get(self): }, api_params) def get_antivirus(self): + """Get antivirus""" api_path = '/health/anti-virus' api_params = {} @@ -26,6 +28,7 @@ def get_antivirus(self): }, api_params) def get_cache(self): + """Get cache""" api_path = '/health/cache' api_params = {} @@ -35,6 +38,7 @@ def get_cache(self): }, api_params) def get_certificate(self, domain: str = None): + """Get the SSL certificate for a domain""" api_path = '/health/certificate' api_params = {} @@ -46,6 +50,7 @@ def get_certificate(self, domain: str = None): }, api_params) def get_db(self): + """Get DB""" api_path = '/health/db' api_params = {} @@ -55,6 +60,7 @@ def get_db(self): }, api_params) def get_pub_sub(self): + """Get pubsub""" api_path = '/health/pubsub' api_params = {} @@ -64,6 +70,7 @@ def get_pub_sub(self): }, api_params) def get_queue_builds(self, threshold: float = None): + """Get builds queue""" api_path = '/health/queue/builds' api_params = {} @@ -75,6 +82,7 @@ def get_queue_builds(self, threshold: float = None): }, api_params) def get_queue_certificates(self, threshold: float = None): + """Get certificates queue""" api_path = '/health/queue/certificates' api_params = {} @@ -86,6 +94,7 @@ def get_queue_certificates(self, threshold: float = None): }, api_params) def get_queue_databases(self, name: str = None, threshold: float = None): + """Get databases queue""" api_path = '/health/queue/databases' api_params = {} @@ -98,6 +107,7 @@ def get_queue_databases(self, name: str = None, threshold: float = None): }, api_params) def get_queue_deletes(self, threshold: float = None): + """Get deletes queue""" api_path = '/health/queue/deletes' api_params = {} @@ -109,6 +119,7 @@ def get_queue_deletes(self, threshold: float = None): }, api_params) def get_failed_jobs(self, name: Name, threshold: float = None): + """Get number of failed queue jobs""" api_path = '/health/queue/failed/{name}' api_params = {} @@ -124,6 +135,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None): }, api_params) def get_queue_functions(self, threshold: float = None): + """Get functions queue""" api_path = '/health/queue/functions' api_params = {} @@ -135,6 +147,7 @@ def get_queue_functions(self, threshold: float = None): }, api_params) def get_queue_logs(self, threshold: float = None): + """Get logs queue""" api_path = '/health/queue/logs' api_params = {} @@ -146,6 +159,7 @@ def get_queue_logs(self, threshold: float = None): }, api_params) def get_queue_mails(self, threshold: float = None): + """Get mails queue""" api_path = '/health/queue/mails' api_params = {} @@ -157,6 +171,7 @@ def get_queue_mails(self, threshold: float = None): }, api_params) def get_queue_messaging(self, threshold: float = None): + """Get messaging queue""" api_path = '/health/queue/messaging' api_params = {} @@ -168,6 +183,7 @@ def get_queue_messaging(self, threshold: float = None): }, api_params) def get_queue_migrations(self, threshold: float = None): + """Get migrations queue""" api_path = '/health/queue/migrations' api_params = {} @@ -179,6 +195,7 @@ def get_queue_migrations(self, threshold: float = None): }, api_params) def get_queue_stats_resources(self, threshold: float = None): + """Get stats resources queue""" api_path = '/health/queue/stats-resources' api_params = {} @@ -190,6 +207,7 @@ def get_queue_stats_resources(self, threshold: float = None): }, api_params) def get_queue_usage(self, threshold: float = None): + """Get stats usage queue""" api_path = '/health/queue/stats-usage' api_params = {} @@ -201,6 +219,7 @@ def get_queue_usage(self, threshold: float = None): }, api_params) def get_queue_stats_usage_dump(self, threshold: float = None): + """Get usage dump queue""" api_path = '/health/queue/stats-usage-dump' api_params = {} @@ -212,6 +231,7 @@ def get_queue_stats_usage_dump(self, threshold: float = None): }, api_params) def get_queue_webhooks(self, threshold: float = None): + """Get webhooks queue""" api_path = '/health/queue/webhooks' api_params = {} @@ -223,6 +243,7 @@ def get_queue_webhooks(self, threshold: float = None): }, api_params) def get_storage(self): + """Get storage""" api_path = '/health/storage' api_params = {} @@ -232,6 +253,7 @@ def get_storage(self): }, api_params) def get_storage_local(self): + """Get local storage""" api_path = '/health/storage/local' api_params = {} @@ -241,6 +263,7 @@ def get_storage_local(self): }, api_params) def get_time(self): + """Get time""" api_path = '/health/time' api_params = {} diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index e77cd93..6a8f007 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -7,6 +7,7 @@ def __init__(self, client): super(Locale, self).__init__(client) def get(self): + """Get user locale""" api_path = '/locale' api_params = {} @@ -16,6 +17,7 @@ def get(self): }, api_params) def list_codes(self): + """List locale codes""" api_path = '/locale/codes' api_params = {} @@ -25,6 +27,7 @@ def list_codes(self): }, api_params) def list_continents(self): + """List continents""" api_path = '/locale/continents' api_params = {} @@ -34,6 +37,7 @@ def list_continents(self): }, api_params) def list_countries(self): + """List countries""" api_path = '/locale/countries' api_params = {} @@ -43,6 +47,7 @@ def list_countries(self): }, api_params) def list_countries_eu(self): + """List EU countries""" api_path = '/locale/countries/eu' api_params = {} @@ -52,6 +57,7 @@ def list_countries_eu(self): }, api_params) def list_countries_phones(self): + """List countries phone codes""" api_path = '/locale/countries/phones' api_params = {} @@ -61,6 +67,7 @@ def list_countries_phones(self): }, api_params) def list_currencies(self): + """List currencies""" api_path = '/locale/currencies' api_params = {} @@ -70,6 +77,7 @@ def list_currencies(self): }, api_params) def list_languages(self): + """List languages""" api_path = '/locale/languages' api_params = {} diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index b62a706..f344b9f 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -8,7 +8,8 @@ class Messaging(Service): def __init__(self, client): super(Messaging, self).__init__(client) - def list_messages(self, queries: list = None, search: str = None): + def list_messages(self, queries: list[str] = None, search: str = None): + """List messages""" api_path = '/messaging/messages' api_params = {} @@ -20,7 +21,8 @@ def list_messages(self, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_email(self, message_id: str, subject: str, content: str, topics: list = None, users: list = None, targets: list = None, cc: list = None, bcc: list = None, attachments: list = None, draft: bool = None, html: bool = None, scheduled_at: str = None): + def create_email(self, message_id: str, subject: str, content: str, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, cc: list[str] = None, bcc: list[str] = None, attachments: list[str] = None, draft: bool = None, html: bool = None, scheduled_at: str = None): + """Create email""" api_path = '/messaging/messages/email' api_params = {} @@ -51,7 +53,8 @@ def create_email(self, message_id: str, subject: str, content: str, topics: list 'content-type': 'application/json', }, api_params) - def update_email(self, message_id: str, topics: list = None, users: list = None, targets: list = None, subject: str = None, content: str = None, draft: bool = None, html: bool = None, cc: list = None, bcc: list = None, scheduled_at: str = None, attachments: list = None): + def update_email(self, message_id: str, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, subject: str = None, content: str = None, draft: bool = None, html: bool = None, cc: list[str] = None, bcc: list[str] = None, scheduled_at: str = None, attachments: list[str] = None): + """Update email""" api_path = '/messaging/messages/email/{messageId}' api_params = {} @@ -76,7 +79,8 @@ def update_email(self, message_id: str, topics: list = None, users: list = None, 'content-type': 'application/json', }, api_params) - def create_push(self, message_id: str, title: str = None, body: str = None, topics: list = None, users: list = None, targets: list = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): + def create_push(self, message_id: str, title: str = None, body: str = None, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): + """Create push notification""" api_path = '/messaging/messages/push' api_params = {} @@ -108,7 +112,8 @@ def create_push(self, message_id: str, title: str = None, body: str = None, topi 'content-type': 'application/json', }, api_params) - def update_push(self, message_id: str, topics: list = None, users: list = None, targets: list = None, title: str = None, body: str = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): + def update_push(self, message_id: str, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, title: str = None, body: str = None, data: dict = None, action: str = None, image: str = None, icon: str = None, sound: str = None, color: str = None, tag: str = None, badge: float = None, draft: bool = None, scheduled_at: str = None, content_available: bool = None, critical: bool = None, priority: MessagePriority = None): + """Update push notification""" api_path = '/messaging/messages/push/{messageId}' api_params = {} @@ -140,7 +145,8 @@ def update_push(self, message_id: str, topics: list = None, users: list = None, 'content-type': 'application/json', }, api_params) - def create_sms(self, message_id: str, content: str, topics: list = None, users: list = None, targets: list = None, draft: bool = None, scheduled_at: str = None): + def create_sms(self, message_id: str, content: str, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, draft: bool = None, scheduled_at: str = None): + """Create SMS""" api_path = '/messaging/messages/sms' api_params = {} @@ -163,7 +169,8 @@ def create_sms(self, message_id: str, content: str, topics: list = None, users: 'content-type': 'application/json', }, api_params) - def update_sms(self, message_id: str, topics: list = None, users: list = None, targets: list = None, content: str = None, draft: bool = None, scheduled_at: str = None): + def update_sms(self, message_id: str, topics: list[str] = None, users: list[str] = None, targets: list[str] = None, content: str = None, draft: bool = None, scheduled_at: str = None): + """Update SMS""" api_path = '/messaging/messages/sms/{messageId}' api_params = {} @@ -184,6 +191,7 @@ def update_sms(self, message_id: str, topics: list = None, users: list = None, t }, api_params) def get_message(self, message_id: str): + """Get message""" api_path = '/messaging/messages/{messageId}' api_params = {} @@ -198,6 +206,7 @@ def get_message(self, message_id: str): }, api_params) def delete(self, message_id: str): + """Delete message""" api_path = '/messaging/messages/{messageId}' api_params = {} @@ -211,7 +220,8 @@ def delete(self, message_id: str): 'content-type': 'application/json', }, api_params) - def list_message_logs(self, message_id: str, queries: list = None): + def list_message_logs(self, message_id: str, queries: list[str] = None): + """List message logs""" api_path = '/messaging/messages/{messageId}/logs' api_params = {} @@ -226,7 +236,8 @@ def list_message_logs(self, message_id: str, queries: list = None): 'content-type': 'application/json', }, api_params) - def list_targets(self, message_id: str, queries: list = None): + def list_targets(self, message_id: str, queries: list[str] = None): + """List message targets""" api_path = '/messaging/messages/{messageId}/targets' api_params = {} @@ -241,7 +252,8 @@ def list_targets(self, message_id: str, queries: list = None): 'content-type': 'application/json', }, api_params) - def list_providers(self, queries: list = None, search: str = None): + def list_providers(self, queries: list[str] = None, search: str = None): + """List providers""" api_path = '/messaging/providers' api_params = {} @@ -254,6 +266,7 @@ def list_providers(self, queries: list = None, search: str = None): }, api_params) def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None, auth_key_id: str = None, team_id: str = None, bundle_id: str = None, sandbox: bool = None, enabled: bool = None): + """Create APNS provider""" api_path = '/messaging/providers/apns' api_params = {} @@ -278,6 +291,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None }, api_params) def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool = None, auth_key: str = None, auth_key_id: str = None, team_id: str = None, bundle_id: str = None, sandbox: bool = None): + """Update APNS provider""" api_path = '/messaging/providers/apns/{providerId}' api_params = {} @@ -299,6 +313,7 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool }, api_params) def create_fcm_provider(self, provider_id: str, name: str, service_account_json: dict = None, enabled: bool = None): + """Create FCM provider""" api_path = '/messaging/providers/fcm' api_params = {} @@ -319,6 +334,7 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: }, api_params) def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool = None, service_account_json: dict = None): + """Update FCM provider""" api_path = '/messaging/providers/fcm/{providerId}' api_params = {} @@ -336,6 +352,7 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool }, api_params) def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = None, domain: str = None, is_eu_region: bool = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): + """Create Mailgun provider""" api_path = '/messaging/providers/mailgun' api_params = {} @@ -362,6 +379,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No }, api_params) def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: str = None, domain: str = None, is_eu_region: bool = None, enabled: bool = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None): + """Update Mailgun provider""" api_path = '/messaging/providers/mailgun/{providerId}' api_params = {} @@ -385,6 +403,7 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s }, api_params) def create_msg91_provider(self, provider_id: str, name: str, template_id: str = None, sender_id: str = None, auth_key: str = None, enabled: bool = None): + """Create Msg91 provider""" api_path = '/messaging/providers/msg91' api_params = {} @@ -407,6 +426,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = }, api_params) def update_msg91_provider(self, provider_id: str, name: str = None, enabled: bool = None, template_id: str = None, sender_id: str = None, auth_key: str = None): + """Update Msg91 provider""" api_path = '/messaging/providers/msg91/{providerId}' api_params = {} @@ -426,6 +446,7 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo }, api_params) def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): + """Create Sendgrid provider""" api_path = '/messaging/providers/sendgrid' api_params = {} @@ -450,6 +471,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N }, api_params) def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: bool = None, api_key: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None): + """Update Sendgrid provider""" api_path = '/messaging/providers/sendgrid/{providerId}' api_params = {} @@ -471,6 +493,7 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: }, api_params) def create_smtp_provider(self, provider_id: str, name: str, host: str, port: float = None, username: str = None, password: str = None, encryption: SmtpEncryption = None, auto_tls: bool = None, mailer: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): + """Create SMTP provider""" api_path = '/messaging/providers/smtp' api_params = {} @@ -504,6 +527,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo }, api_params) def update_smtp_provider(self, provider_id: str, name: str = None, host: str = None, port: float = None, username: str = None, password: str = None, encryption: SmtpEncryption = None, auto_tls: bool = None, mailer: str = None, from_name: str = None, from_email: str = None, reply_to_name: str = None, reply_to_email: str = None, enabled: bool = None): + """Update SMTP provider""" api_path = '/messaging/providers/smtp/{providerId}' api_params = {} @@ -531,6 +555,7 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N }, api_params) def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = None, customer_id: str = None, api_key: str = None, enabled: bool = None): + """Create Telesign provider""" api_path = '/messaging/providers/telesign' api_params = {} @@ -553,6 +578,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non }, api_params) def update_telesign_provider(self, provider_id: str, name: str = None, enabled: bool = None, customer_id: str = None, api_key: str = None, xfrom: str = None): + """Update Telesign provider""" api_path = '/messaging/providers/telesign/{providerId}' api_params = {} @@ -572,6 +598,7 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: }, api_params) def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = None, username: str = None, api_key: str = None, enabled: bool = None): + """Create Textmagic provider""" api_path = '/messaging/providers/textmagic' api_params = {} @@ -594,6 +621,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No }, api_params) def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: bool = None, username: str = None, api_key: str = None, xfrom: str = None): + """Update Textmagic provider""" api_path = '/messaging/providers/textmagic/{providerId}' api_params = {} @@ -613,6 +641,7 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: }, api_params) def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, account_sid: str = None, auth_token: str = None, enabled: bool = None): + """Create Twilio provider""" api_path = '/messaging/providers/twilio' api_params = {} @@ -635,6 +664,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, }, api_params) def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bool = None, account_sid: str = None, auth_token: str = None, xfrom: str = None): + """Update Twilio provider""" api_path = '/messaging/providers/twilio/{providerId}' api_params = {} @@ -654,6 +684,7 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo }, api_params) def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, api_key: str = None, api_secret: str = None, enabled: bool = None): + """Create Vonage provider""" api_path = '/messaging/providers/vonage' api_params = {} @@ -676,6 +707,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, }, api_params) def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bool = None, api_key: str = None, api_secret: str = None, xfrom: str = None): + """Update Vonage provider""" api_path = '/messaging/providers/vonage/{providerId}' api_params = {} @@ -695,6 +727,7 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo }, api_params) def get_provider(self, provider_id: str): + """Get provider""" api_path = '/messaging/providers/{providerId}' api_params = {} @@ -709,6 +742,7 @@ def get_provider(self, provider_id: str): }, api_params) def delete_provider(self, provider_id: str): + """Delete provider""" api_path = '/messaging/providers/{providerId}' api_params = {} @@ -722,7 +756,8 @@ def delete_provider(self, provider_id: str): 'content-type': 'application/json', }, api_params) - def list_provider_logs(self, provider_id: str, queries: list = None): + def list_provider_logs(self, provider_id: str, queries: list[str] = None): + """List provider logs""" api_path = '/messaging/providers/{providerId}/logs' api_params = {} @@ -737,7 +772,8 @@ def list_provider_logs(self, provider_id: str, queries: list = None): 'content-type': 'application/json', }, api_params) - def list_subscriber_logs(self, subscriber_id: str, queries: list = None): + def list_subscriber_logs(self, subscriber_id: str, queries: list[str] = None): + """List subscriber logs""" api_path = '/messaging/subscribers/{subscriberId}/logs' api_params = {} @@ -752,7 +788,8 @@ def list_subscriber_logs(self, subscriber_id: str, queries: list = None): 'content-type': 'application/json', }, api_params) - def list_topics(self, queries: list = None, search: str = None): + def list_topics(self, queries: list[str] = None, search: str = None): + """List topics""" api_path = '/messaging/topics' api_params = {} @@ -764,7 +801,8 @@ def list_topics(self, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_topic(self, topic_id: str, name: str, subscribe: list = None): + def create_topic(self, topic_id: str, name: str, subscribe: list[str] = None): + """Create topic""" api_path = '/messaging/topics' api_params = {} @@ -784,6 +822,7 @@ def create_topic(self, topic_id: str, name: str, subscribe: list = None): }, api_params) def get_topic(self, topic_id: str): + """Get topic""" api_path = '/messaging/topics/{topicId}' api_params = {} @@ -797,7 +836,8 @@ def get_topic(self, topic_id: str): 'content-type': 'application/json', }, api_params) - def update_topic(self, topic_id: str, name: str = None, subscribe: list = None): + def update_topic(self, topic_id: str, name: str = None, subscribe: list[str] = None): + """Update topic""" api_path = '/messaging/topics/{topicId}' api_params = {} @@ -814,6 +854,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: list = None): }, api_params) def delete_topic(self, topic_id: str): + """Delete topic""" api_path = '/messaging/topics/{topicId}' api_params = {} @@ -827,7 +868,8 @@ def delete_topic(self, topic_id: str): 'content-type': 'application/json', }, api_params) - def list_topic_logs(self, topic_id: str, queries: list = None): + def list_topic_logs(self, topic_id: str, queries: list[str] = None): + """List topic logs""" api_path = '/messaging/topics/{topicId}/logs' api_params = {} @@ -842,7 +884,8 @@ def list_topic_logs(self, topic_id: str, queries: list = None): 'content-type': 'application/json', }, api_params) - def list_subscribers(self, topic_id: str, queries: list = None, search: str = None): + def list_subscribers(self, topic_id: str, queries: list[str] = None, search: str = None): + """List subscribers""" api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} @@ -859,6 +902,7 @@ def list_subscribers(self, topic_id: str, queries: list = None, search: str = No }, api_params) def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str): + """Create subscriber""" api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} @@ -881,6 +925,7 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str): }, api_params) def get_subscriber(self, topic_id: str, subscriber_id: str): + """Get subscriber""" api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} @@ -899,6 +944,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str): }, api_params) def delete_subscriber(self, topic_id: str, subscriber_id: str): + """Delete subscriber""" api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 0e57cfe..dc30df5 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -10,7 +10,8 @@ class Storage(Service): def __init__(self, client): super(Storage, self).__init__(client) - def list_buckets(self, queries: list = None, search: str = None): + def list_buckets(self, queries: list[str] = None, search: str = None): + """List buckets""" api_path = '/storage/buckets' api_params = {} @@ -22,7 +23,8 @@ def list_buckets(self, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_bucket(self, bucket_id: str, name: str, permissions: list = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): + def create_bucket(self, bucket_id: str, name: str, permissions: list[str] = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list[str] = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): + """Create bucket""" api_path = '/storage/buckets' api_params = {} @@ -49,6 +51,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: list = None, fil }, api_params) def get_bucket(self, bucket_id: str): + """Get bucket""" api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -62,7 +65,8 @@ def get_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - def update_bucket(self, bucket_id: str, name: str, permissions: list = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): + def update_bucket(self, bucket_id: str, name: str, permissions: list[str] = None, file_security: bool = None, enabled: bool = None, maximum_file_size: float = None, allowed_file_extensions: list[str] = None, compression: Compression = None, encryption: bool = None, antivirus: bool = None): + """Update bucket""" api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -89,6 +93,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: list = None, fil }, api_params) def delete_bucket(self, bucket_id: str): + """Delete bucket""" api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -102,7 +107,8 @@ def delete_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - def list_files(self, bucket_id: str, queries: list = None, search: str = None): + def list_files(self, bucket_id: str, queries: list[str] = None, search: str = None): + """List files""" api_path = '/storage/buckets/{bucketId}/files' api_params = {} @@ -118,7 +124,8 @@ def list_files(self, bucket_id: str, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: list = None, on_progress = None): + def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: list[str] = None, on_progress = None): + """Create file""" api_path = '/storage/buckets/{bucketId}/files' api_params = {} @@ -148,6 +155,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions }, api_params, param_name, on_progress, upload_id) def get_file(self, bucket_id: str, file_id: str): + """Get file""" api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -165,7 +173,8 @@ def get_file(self, bucket_id: str, file_id: str): 'content-type': 'application/json', }, api_params) - def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: list = None): + def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: list[str] = None): + """Update file""" api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -186,6 +195,7 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission }, api_params) def delete_file(self, bucket_id: str, file_id: str): + """Delete file""" api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -204,6 +214,7 @@ def delete_file(self, bucket_id: str, file_id: str): }, api_params) def get_file_download(self, bucket_id: str, file_id: str): + """Get file for download""" api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' api_params = {} @@ -222,6 +233,7 @@ def get_file_download(self, bucket_id: str, file_id: str): }, api_params) def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, height: float = None, gravity: ImageGravity = None, quality: float = None, border_width: float = None, border_color: str = None, border_radius: float = None, opacity: float = None, rotation: float = None, background: str = None, output: ImageFormat = None): + """Get file preview""" api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' api_params = {} @@ -251,6 +263,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he }, api_params) def get_file_view(self, bucket_id: str, file_id: str): + """Get file for view""" api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' api_params = {} diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 988bf3c..f157768 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -6,7 +6,8 @@ class Teams(Service): def __init__(self, client): super(Teams, self).__init__(client) - def list(self, queries: list = None, search: str = None): + def list(self, queries: list[str] = None, search: str = None): + """List teams""" api_path = '/teams' api_params = {} @@ -18,7 +19,8 @@ def list(self, queries: list = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, team_id: str, name: str, roles: list = None): + def create(self, team_id: str, name: str, roles: list[str] = None): + """Create team""" api_path = '/teams' api_params = {} @@ -38,6 +40,7 @@ def create(self, team_id: str, name: str, roles: list = None): }, api_params) def get(self, team_id: str): + """Get team""" api_path = '/teams/{teamId}' api_params = {} @@ -52,6 +55,7 @@ def get(self, team_id: str): }, api_params) def update_name(self, team_id: str, name: str): + """Update name""" api_path = '/teams/{teamId}' api_params = {} @@ -70,6 +74,7 @@ def update_name(self, team_id: str, name: str): }, api_params) def delete(self, team_id: str): + """Delete team""" api_path = '/teams/{teamId}' api_params = {} @@ -83,7 +88,8 @@ def delete(self, team_id: str): 'content-type': 'application/json', }, api_params) - def list_memberships(self, team_id: str, queries: list = None, search: str = None): + def list_memberships(self, team_id: str, queries: list[str] = None, search: str = None): + """List team memberships""" api_path = '/teams/{teamId}/memberships' api_params = {} @@ -99,7 +105,8 @@ def list_memberships(self, team_id: str, queries: list = None, search: str = Non 'content-type': 'application/json', }, api_params) - def create_membership(self, team_id: str, roles: list, email: str = None, user_id: str = None, phone: str = None, url: str = None, name: str = None): + def create_membership(self, team_id: str, roles: list[str], email: str = None, user_id: str = None, phone: str = None, url: str = None, name: str = None): + """Create team membership""" api_path = '/teams/{teamId}/memberships' api_params = {} @@ -123,6 +130,7 @@ def create_membership(self, team_id: str, roles: list, email: str = None, user_i }, api_params) def get_membership(self, team_id: str, membership_id: str): + """Get team membership""" api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -140,7 +148,8 @@ def get_membership(self, team_id: str, membership_id: str): 'content-type': 'application/json', }, api_params) - def update_membership(self, team_id: str, membership_id: str, roles: list): + def update_membership(self, team_id: str, membership_id: str, roles: list[str]): + """Update membership""" api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -163,6 +172,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: list): }, api_params) def delete_membership(self, team_id: str, membership_id: str): + """Delete team membership""" api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -181,6 +191,7 @@ def delete_membership(self, team_id: str, membership_id: str): }, api_params) def update_membership_status(self, team_id: str, membership_id: str, user_id: str, secret: str): + """Update team membership status""" api_path = '/teams/{teamId}/memberships/{membershipId}/status' api_params = {} @@ -207,6 +218,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st }, api_params) def get_prefs(self, team_id: str): + """Get team preferences""" api_path = '/teams/{teamId}/prefs' api_params = {} @@ -221,6 +233,7 @@ def get_prefs(self, team_id: str): }, api_params) def update_prefs(self, team_id: str, prefs: dict): + """Update preferences""" api_path = '/teams/{teamId}/prefs' api_params = {} diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 1a141db..6ed17ee 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -9,7 +9,8 @@ class Users(Service): def __init__(self, client): super(Users, self).__init__(client) - def list(self, queries: list = None, search: str = None): + def list(self, queries: list[str] = None, search: str = None): + """List users""" api_path = '/users' api_params = {} @@ -22,6 +23,7 @@ def list(self, queries: list = None, search: str = None): }, api_params) def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None): + """Create user""" api_path = '/users' api_params = {} @@ -40,6 +42,7 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s }, api_params) def create_argon2_user(self, user_id: str, email: str, password: str, name: str = None): + """Create user with Argon2 password""" api_path = '/users/argon2' api_params = {} @@ -63,6 +66,7 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str }, api_params) def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str = None): + """Create user with bcrypt password""" api_path = '/users/bcrypt' api_params = {} @@ -85,7 +89,8 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: list = None, search: str = None): + def list_identities(self, queries: list[str] = None, search: str = None): + """List identities""" api_path = '/users/identities' api_params = {} @@ -98,6 +103,7 @@ def list_identities(self, queries: list = None, search: str = None): }, api_params) def delete_identity(self, identity_id: str): + """Delete identity""" api_path = '/users/identities/{identityId}' api_params = {} @@ -112,6 +118,7 @@ def delete_identity(self, identity_id: str): }, api_params) def create_md5_user(self, user_id: str, email: str, password: str, name: str = None): + """Create user with MD5 password""" api_path = '/users/md5' api_params = {} @@ -135,6 +142,7 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N }, api_params) def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str = None): + """Create user with PHPass password""" api_path = '/users/phpass' api_params = {} @@ -158,6 +166,7 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str }, api_params) def create_scrypt_user(self, user_id: str, email: str, password: str, password_salt: str, password_cpu: float, password_memory: float, password_parallel: float, password_length: float, name: str = None): + """Create user with Scrypt password""" api_path = '/users/scrypt' api_params = {} @@ -201,6 +210,7 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s }, api_params) def create_scrypt_modified_user(self, user_id: str, email: str, password: str, password_salt: str, password_salt_separator: str, password_signer_key: str, name: str = None): + """Create user with Scrypt modified password""" api_path = '/users/scrypt-modified' api_params = {} @@ -236,6 +246,7 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p }, api_params) def create_sha_user(self, user_id: str, email: str, password: str, password_version: PasswordHash = None, name: str = None): + """Create user with SHA password""" api_path = '/users/sha' api_params = {} @@ -260,6 +271,7 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers }, api_params) def get(self, user_id: str): + """Get user""" api_path = '/users/{userId}' api_params = {} @@ -274,6 +286,7 @@ def get(self, user_id: str): }, api_params) def delete(self, user_id: str): + """Delete user""" api_path = '/users/{userId}' api_params = {} @@ -288,6 +301,7 @@ def delete(self, user_id: str): }, api_params) def update_email(self, user_id: str, email: str): + """Update email""" api_path = '/users/{userId}/email' api_params = {} @@ -306,6 +320,7 @@ def update_email(self, user_id: str, email: str): }, api_params) def create_jwt(self, user_id: str, session_id: str = None, duration: float = None): + """Create user JWT""" api_path = '/users/{userId}/jwts' api_params = {} @@ -321,7 +336,8 @@ def create_jwt(self, user_id: str, session_id: str = None, duration: float = Non 'content-type': 'application/json', }, api_params) - def update_labels(self, user_id: str, labels: list): + def update_labels(self, user_id: str, labels: list[str]): + """Update user labels""" api_path = '/users/{userId}/labels' api_params = {} @@ -339,7 +355,8 @@ def update_labels(self, user_id: str, labels: list): 'content-type': 'application/json', }, api_params) - def list_logs(self, user_id: str, queries: list = None): + def list_logs(self, user_id: str, queries: list[str] = None): + """List user logs""" api_path = '/users/{userId}/logs' api_params = {} @@ -355,6 +372,7 @@ def list_logs(self, user_id: str, queries: list = None): }, api_params) def list_memberships(self, user_id: str): + """List user memberships""" api_path = '/users/{userId}/memberships' api_params = {} @@ -369,6 +387,7 @@ def list_memberships(self, user_id: str): }, api_params) def update_mfa(self, user_id: str, mfa: bool): + """Update MFA""" api_path = '/users/{userId}/mfa' api_params = {} @@ -387,6 +406,7 @@ def update_mfa(self, user_id: str, mfa: bool): }, api_params) def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType): + """Delete authenticator""" api_path = '/users/{userId}/mfa/authenticators/{type}' api_params = {} @@ -405,6 +425,7 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType): }, api_params) def list_mfa_factors(self, user_id: str): + """List factors""" api_path = '/users/{userId}/mfa/factors' api_params = {} @@ -419,6 +440,7 @@ def list_mfa_factors(self, user_id: str): }, api_params) def get_mfa_recovery_codes(self, user_id: str): + """Get MFA recovery codes""" api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -433,6 +455,7 @@ def get_mfa_recovery_codes(self, user_id: str): }, api_params) def update_mfa_recovery_codes(self, user_id: str): + """Regenerate MFA recovery codes""" api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -447,6 +470,7 @@ def update_mfa_recovery_codes(self, user_id: str): }, api_params) def create_mfa_recovery_codes(self, user_id: str): + """Create MFA recovery codes""" api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -461,6 +485,7 @@ def create_mfa_recovery_codes(self, user_id: str): }, api_params) def update_name(self, user_id: str, name: str): + """Update name""" api_path = '/users/{userId}/name' api_params = {} @@ -479,6 +504,7 @@ def update_name(self, user_id: str, name: str): }, api_params) def update_password(self, user_id: str, password: str): + """Update password""" api_path = '/users/{userId}/password' api_params = {} @@ -497,6 +523,7 @@ def update_password(self, user_id: str, password: str): }, api_params) def update_phone(self, user_id: str, number: str): + """Update phone""" api_path = '/users/{userId}/phone' api_params = {} @@ -515,6 +542,7 @@ def update_phone(self, user_id: str, number: str): }, api_params) def get_prefs(self, user_id: str): + """Get user preferences""" api_path = '/users/{userId}/prefs' api_params = {} @@ -529,6 +557,7 @@ def get_prefs(self, user_id: str): }, api_params) def update_prefs(self, user_id: str, prefs: dict): + """Update user preferences""" api_path = '/users/{userId}/prefs' api_params = {} @@ -547,6 +576,7 @@ def update_prefs(self, user_id: str, prefs: dict): }, api_params) def list_sessions(self, user_id: str): + """List user sessions""" api_path = '/users/{userId}/sessions' api_params = {} @@ -561,6 +591,7 @@ def list_sessions(self, user_id: str): }, api_params) def create_session(self, user_id: str): + """Create session""" api_path = '/users/{userId}/sessions' api_params = {} @@ -575,6 +606,7 @@ def create_session(self, user_id: str): }, api_params) def delete_sessions(self, user_id: str): + """Delete user sessions""" api_path = '/users/{userId}/sessions' api_params = {} @@ -589,6 +621,7 @@ def delete_sessions(self, user_id: str): }, api_params) def delete_session(self, user_id: str, session_id: str): + """Delete user session""" api_path = '/users/{userId}/sessions/{sessionId}' api_params = {} @@ -607,6 +640,7 @@ def delete_session(self, user_id: str, session_id: str): }, api_params) def update_status(self, user_id: str, status: bool): + """Update user status""" api_path = '/users/{userId}/status' api_params = {} @@ -624,7 +658,8 @@ def update_status(self, user_id: str, status: bool): 'content-type': 'application/json', }, api_params) - def list_targets(self, user_id: str, queries: list = None): + def list_targets(self, user_id: str, queries: list[str] = None): + """List user targets""" api_path = '/users/{userId}/targets' api_params = {} @@ -640,6 +675,7 @@ def list_targets(self, user_id: str, queries: list = None): }, api_params) def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None): + """Create user target""" api_path = '/users/{userId}/targets' api_params = {} @@ -668,6 +704,7 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr }, api_params) def get_target(self, user_id: str, target_id: str): + """Get user target""" api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -686,6 +723,7 @@ def get_target(self, user_id: str, target_id: str): }, api_params) def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None): + """Update user target""" api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -707,6 +745,7 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr }, api_params) def delete_target(self, user_id: str, target_id: str): + """Delete user target""" api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -725,6 +764,7 @@ def delete_target(self, user_id: str, target_id: str): }, api_params) def create_token(self, user_id: str, length: float = None, expire: float = None): + """Create token""" api_path = '/users/{userId}/tokens' api_params = {} @@ -741,6 +781,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) }, api_params) def update_email_verification(self, user_id: str, email_verification: bool): + """Update email verification""" api_path = '/users/{userId}/verification' api_params = {} @@ -759,6 +800,7 @@ def update_email_verification(self, user_id: str, email_verification: bool): }, api_params) def update_phone_verification(self, user_id: str, phone_verification: bool): + """Update phone verification""" api_path = '/users/{userId}/verification/phone' api_params = {} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy