From 362ea5a6b36f50f539b73c2ca122d37f7f4fd56f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 11 Dec 2024 00:35:40 +1300 Subject: [PATCH 01/24] Add new push message parameters --- README.md | 2 +- appwrite/client.py | 4 ++-- appwrite/encoders/value_class_encoder.py | 4 ++++ appwrite/enums/message_priority.py | 5 +++++ appwrite/enums/runtime.py | 1 + appwrite/services/messaging.py | 16 ++++++++-------- docs/examples/messaging/create-push.md | 11 +++++++---- docs/examples/messaging/update-push.md | 5 ++++- setup.py | 4 ++-- 9 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 appwrite/enums/message_priority.py diff --git a/README.md b/README.md index eb42d99..466c7ac 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite/client.py b/appwrite/client.py index ff48812..f745945 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/7.0.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/6.2.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': '7.0.1', + 'x-sdk-version': '6.2.0', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/appwrite/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index f343add..95b06b7 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -11,6 +11,7 @@ from ..enums.runtime import Runtime from ..enums.execution_method import ExecutionMethod from ..enums.name import Name +from ..enums.message_priority import MessagePriority from ..enums.smtp_encryption import SmtpEncryption from ..enums.compression import Compression from ..enums.image_gravity import ImageGravity @@ -56,6 +57,9 @@ def default(self, o): if isinstance(o, Name): return o.value + if isinstance(o, MessagePriority): + return o.value + if isinstance(o, SmtpEncryption): return o.value diff --git a/appwrite/enums/message_priority.py b/appwrite/enums/message_priority.py new file mode 100644 index 0000000..0010a35 --- /dev/null +++ b/appwrite/enums/message_priority.py @@ -0,0 +1,5 @@ +from enum import Enum + +class MessagePriority(Enum): + NORMAL = "normal" + HIGH = "high" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index db428ef..1485f48 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -59,3 +59,4 @@ class Runtime(Enum): BUN_1_1 = "bun-1.1" GO_1_23 = "go-1.23" STATIC_1 = "static-1" + FLUTTER_3_24 = "flutter-3.24" diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 11e73be..f8ce3bf 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -80,7 +80,7 @@ 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, body, 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): + 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""" @@ -89,12 +89,6 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ if message_id is None: raise AppwriteException('Missing required parameter: "message_id"') - if title is None: - raise AppwriteException('Missing required parameter: "title"') - - if body is None: - raise AppwriteException('Missing required parameter: "body"') - api_params['messageId'] = message_id api_params['title'] = title @@ -112,12 +106,15 @@ def create_push(self, message_id, title, body, topics = None, users = None, targ api_params['badge'] = badge api_params['draft'] = draft api_params['scheduledAt'] = scheduled_at + api_params['contentAvailable'] = content_available + api_params['critical'] = critical + api_params['priority'] = priority return self.client.call('post', api_path, { '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): + 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""" @@ -143,6 +140,9 @@ def update_push(self, message_id, topics = None, users = None, targets = None, t api_params['badge'] = badge api_params['draft'] = draft api_params['scheduledAt'] = scheduled_at + api_params['contentAvailable'] = content_available + api_params['critical'] = critical + api_params['priority'] = priority return self.client.call('patch', api_path, { 'content-type': 'application/json', diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index ffed825..616b945 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -9,8 +9,8 @@ messaging = Messaging(client) result = messaging.create_push( message_id = '', - title = '', - body = '<BODY>', + title = '<TITLE>', # optional + body = '<BODY>', # optional topics = [], # optional users = [], # optional targets = [], # optional @@ -21,7 +21,10 @@ result = messaging.create_push( sound = '<SOUND>', # optional color = '<COLOR>', # optional tag = '<TAG>', # optional - badge = '<BADGE>', # optional + badge = None, # optional draft = False, # optional - scheduled_at = '' # optional + scheduled_at = '', # optional + content_available = False, # optional + critical = False, # optional + priority = MessagePriority.NORMAL # optional ) diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 3c3965c..f5bdf15 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -23,5 +23,8 @@ result = messaging.update_push( tag = '<TAG>', # optional badge = None, # optional draft = False, # optional - scheduled_at = '' # optional + scheduled_at = '', # optional + content_available = False, # optional + critical = False, # optional + priority = MessagePriority.NORMAL # optional ) diff --git a/setup.py b/setup.py index 4e43800..6fd72cd 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '7.0.1', + version = '6.2.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/7.0.1.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/6.2.0.tar.gz', install_requires=[ 'requests', ], From dd80f677347edc175f8d65c5fca5d11d6a2525ec Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Tue, 28 Jan 2025 18:30:01 +0000 Subject: [PATCH 02/24] fix: pong response & chunked upload --- LICENSE | 2 +- appwrite/client.py | 28 +++++++++---------- appwrite/enums/image_format.py | 1 + .../account/create-anonymous-session.md | 1 + .../account/create-email-password-session.md | 1 + docs/examples/account/create-email-token.md | 1 + docs/examples/account/create-j-w-t.md | 1 + .../account/create-magic-u-r-l-token.md | 1 + .../account/create-mfa-authenticator.md | 1 + docs/examples/account/create-mfa-challenge.md | 1 + .../account/create-mfa-recovery-codes.md | 1 + docs/examples/account/create-o-auth2token.md | 1 + docs/examples/account/create-phone-token.md | 1 + .../account/create-phone-verification.md | 1 + docs/examples/account/create-recovery.md | 1 + docs/examples/account/create-session.md | 1 + docs/examples/account/create-verification.md | 1 + docs/examples/account/create.md | 1 + docs/examples/account/delete-identity.md | 1 + .../account/delete-mfa-authenticator.md | 1 + docs/examples/account/delete-session.md | 1 + docs/examples/account/delete-sessions.md | 1 + .../account/get-mfa-recovery-codes.md | 1 + docs/examples/account/get-prefs.md | 1 + docs/examples/account/get-session.md | 1 + docs/examples/account/get.md | 1 + docs/examples/account/list-identities.md | 1 + docs/examples/account/list-logs.md | 1 + docs/examples/account/list-mfa-factors.md | 1 + docs/examples/account/list-sessions.md | 1 + docs/examples/account/update-email.md | 1 + docs/examples/account/update-m-f-a.md | 1 + .../account/update-magic-u-r-l-session.md | 1 + .../account/update-mfa-authenticator.md | 1 + docs/examples/account/update-mfa-challenge.md | 1 + .../account/update-mfa-recovery-codes.md | 1 + docs/examples/account/update-name.md | 1 + docs/examples/account/update-password.md | 1 + docs/examples/account/update-phone-session.md | 1 + .../account/update-phone-verification.md | 1 + docs/examples/account/update-phone.md | 1 + docs/examples/account/update-prefs.md | 1 + docs/examples/account/update-recovery.md | 1 + docs/examples/account/update-session.md | 1 + docs/examples/account/update-status.md | 1 + docs/examples/account/update-verification.md | 1 + docs/examples/avatars/get-browser.md | 1 + docs/examples/avatars/get-credit-card.md | 1 + docs/examples/avatars/get-favicon.md | 1 + docs/examples/avatars/get-flag.md | 1 + docs/examples/avatars/get-image.md | 1 + docs/examples/avatars/get-initials.md | 1 + docs/examples/avatars/get-q-r.md | 1 + .../databases/create-boolean-attribute.md | 1 + docs/examples/databases/create-collection.md | 1 + .../databases/create-datetime-attribute.md | 1 + docs/examples/databases/create-document.md | 1 + .../databases/create-email-attribute.md | 1 + .../databases/create-enum-attribute.md | 1 + .../databases/create-float-attribute.md | 1 + docs/examples/databases/create-index.md | 1 + .../databases/create-integer-attribute.md | 1 + .../examples/databases/create-ip-attribute.md | 1 + .../create-relationship-attribute.md | 1 + .../databases/create-string-attribute.md | 1 + .../databases/create-url-attribute.md | 1 + docs/examples/databases/create.md | 1 + docs/examples/databases/delete-attribute.md | 1 + docs/examples/databases/delete-collection.md | 1 + docs/examples/databases/delete-document.md | 1 + docs/examples/databases/delete-index.md | 1 + docs/examples/databases/delete.md | 1 + docs/examples/databases/get-attribute.md | 1 + docs/examples/databases/get-collection.md | 1 + docs/examples/databases/get-document.md | 1 + docs/examples/databases/get-index.md | 1 + docs/examples/databases/get.md | 1 + docs/examples/databases/list-attributes.md | 1 + docs/examples/databases/list-collections.md | 1 + docs/examples/databases/list-documents.md | 1 + docs/examples/databases/list-indexes.md | 1 + docs/examples/databases/list.md | 1 + .../databases/update-boolean-attribute.md | 1 + docs/examples/databases/update-collection.md | 1 + .../databases/update-datetime-attribute.md | 1 + docs/examples/databases/update-document.md | 1 + .../databases/update-email-attribute.md | 1 + .../databases/update-enum-attribute.md | 1 + .../databases/update-float-attribute.md | 1 + .../databases/update-integer-attribute.md | 1 + .../examples/databases/update-ip-attribute.md | 1 + .../update-relationship-attribute.md | 1 + .../databases/update-string-attribute.md | 1 + .../databases/update-url-attribute.md | 1 + docs/examples/databases/update.md | 1 + docs/examples/functions/create-build.md | 1 + docs/examples/functions/create-deployment.md | 1 + docs/examples/functions/create-execution.md | 1 + docs/examples/functions/create-variable.md | 1 + docs/examples/functions/create.md | 1 + docs/examples/functions/delete-deployment.md | 1 + docs/examples/functions/delete-execution.md | 1 + docs/examples/functions/delete-variable.md | 1 + docs/examples/functions/delete.md | 1 + .../functions/get-deployment-download.md | 1 + docs/examples/functions/get-deployment.md | 1 + docs/examples/functions/get-execution.md | 1 + docs/examples/functions/get-variable.md | 1 + docs/examples/functions/get.md | 1 + docs/examples/functions/list-deployments.md | 1 + docs/examples/functions/list-executions.md | 1 + docs/examples/functions/list-runtimes.md | 1 + .../examples/functions/list-specifications.md | 1 + docs/examples/functions/list-variables.md | 1 + docs/examples/functions/list.md | 1 + .../functions/update-deployment-build.md | 1 + docs/examples/functions/update-deployment.md | 1 + docs/examples/functions/update-variable.md | 1 + docs/examples/functions/update.md | 1 + docs/examples/graphql/mutation.md | 1 + docs/examples/graphql/query.md | 1 + docs/examples/health/get-antivirus.md | 1 + docs/examples/health/get-cache.md | 1 + docs/examples/health/get-certificate.md | 1 + docs/examples/health/get-d-b.md | 1 + docs/examples/health/get-failed-jobs.md | 1 + docs/examples/health/get-pub-sub.md | 1 + docs/examples/health/get-queue-builds.md | 1 + .../examples/health/get-queue-certificates.md | 1 + docs/examples/health/get-queue-databases.md | 1 + docs/examples/health/get-queue-deletes.md | 1 + docs/examples/health/get-queue-functions.md | 1 + docs/examples/health/get-queue-logs.md | 1 + docs/examples/health/get-queue-mails.md | 1 + docs/examples/health/get-queue-messaging.md | 1 + docs/examples/health/get-queue-migrations.md | 1 + docs/examples/health/get-queue-usage-dump.md | 1 + docs/examples/health/get-queue-usage.md | 1 + docs/examples/health/get-queue-webhooks.md | 1 + docs/examples/health/get-queue.md | 1 + docs/examples/health/get-storage-local.md | 1 + docs/examples/health/get-storage.md | 1 + docs/examples/health/get-time.md | 1 + docs/examples/health/get.md | 1 + docs/examples/locale/get.md | 1 + docs/examples/locale/list-codes.md | 1 + docs/examples/locale/list-continents.md | 1 + docs/examples/locale/list-countries-e-u.md | 1 + docs/examples/locale/list-countries-phones.md | 1 + docs/examples/locale/list-countries.md | 1 + docs/examples/locale/list-currencies.md | 1 + docs/examples/locale/list-languages.md | 1 + .../messaging/create-apns-provider.md | 1 + docs/examples/messaging/create-email.md | 1 + .../examples/messaging/create-fcm-provider.md | 1 + .../messaging/create-mailgun-provider.md | 1 + .../messaging/create-msg91provider.md | 1 + docs/examples/messaging/create-push.md | 1 + .../messaging/create-sendgrid-provider.md | 1 + docs/examples/messaging/create-sms.md | 1 + .../messaging/create-smtp-provider.md | 1 + docs/examples/messaging/create-subscriber.md | 1 + .../messaging/create-telesign-provider.md | 1 + .../messaging/create-textmagic-provider.md | 1 + docs/examples/messaging/create-topic.md | 1 + .../messaging/create-twilio-provider.md | 1 + .../messaging/create-vonage-provider.md | 1 + docs/examples/messaging/delete-provider.md | 1 + docs/examples/messaging/delete-subscriber.md | 1 + docs/examples/messaging/delete-topic.md | 1 + docs/examples/messaging/delete.md | 1 + docs/examples/messaging/get-message.md | 1 + docs/examples/messaging/get-provider.md | 1 + docs/examples/messaging/get-subscriber.md | 1 + docs/examples/messaging/get-topic.md | 1 + docs/examples/messaging/list-message-logs.md | 1 + docs/examples/messaging/list-messages.md | 1 + docs/examples/messaging/list-provider-logs.md | 1 + docs/examples/messaging/list-providers.md | 1 + .../messaging/list-subscriber-logs.md | 1 + docs/examples/messaging/list-subscribers.md | 1 + docs/examples/messaging/list-targets.md | 1 + docs/examples/messaging/list-topic-logs.md | 1 + docs/examples/messaging/list-topics.md | 1 + .../messaging/update-apns-provider.md | 1 + docs/examples/messaging/update-email.md | 1 + .../examples/messaging/update-fcm-provider.md | 1 + .../messaging/update-mailgun-provider.md | 1 + .../messaging/update-msg91provider.md | 1 + docs/examples/messaging/update-push.md | 1 + .../messaging/update-sendgrid-provider.md | 1 + docs/examples/messaging/update-sms.md | 1 + .../messaging/update-smtp-provider.md | 1 + .../messaging/update-telesign-provider.md | 1 + .../messaging/update-textmagic-provider.md | 1 + docs/examples/messaging/update-topic.md | 1 + .../messaging/update-twilio-provider.md | 1 + .../messaging/update-vonage-provider.md | 1 + docs/examples/storage/create-bucket.md | 1 + docs/examples/storage/create-file.md | 1 + docs/examples/storage/delete-bucket.md | 1 + docs/examples/storage/delete-file.md | 1 + docs/examples/storage/get-bucket.md | 1 + docs/examples/storage/get-file-download.md | 1 + docs/examples/storage/get-file-preview.md | 1 + docs/examples/storage/get-file-view.md | 1 + docs/examples/storage/get-file.md | 1 + docs/examples/storage/list-buckets.md | 1 + docs/examples/storage/list-files.md | 1 + docs/examples/storage/update-bucket.md | 1 + docs/examples/storage/update-file.md | 1 + docs/examples/teams/create-membership.md | 1 + docs/examples/teams/create.md | 1 + docs/examples/teams/delete-membership.md | 1 + docs/examples/teams/delete.md | 1 + docs/examples/teams/get-membership.md | 1 + docs/examples/teams/get-prefs.md | 1 + docs/examples/teams/get.md | 1 + docs/examples/teams/list-memberships.md | 1 + docs/examples/teams/list.md | 1 + .../teams/update-membership-status.md | 1 + docs/examples/teams/update-membership.md | 1 + docs/examples/teams/update-name.md | 1 + docs/examples/teams/update-prefs.md | 1 + docs/examples/users/create-argon2user.md | 1 + docs/examples/users/create-bcrypt-user.md | 1 + docs/examples/users/create-j-w-t.md | 1 + docs/examples/users/create-m-d5user.md | 1 + .../users/create-mfa-recovery-codes.md | 1 + docs/examples/users/create-p-h-pass-user.md | 1 + docs/examples/users/create-s-h-a-user.md | 1 + .../users/create-scrypt-modified-user.md | 1 + docs/examples/users/create-scrypt-user.md | 1 + docs/examples/users/create-session.md | 1 + docs/examples/users/create-target.md | 1 + docs/examples/users/create-token.md | 1 + docs/examples/users/create.md | 1 + docs/examples/users/delete-identity.md | 1 + .../users/delete-mfa-authenticator.md | 1 + docs/examples/users/delete-session.md | 1 + docs/examples/users/delete-sessions.md | 1 + docs/examples/users/delete-target.md | 1 + docs/examples/users/delete.md | 1 + docs/examples/users/get-mfa-recovery-codes.md | 1 + docs/examples/users/get-prefs.md | 1 + docs/examples/users/get-target.md | 1 + docs/examples/users/get.md | 1 + docs/examples/users/list-identities.md | 1 + docs/examples/users/list-logs.md | 1 + docs/examples/users/list-memberships.md | 1 + docs/examples/users/list-mfa-factors.md | 1 + docs/examples/users/list-sessions.md | 1 + docs/examples/users/list-targets.md | 1 + docs/examples/users/list.md | 1 + .../users/update-email-verification.md | 1 + docs/examples/users/update-email.md | 1 + docs/examples/users/update-labels.md | 1 + .../users/update-mfa-recovery-codes.md | 1 + docs/examples/users/update-mfa.md | 1 + docs/examples/users/update-name.md | 1 + docs/examples/users/update-password.md | 1 + .../users/update-phone-verification.md | 1 + docs/examples/users/update-phone.md | 1 + docs/examples/users/update-prefs.md | 1 + docs/examples/users/update-status.md | 1 + docs/examples/users/update-target.md | 1 + setup.py | 4 +-- 267 files changed, 280 insertions(+), 18 deletions(-) diff --git a/LICENSE b/LICENSE index 5479bb8..c1602fc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/appwrite/client.py b/appwrite/client.py index f745945..b936a9d 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -13,11 +13,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : 'AppwritePythonSDK/6.2.0 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/7.1.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '6.2.0', + 'x-sdk-version': '7.1.1', 'X-Appwrite-Response-Format' : '1.6.0', } @@ -79,7 +79,7 @@ def call(self, method, path='', headers=None, params=None, response_type='json') data = {} files = {} stringify = False - + headers = {**self._global_headers, **headers} if method != 'get': @@ -170,12 +170,11 @@ def chunked_upload( offset = 0 counter = 0 - if upload_id != 'unique()': - try: - result = self.call('get', path + '/' + upload_id, headers) - counter = result['chunksUploaded'] - except: - pass + try: + result = self.call('get', path + '/' + upload_id, headers) + counter = result['chunksUploaded'] + except: + pass if counter > 0: offset = counter * self._chunk_size @@ -188,7 +187,7 @@ def chunked_upload( if offset + self._chunk_size < size: end = offset + self._chunk_size else: - end = size - offset + end = size input_file.data = input[offset:end] params[param_name] = input_file @@ -200,10 +199,10 @@ def chunked_upload( headers, params, ) - + offset = offset + self._chunk_size - - if "$id" in result: + + if "$id" in result: headers["x-appwrite-id"] = result["$id"] if on_progress is not None: @@ -229,7 +228,7 @@ def flatten(self, data, prefix='', stringify=False): finalKey = prefix + '[' + key +']' if prefix else key finalKey = prefix + '[' + str(i) +']' if isinstance(data, list) else finalKey i += 1 - + if isinstance(value, list) or isinstance(value, dict): output = {**output, **self.flatten(value, finalKey, stringify)} else: @@ -239,4 +238,3 @@ def flatten(self, data, prefix='', stringify=False): output[finalKey] = value return output - diff --git a/appwrite/enums/image_format.py b/appwrite/enums/image_format.py index d507d17..ba2f59e 100644 --- a/appwrite/enums/image_format.py +++ b/appwrite/enums/image_format.py @@ -6,4 +6,5 @@ class ImageFormat(Enum): GIF = "gif" PNG = "png" WEBP = "webp" + HEIC = "heic" AVIF = "avif" diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 36ed47d..ce5a92a 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index b85cc3d..5e869fd 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 4c18324..5cf2bfb 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index 2121514..c737f1b 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index c015418..0077817 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 16a8e2e..a6f09eb 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 017fdd2..deb4c9c 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account from appwrite.enums import AuthenticationFactor client = Client() diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 452b47f..a149cb9 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index 0cc89df..fa11d31 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account from appwrite.enums import OAuthProvider client = Client() diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 30c80df..d242d71 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index fd0a262..bb2058e 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index e9613cd..3d215a4 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index d129e10..d00e8cb 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 5ff238f..329d19e 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 33b6f3f..39b33c6 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index ef57289..3556122 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 0fbe8c7..939ea71 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index fa0049c..9ddb443 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 6ebe286..751ab9b 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index ec70595..f70b968 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 67d0741..52df645 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index f7ae72d..f38466f 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 9ded8e9..b414047 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index c51da2c..4bf9beb 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 750f977..5d8c27a 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 2220475..ba3796b 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index b3427c0..7473313 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index b0a2a16..004d071 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index 561e7cc..2f9321c 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index f6b69b0..ca8e8e5 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 42b91f1..a5a9519 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 5964df4..d28a251 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 4f0b136..38cb41c 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index d0027a8..9b4bf82 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 888349e..ecb4228 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 404d2b4..d29ab28 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 41ceb4b..e64d79f 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index b7414e6..65a6a38 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index f69dc12..c368300 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index a331413..2493dc5 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 3768326..ee3a2f7 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 4f9add8..c8318a4 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 35faf53..63a7f26 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.account import Account client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 91dde3b..7ed8318 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars from appwrite.enums import Browser client = Client() diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index cec2f61..aa66b86 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars from appwrite.enums import CreditCard client = Client() diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 4aa0177..2c6a67e 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 6b12dac..435c855 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars from appwrite.enums import Flag client = Client() diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index 202955c..ee9e0cb 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 233da1b..edcbbb3 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 1296394..7f6da32 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.avatars import Avatars client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 183a2b6..2b4209d 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index fd9e3a6..99c44a2 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index 7435742..db81c02 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index bd3993f..22f2c07 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index f4b427e..2e28e0b 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index dce6355..b1efdc7 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index a658bd8..b36863b 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 015b762..9885c06 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases from appwrite.enums import IndexType client = Client() diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 9f409e4..8cb140a 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index ab4d357..d4b4ab6 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 76b5db1..4172c27 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases from appwrite.enums import RelationshipType client = Client() diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index d6f7f94..e696871 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 3b105d8..4ad03c4 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index a4ddc92..d5cbb99 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 7f490b2..b317ba9 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index c3083a5..ab274c6 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index c3e296a..69151aa 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index d5a12c1..2ed0165 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index 41d5f18..e7e988a 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index e505fe9..a717552 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index 7be57ea..f63298e 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 83faade..acdc25d 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 6038868..ca5a995 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 8fe2358..deadf6a 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index a29aefa..245ec60 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 0e61332..ca18267 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index dee130e..41f0380 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 40578a1..bf18bd1 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index aa934b2..11669b3 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 553d94b..c9300ea 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 3432b6b..d929728 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index f9056d2..96c7fb5 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 07bba76..7b9cce9 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 45a8d0d..5b042d4 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index c07f375..caa1b4e 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index fa1767e..8f8a35a 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 0db9707..125cf82 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 135dbd8..a2b8bad 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index bc528f1..0aacc13 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index ab910d9..c85eb25 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 8e3a28d..53da6ae 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index 765f28a..da59776 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index c4eb9d0..ce2ffb7 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index da9b559..c86fdf6 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions from appwrite.input_file import InputFile client = Client() diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index e1decb9..cb3fddd 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index cd73e30..101ecdf 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index a65b87d..f10a953 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions from appwrite.enums import client = Client() diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index 780ce9d..f98bd60 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index 7c3ea09..b723fd6 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index 646a0f3..e17afed 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 2950ed0..a34d476 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 490d952..90f029a 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 8846888..0617b04 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index f3dfc0f..0a9a347 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index fd903f3..174c8b2 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index cb765e4..a463fa6 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index f776345..4d8feea 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 0012baf..293bab0 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index edad1a9..b624733 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index a9c7417..5e1ec7f 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index 188c17b..ee1a516 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 5b315e1..0b5f18d 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md index a8d93b8..c69cd7c 100644 --- a/docs/examples/functions/update-deployment-build.md +++ b/docs/examples/functions/update-deployment-build.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index 9fce384..0f4c96e 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 238fc91..bcab368 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 5f2a70b..a728241 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.functions import Functions client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 0ec3d3e..e05f602 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.graphql import Graphql client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 95709fd..c8f3c78 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.graphql import Graphql client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index ff93cea..7bc0475 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index fa2a6da..7e69825 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 2a73583..f6a713e 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index 18e3968..a23a073 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index ce33c8c..d0fe64f 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health from appwrite.enums import client = Client() diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index db66c7f..109b288 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index 9daed58..b1d4d62 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index a7d35bc..99f52b8 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 50f8943..7d5e5a0 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index b6e6a4d..d677af5 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 5868b3c..3ffc4b8 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 254fe23..0cb6417 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index c6ab409..97a501c 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index 1007913..ea93eab 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index db59028..09e35df 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-usage-dump.md b/docs/examples/health/get-queue-usage-dump.md index cc31b4f..dabb79a 100644 --- a/docs/examples/health/get-queue-usage-dump.md +++ b/docs/examples/health/get-queue-usage-dump.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index 67d9e64..dbee75f 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index 9188467..1072a20 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md index 61e5a40..aafe7c7 100644 --- a/docs/examples/health/get-queue.md +++ b/docs/examples/health/get-queue.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 276c305..d3b94b2 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index b2de63b..65af2f9 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 4089305..d63beb9 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index f41e0e3..f5c494e 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.health import Health client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index fc048dd..a44f497 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index d516538..12cd12e 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index f6d8495..ea4ac53 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 8bdac2e..7fb6aaa 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 516d822..aafdb3d 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 8fcbe1a..a2f1ec4 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 4708498..39267c6 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 9583cd8..6dec1b9 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.locale import Locale client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 022209d..700e909 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 38005a3..92353e2 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 84c38ea..d13ba02 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index fa94da9..8389971 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 0cffc4e..117c46e 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 616b945..d405185 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 6e9b812..5d20cde 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index c3e7fe7..c7e66d8 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 24108d2..85c5823 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index 81b0c5f..cb8f4f7 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index b06033c..b602213 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 6dc1030..03287e8 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index b0184b5..4dd16da 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index c73e941..524348f 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index cfee0ad..68416bd 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 4d2bd6d..2a1840d 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 5d404d1..94085ef 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index b270b2a..1c2f563 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index c62c8c0..aee928a 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 4b4ef39..9e32d80 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index fdf94f0..6bc85f2 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 7f8284f..43185d7 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index 57c465b..dea6cbf 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 752e449..1c2ab0b 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 7219f09..8457f99 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index 148814c..c8544fa 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 3e89695..258e7cd 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index 7efaead..d2049bd 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index fe2442d..ba9e09d 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 0622571..b941ccb 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index de72a76..57ba7f8 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 1379708..cb21567 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 2bfd3ed..3f0205d 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 6cff0ae..b8f9d71 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 7ca9f38..862e579 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index a89338d..aa1d4e9 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 4c61950..2d4efdb 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index f5bdf15..1266353 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 8b67b7a..e528bd5 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index aadbd9a..7cb0087 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 74232e9..2d798d4 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 2649281..91de1f1 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index bbe4a93..c303104 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index ee4d004..160ac26 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 52eed3b..865fcb5 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 7cb1594..8e01128 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.messaging import Messaging client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index c6e9e33..7e321f1 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index d275070..fa0b117 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage from appwrite.input_file import InputFile client = Client() diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 77d72eb..8cddfb9 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 775065d..08bba5c 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index adb78e8..79f903f 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index b419ea0..1a82b26 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 2e3b2ac..40f32f1 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 9ce04e2..3947c76 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 9f04ef4..0c2d5e3 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 84eab54..88540cd 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 8a2aa6d..e26ac2e 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 4eea2a9..61388b0 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 0137af5..336e8a0 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.storage import Storage client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 4846295..1af9f25 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 544ee3a..7085d39 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 7f0cbd4..adf065c 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index fc84152..762f532 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 6075cc7..17bacff 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index d740e69..035777d 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 6d44b80..985924e 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index f7a072a..885a4c2 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index afb5de1..c92d4c9 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index ee6d211..ae6e524 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 6726150..c50f345 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index 693654d..d25c8db 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 4661601..9eca847 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.teams import Teams client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 575aa42..3d65496 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index f6cd2fe..76532a9 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md index a758d4e..2e1fdf6 100644 --- a/docs/examples/users/create-j-w-t.md +++ b/docs/examples/users/create-j-w-t.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index cabf875..da9d471 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index 606878f..a4477b0 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index 0d8f990..363be4f 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index b0ae799..bb78ff7 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index d7d17c4..1cfbcfc 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 507fb1f..2d1e72b 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index a2ba12a..bebd46b 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index 9ad8364..c11c7ca 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users from appwrite.enums import MessagingProviderType client = Client() diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index e2ef2f6..00a0e78 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index c3e7fd5..c8dac9f 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 4c78038..85c5b6d 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index c7101d1..b22d391 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users from appwrite.enums import AuthenticatorType client = Client() diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index c0fabdb..dda5713 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 328a9ee..268c311 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 5c2d9df..38cc5a9 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index de8b35b..090c20f 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index b37739c..ec9986c 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index 23109a9..eb14d3a 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index d494460..f549f08 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index d7dda45..6e018c2 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 7764d74..b10c320 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index d1c6b0a..10d8ae0 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 27db71f..fbb3b4c 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 39aed0c..1f40b1f 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index fd091b9..a9eead0 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index b5b67b9..4766646 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index b191f8a..4b09ca5 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 72ddf7a..4623bc3 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index c977d95..083715b 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 04c3999..24c5b27 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index ca3b96a..d0e4da4 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index e145f9b..efd6730 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index d546b95..6014ef5 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 0c7e7bf..90ac15f 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index b13c4fb..a62e6a8 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index ecb0172..f522730 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index ca6999c..64d9df3 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index ebec495..8943ef5 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index f9bdfb4..8951385 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,4 +1,5 @@ from appwrite.client import Client +from appwrite.services.users import Users client = Client() client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint diff --git a/setup.py b/setup.py index 6fd72cd..e81ec0f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '6.2.0', + version = '7.1.1', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/6.2.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/7.1.1.tar.gz', install_requires=[ 'requests', ], From 7123fc3a66f77d99325d651ae78f5b49a2405584 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Wed, 29 Jan 2025 08:04:10 +0000 Subject: [PATCH 03/24] chore: bump versions --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index b936a9d..be73fb8 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/7.1.1 (${os.uname().sysname}; ${os.uname().version}; ${os.uname().machine})', + 'user-agent' : 'AppwritePythonSDK/8.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': '7.1.1', + 'x-sdk-version': '8.0.0', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/setup.py b/setup.py index e81ec0f..489adec 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '7.1.1', + version = '8.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/7.1.1.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/8.0.0.tar.gz', install_requires=[ 'requests', ], From fdbd19f9940e828f9eba78269ef32adb48a00289 Mon Sep 17 00:00:00 2001 From: Christy Jacob <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 10:27:51 +0000 Subject: [PATCH 04/24] 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 = '<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 = '<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_API_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_API_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 <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 11:07:16 +0000 Subject: [PATCH 05/24] 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 = {} From 8bfb04dcefe37a1d3e2bef42f35fd72a80e0d15c Mon Sep 17 00:00:00 2001 From: Christy Jacob <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 12:50:09 +0000 Subject: [PATCH 06/24] fix: errors in typing for Python 3.13 --- .github/workflows/publish.yml | 2 +- appwrite/services/account.py | 7 ++++--- appwrite/services/avatars.py | 1 + appwrite/services/databases.py | 27 +++++++++++++------------- appwrite/services/functions.py | 11 ++++++----- appwrite/services/graphql.py | 1 + appwrite/services/health.py | 1 + appwrite/services/locale.py | 1 + appwrite/services/messaging.py | 35 +++++++++++++++++----------------- appwrite/services/storage.py | 13 +++++++------ appwrite/services/teams.py | 11 ++++++----- appwrite/services/users.py | 11 ++++++----- 12 files changed, 66 insertions(+), 55 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e8eca7b..d84d143 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - name: Build package run: | diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 7c248f3..8344161 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.authenticator_type import AuthenticatorType; from ..enums.authentication_factor import AuthenticationFactor; @@ -62,7 +63,7 @@ def update_email(self, email: str, password: str): 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: list[str] = None): + def list_identities(self, queries: List[str] = None): """List identities""" api_path = '/account/identities' @@ -99,7 +100,7 @@ def create_jwt(self): 'content-type': 'application/json', }, api_params) - def list_logs(self, queries: list[str] = None): + def list_logs(self, queries: List[str] = None): """List logs""" api_path = '/account/logs' @@ -568,7 +569,7 @@ 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[str] = 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}' diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 40a0abb..4220f35 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.browser import Browser; from ..enums.credit_card import CreditCard; diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index e1c63b2..08e8edf 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.relationship_type import RelationshipType; from ..enums.relation_mutate import RelationMutate; @@ -9,7 +10,7 @@ class Databases(Service): def __init__(self, client): super(Databases, self).__init__(client) - def list(self, queries: list[str] = None, search: str = None): + def list(self, queries: List[str] = None, search: str = None): """List databases""" api_path = '/databases' @@ -92,7 +93,7 @@ def delete(self, database_id: str): 'content-type': 'application/json', }, api_params) - def list_collections(self, database_id: str, queries: list[str] = 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' @@ -109,7 +110,7 @@ def list_collections(self, database_id: str, queries: list[str] = None, search: 'content-type': 'application/json', }, api_params) - def create_collection(self, database_id: str, collection_id: str, name: str, permissions: list[str] = 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' @@ -154,7 +155,7 @@ 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[str] = 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}' @@ -199,7 +200,7 @@ 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[str] = None): + def list_attributes(self, database_id: str, collection_id: str, queries: List[str] = None): """List attributes""" api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' @@ -393,7 +394,7 @@ 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[str], 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' @@ -426,7 +427,7 @@ 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[str], 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}' @@ -865,7 +866,7 @@ 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[str] = None): + def list_documents(self, database_id: str, collection_id: str, queries: List[str] = None): """List documents""" api_path = '/databases/{databaseId}/collections/{collectionId}/documents' @@ -885,7 +886,7 @@ def list_documents(self, database_id: str, collection_id: str, queries: list[str 'content-type': 'application/json', }, api_params) - def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: list[str] = 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' @@ -913,7 +914,7 @@ 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[str] = 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}' @@ -937,7 +938,7 @@ 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[str] = 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}' @@ -985,7 +986,7 @@ 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[str] = None): + def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None): """List indexes""" api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' @@ -1005,7 +1006,7 @@ def list_indexes(self, database_id: str, collection_id: str, queries: list[str] 'content-type': 'application/json', }, api_params) - def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: list[str], orders: list[str] = 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' diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 6eb8bad..0c990bd 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.runtime import Runtime; from ..input_file import InputFile @@ -9,7 +10,7 @@ class Functions(Service): def __init__(self, client): super(Functions, self).__init__(client) - def list(self, queries: list[str] = None, search: str = None): + def list(self, queries: List[str] = None, search: str = None): """List functions""" api_path = '/functions' @@ -22,7 +23,7 @@ def list(self, queries: list[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -99,7 +100,7 @@ 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[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): + 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}' @@ -149,7 +150,7 @@ def delete(self, function_id: str): 'content-type': 'application/json', }, api_params) - def list_deployments(self, function_id: str, queries: list[str] = 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' @@ -311,7 +312,7 @@ 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[str] = 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' diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 41421bb..4a0fd36 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException class Graphql(Service): diff --git a/appwrite/services/health.py b/appwrite/services/health.py index d87dc57..014b536 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.name import Name; diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 6a8f007..6c14eaf 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException class Locale(Service): diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index f344b9f..9b41d18 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.message_priority import MessagePriority; from ..enums.smtp_encryption import SmtpEncryption; @@ -8,7 +9,7 @@ class Messaging(Service): def __init__(self, client): super(Messaging, self).__init__(client) - def list_messages(self, queries: list[str] = None, search: str = None): + def list_messages(self, queries: List[str] = None, search: str = None): """List messages""" api_path = '/messaging/messages' @@ -21,7 +22,7 @@ def list_messages(self, queries: list[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -53,7 +54,7 @@ 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[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): + 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}' @@ -79,7 +80,7 @@ def update_email(self, message_id: str, topics: list[str] = None, users: list[st 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -112,7 +113,7 @@ 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[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): + 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}' @@ -145,7 +146,7 @@ def update_push(self, message_id: str, topics: list[str] = None, users: list[str 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -169,7 +170,7 @@ def create_sms(self, message_id: str, content: str, topics: list[str] = None, us 'content-type': 'application/json', }, api_params) - 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): + 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}' @@ -220,7 +221,7 @@ def delete(self, message_id: str): 'content-type': 'application/json', }, api_params) - def list_message_logs(self, message_id: str, queries: list[str] = None): + def list_message_logs(self, message_id: str, queries: List[str] = None): """List message logs""" api_path = '/messaging/messages/{messageId}/logs' @@ -236,7 +237,7 @@ def list_message_logs(self, message_id: str, queries: list[str] = None): 'content-type': 'application/json', }, api_params) - def list_targets(self, message_id: str, queries: list[str] = None): + def list_targets(self, message_id: str, queries: List[str] = None): """List message targets""" api_path = '/messaging/messages/{messageId}/targets' @@ -252,7 +253,7 @@ def list_targets(self, message_id: str, queries: list[str] = None): 'content-type': 'application/json', }, api_params) - def list_providers(self, queries: list[str] = None, search: str = None): + def list_providers(self, queries: List[str] = None, search: str = None): """List providers""" api_path = '/messaging/providers' @@ -756,7 +757,7 @@ def delete_provider(self, provider_id: str): 'content-type': 'application/json', }, api_params) - def list_provider_logs(self, provider_id: str, queries: list[str] = None): + def list_provider_logs(self, provider_id: str, queries: List[str] = None): """List provider logs""" api_path = '/messaging/providers/{providerId}/logs' @@ -772,7 +773,7 @@ def list_provider_logs(self, provider_id: str, queries: list[str] = None): 'content-type': 'application/json', }, api_params) - def list_subscriber_logs(self, subscriber_id: str, queries: list[str] = None): + def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None): """List subscriber logs""" api_path = '/messaging/subscribers/{subscriberId}/logs' @@ -788,7 +789,7 @@ def list_subscriber_logs(self, subscriber_id: str, queries: list[str] = None): 'content-type': 'application/json', }, api_params) - def list_topics(self, queries: list[str] = None, search: str = None): + def list_topics(self, queries: List[str] = None, search: str = None): """List topics""" api_path = '/messaging/topics' @@ -801,7 +802,7 @@ def list_topics(self, queries: list[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_topic(self, topic_id: str, name: str, subscribe: list[str] = None): + def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None): """Create topic""" api_path = '/messaging/topics' @@ -836,7 +837,7 @@ 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[str] = None): + def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = None): """Update topic""" api_path = '/messaging/topics/{topicId}' @@ -868,7 +869,7 @@ def delete_topic(self, topic_id: str): 'content-type': 'application/json', }, api_params) - def list_topic_logs(self, topic_id: str, queries: list[str] = None): + def list_topic_logs(self, topic_id: str, queries: List[str] = None): """List topic logs""" api_path = '/messaging/topics/{topicId}/logs' @@ -884,7 +885,7 @@ def list_topic_logs(self, topic_id: str, queries: list[str] = None): 'content-type': 'application/json', }, api_params) - def list_subscribers(self, topic_id: str, queries: list[str] = 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' diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index dc30df5..ac73261 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.compression import Compression; from ..input_file import InputFile @@ -10,7 +11,7 @@ class Storage(Service): def __init__(self, client): super(Storage, self).__init__(client) - def list_buckets(self, queries: list[str] = None, search: str = None): + def list_buckets(self, queries: List[str] = None, search: str = None): """List buckets""" api_path = '/storage/buckets' @@ -23,7 +24,7 @@ def list_buckets(self, queries: list[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -65,7 +66,7 @@ def get_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - 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): + 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}' @@ -107,7 +108,7 @@ def delete_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - def list_files(self, bucket_id: str, queries: list[str] = 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' @@ -124,7 +125,7 @@ def list_files(self, bucket_id: str, queries: list[str] = None, search: str = No 'content-type': 'application/json', }, api_params) - def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: list[str] = 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' @@ -173,7 +174,7 @@ 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[str] = 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}' diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index f157768..fd28540 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException class Teams(Service): @@ -6,7 +7,7 @@ class Teams(Service): def __init__(self, client): super(Teams, self).__init__(client) - def list(self, queries: list[str] = None, search: str = None): + def list(self, queries: List[str] = None, search: str = None): """List teams""" api_path = '/teams' @@ -19,7 +20,7 @@ def list(self, queries: list[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, team_id: str, name: str, roles: list[str] = None): + def create(self, team_id: str, name: str, roles: List[str] = None): """Create team""" api_path = '/teams' @@ -88,7 +89,7 @@ def delete(self, team_id: str): 'content-type': 'application/json', }, api_params) - def list_memberships(self, team_id: str, queries: list[str] = 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' @@ -105,7 +106,7 @@ def list_memberships(self, team_id: str, queries: list[str] = None, search: str 'content-type': 'application/json', }, api_params) - 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): + 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' @@ -148,7 +149,7 @@ 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[str]): + def update_membership(self, team_id: str, membership_id: str, roles: List[str]): """Update membership""" api_path = '/teams/{teamId}/memberships/{membershipId}' diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 6ed17ee..09155c3 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1,4 +1,5 @@ from ..service import Service +from typing import List from ..exception import AppwriteException from ..enums.password_hash import PasswordHash; from ..enums.authenticator_type import AuthenticatorType; @@ -9,7 +10,7 @@ class Users(Service): def __init__(self, client): super(Users, self).__init__(client) - def list(self, queries: list[str] = None, search: str = None): + def list(self, queries: List[str] = None, search: str = None): """List users""" api_path = '/users' @@ -89,7 +90,7 @@ 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[str] = None, search: str = None): + def list_identities(self, queries: List[str] = None, search: str = None): """List identities""" api_path = '/users/identities' @@ -336,7 +337,7 @@ 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[str]): + def update_labels(self, user_id: str, labels: List[str]): """Update user labels""" api_path = '/users/{userId}/labels' @@ -355,7 +356,7 @@ def update_labels(self, user_id: str, labels: list[str]): 'content-type': 'application/json', }, api_params) - def list_logs(self, user_id: str, queries: list[str] = None): + def list_logs(self, user_id: str, queries: List[str] = None): """List user logs""" api_path = '/users/{userId}/logs' @@ -658,7 +659,7 @@ def update_status(self, user_id: str, status: bool): 'content-type': 'application/json', }, api_params) - def list_targets(self, user_id: str, queries: list[str] = None): + def list_targets(self, user_id: str, queries: List[str] = None): """List user targets""" api_path = '/users/{userId}/targets' From e28bc15f2d3e66debef625c594753ec4c13d571f Mon Sep 17 00:00:00 2001 From: Christy Jacob <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 12:53:37 +0000 Subject: [PATCH 07/24] fix: update python version --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index 4e04484..bc6853d 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' : f'AppwritePythonSDK/9.0.0 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.1 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.0', + 'x-sdk-version': '9.0.1', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/setup.py b/setup.py index 40bc73f..5598001 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.0', + version = '9.0.1', 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/9.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.1.tar.gz', install_requires=[ 'requests', ], From 1236cce15ec54974ee94a2ff71566785f4c5bafd Mon Sep 17 00:00:00 2001 From: Christy Jacob <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 19:05:58 +0000 Subject: [PATCH 08/24] feat: add platform agnostic uname() for user agent --- appwrite/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appwrite/client.py b/appwrite/client.py index bc6853d..5c95431 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -1,6 +1,7 @@ import io import json import os +import platform import requests from .input_file import InputFile from .exception import AppwriteException @@ -13,7 +14,7 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.1 ({os.uname().sysname}; {os.uname().version}; {os.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', From 7b23b5ff5b153af0f0f2b47690da1bac1968f405 Mon Sep 17 00:00:00 2001 From: Christy Jacob <christyjacob4@gmail.com> Date: Mon, 10 Mar 2025 19:07:14 +0000 Subject: [PATCH 09/24] feat: update version --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index 5c95431..b8885cd 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.2 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.1', + 'x-sdk-version': '9.0.2', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/setup.py b/setup.py index 5598001..d427818 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.1', + version = '9.0.2', 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/9.0.1.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.2.tar.gz', install_requires=[ 'requests', ], From 784e5d97fb370f47abcdc9937752bf6098b389eb Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Tue, 25 Mar 2025 13:56:04 +0000 Subject: [PATCH 10/24] feat: add updated docstrings --- appwrite/client.py | 4 +- appwrite/services/account.py | 876 +++++++++++++++++--- appwrite/services/avatars.py | 198 ++++- appwrite/services/databases.py | 1194 ++++++++++++++++++++++++++-- appwrite/services/functions.py | 620 +++++++++++++-- appwrite/services/graphql.py | 44 +- appwrite/services/health.py | 429 ++++++++-- appwrite/services/locale.py | 126 ++- appwrite/services/messaging.py | 1364 +++++++++++++++++++++++++++++--- appwrite/services/storage.py | 359 ++++++++- appwrite/services/teams.py | 315 +++++++- appwrite/services/users.py | 979 +++++++++++++++++++++-- setup.py | 4 +- 13 files changed, 5960 insertions(+), 552 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index b8885cd..a65edeb 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.2 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.3 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.2', + 'x-sdk-version': '9.0.3', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 8344161..70b7eab 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.authenticator_type import AuthenticatorType; from ..enums.authentication_factor import AuthenticationFactor; @@ -7,11 +7,22 @@ class Account(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Account, self).__init__(client) - def get(self): - """Get account""" + def get(self) -> Dict[str, Any]: + """ + Get the currently logged in user. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account' api_params = {} @@ -20,8 +31,30 @@ def get(self): 'content-type': 'application/json', }, api_params) - def create(self, user_id: str, email: str, password: str, name: str = None): - """Create account""" + def create(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: + """ + Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + New user password. Must be between 8 and 256 chars. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account' api_params = {} @@ -44,8 +77,28 @@ def create(self, user_id: str, email: str, password: str, name: str = None): 'content-type': 'application/json', }, api_params) - def update_email(self, email: str, password: str): - """Update email""" + def update_email(self, email: str, password: str) -> Dict[str, Any]: + """ + Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. + This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + + Parameters + ---------- + email : str + User email. + password : str + User password. Must be at least 8 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/email' api_params = {} @@ -63,8 +116,24 @@ def update_email(self, email: str, password: str): 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: List[str] = None): - """List identities""" + def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the list of identities for the currently logged in user. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/identities' api_params = {} @@ -75,8 +144,24 @@ def list_identities(self, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def delete_identity(self, identity_id: str): - """Delete identity""" + def delete_identity(self, identity_id: str) -> Dict[str, Any]: + """ + Delete an identity by its unique ID. + Parameters + ---------- + identity_id : str + Identity ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/identities/{identityId}' api_params = {} @@ -90,8 +175,19 @@ def delete_identity(self, identity_id: str): 'content-type': 'application/json', }, api_params) - def create_jwt(self): - """Create JWT""" + def create_jwt(self) -> Dict[str, Any]: + """ + Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/jwts' api_params = {} @@ -100,8 +196,24 @@ def create_jwt(self): 'content-type': 'application/json', }, api_params) - def list_logs(self, queries: List[str] = None): - """List logs""" + def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/logs' api_params = {} @@ -112,8 +224,24 @@ def list_logs(self, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def update_mfa(self, mfa: bool): - """Update MFA""" + def update_mfa(self, mfa: bool) -> Dict[str, Any]: + """ + Enable or disable MFA on an account. + Parameters + ---------- + mfa : bool + Enable or disable MFA. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa' api_params = {} @@ -127,8 +255,24 @@ def update_mfa(self, mfa: bool): 'content-type': 'application/json', }, api_params) - def create_mfa_authenticator(self, type: AuthenticatorType): - """Create authenticator""" + def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: + """ + Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + Parameters + ---------- + type : AuthenticatorType + Type of authenticator. Must be `totp` + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -142,8 +286,26 @@ def create_mfa_authenticator(self, type: AuthenticatorType): 'content-type': 'application/json', }, api_params) - def update_mfa_authenticator(self, type: AuthenticatorType, otp: str): - """Verify authenticator""" + def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[str, Any]: + """ + Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + Parameters + ---------- + type : AuthenticatorType + Type of authenticator. + otp : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -161,8 +323,24 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str): 'content-type': 'application/json', }, api_params) - def delete_mfa_authenticator(self, type: AuthenticatorType): - """Delete authenticator""" + def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: + """ + Delete an authenticator for a user by ID. + Parameters + ---------- + type : AuthenticatorType + Type of authenticator. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/authenticators/{type}' api_params = {} @@ -176,8 +354,24 @@ def delete_mfa_authenticator(self, type: AuthenticatorType): 'content-type': 'application/json', }, api_params) - def create_mfa_challenge(self, factor: AuthenticationFactor): - """Create MFA challenge""" + def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: + """ + Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + Parameters + ---------- + factor : AuthenticationFactor + Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/challenge' api_params = {} @@ -191,8 +385,26 @@ def create_mfa_challenge(self, factor: AuthenticationFactor): 'content-type': 'application/json', }, api_params) - def update_mfa_challenge(self, challenge_id: str, otp: str): - """Create MFA challenge (confirmation)""" + def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: + """ + Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Parameters + ---------- + challenge_id : str + ID of the challenge. + otp : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/challenge' api_params = {} @@ -210,8 +422,19 @@ def update_mfa_challenge(self, challenge_id: str, otp: str): 'content-type': 'application/json', }, api_params) - def list_mfa_factors(self): - """List factors""" + def list_mfa_factors(self) -> Dict[str, Any]: + """ + List the factors available on the account to be used as a MFA challange. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/factors' api_params = {} @@ -220,8 +443,19 @@ def list_mfa_factors(self): 'content-type': 'application/json', }, api_params) - def get_mfa_recovery_codes(self): - """Get MFA recovery codes""" + def get_mfa_recovery_codes(self) -> Dict[str, Any]: + """ + Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/recovery-codes' api_params = {} @@ -230,8 +464,19 @@ def get_mfa_recovery_codes(self): 'content-type': 'application/json', }, api_params) - def create_mfa_recovery_codes(self): - """Create MFA recovery codes""" + def create_mfa_recovery_codes(self) -> Dict[str, Any]: + """ + Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/recovery-codes' api_params = {} @@ -240,8 +485,19 @@ def create_mfa_recovery_codes(self): 'content-type': 'application/json', }, api_params) - def update_mfa_recovery_codes(self): - """Regenerate MFA recovery codes""" + def update_mfa_recovery_codes(self) -> Dict[str, Any]: + """ + Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/mfa/recovery-codes' api_params = {} @@ -250,8 +506,24 @@ def update_mfa_recovery_codes(self): 'content-type': 'application/json', }, api_params) - def update_name(self, name: str): - """Update name""" + def update_name(self, name: str) -> Dict[str, Any]: + """ + Update currently logged in user account name. + Parameters + ---------- + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/name' api_params = {} @@ -265,8 +537,26 @@ def update_name(self, name: str): 'content-type': 'application/json', }, api_params) - def update_password(self, password: str, old_password: str = None): - """Update password""" + def update_password(self, password: str, old_password: str = None) -> Dict[str, Any]: + """ + Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + Parameters + ---------- + password : str + New user password. Must be at least 8 chars. + old_password : str + Current user password. Must be at least 8 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/password' api_params = {} @@ -281,8 +571,26 @@ def update_password(self, password: str, old_password: str = None): 'content-type': 'application/json', }, api_params) - def update_phone(self, phone: str, password: str): - """Update phone""" + def update_phone(self, phone: str, password: str) -> Dict[str, Any]: + """ + Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + Parameters + ---------- + phone : str + Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + password : str + User password. Must be at least 8 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/phone' api_params = {} @@ -300,8 +608,19 @@ def update_phone(self, phone: str, password: str): 'content-type': 'application/json', }, api_params) - def get_prefs(self): - """Get account preferences""" + def get_prefs(self) -> Dict[str, Any]: + """ + Get the preferences as a key-value object for the currently logged in user. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/prefs' api_params = {} @@ -310,8 +629,24 @@ def get_prefs(self): 'content-type': 'application/json', }, api_params) - def update_prefs(self, prefs: dict): - """Update preferences""" + def update_prefs(self, prefs: dict) -> Dict[str, Any]: + """ + Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters + ---------- + prefs : dict + Prefs key-value JSON object. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/prefs' api_params = {} @@ -325,8 +660,26 @@ def update_prefs(self, prefs: dict): 'content-type': 'application/json', }, api_params) - def create_recovery(self, email: str, url: str): - """Create password recovery""" + def create_recovery(self, email: str, url: str) -> Dict[str, Any]: + """ + Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + Parameters + ---------- + email : str + User email. + url : str + URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/recovery' api_params = {} @@ -344,8 +697,30 @@ def create_recovery(self, email: str, url: str): 'content-type': 'application/json', }, api_params) - def update_recovery(self, user_id: str, secret: str, password: str): - """Create password recovery (confirmation)""" + def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Any]: + """ + Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. + + Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters + ---------- + user_id : str + User ID. + secret : str + Valid reset token. + password : str + New user password. Must be between 8 and 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/recovery' api_params = {} @@ -367,8 +742,19 @@ def update_recovery(self, user_id: str, secret: str, password: str): 'content-type': 'application/json', }, api_params) - def list_sessions(self): - """List sessions""" + def list_sessions(self) -> Dict[str, Any]: + """ + Get the list of active sessions across different devices for the currently logged in user. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions' api_params = {} @@ -377,8 +763,19 @@ def list_sessions(self): 'content-type': 'application/json', }, api_params) - def delete_sessions(self): - """Delete sessions""" + def delete_sessions(self) -> Dict[str, Any]: + """ + Delete all sessions from the user account and remove any sessions cookies from the end client. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions' api_params = {} @@ -387,8 +784,19 @@ def delete_sessions(self): 'content-type': 'application/json', }, api_params) - def create_anonymous_session(self): - """Create anonymous session""" + def create_anonymous_session(self) -> Dict[str, Any]: + """ + Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/anonymous' api_params = {} @@ -397,8 +805,28 @@ def create_anonymous_session(self): 'content-type': 'application/json', }, api_params) - def create_email_password_session(self, email: str, password: str): - """Create email password session""" + def create_email_password_session(self, email: str, password: str) -> Dict[str, Any]: + """ + Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. + + A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters + ---------- + email : str + User email. + password : str + User password. Must be at least 8 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/email' api_params = {} @@ -416,8 +844,26 @@ def create_email_password_session(self, email: str, password: str): 'content-type': 'application/json', }, api_params) - def update_magic_url_session(self, user_id: str, secret: str): - """Update magic URL session""" + def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + secret : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/magic-url' api_params = {} @@ -435,8 +881,26 @@ def update_magic_url_session(self, user_id: str, secret: str): 'content-type': 'application/json', }, api_params) - def update_phone_session(self, user_id: str, secret: str): - """Update phone session""" + def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + secret : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/phone' api_params = {} @@ -454,8 +918,26 @@ def update_phone_session(self, user_id: str, secret: str): 'content-type': 'application/json', }, api_params) - def create_session(self, user_id: str, secret: str): - """Create session""" + def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + secret : str + Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/token' api_params = {} @@ -473,8 +955,24 @@ def create_session(self, user_id: str, secret: str): 'content-type': 'application/json', }, api_params) - def get_session(self, session_id: str): - """Get session""" + def get_session(self, session_id: str) -> Dict[str, Any]: + """ + Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + Parameters + ---------- + session_id : str + Session ID. Use the string 'current' to get the current device session. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/{sessionId}' api_params = {} @@ -488,8 +986,24 @@ def get_session(self, session_id: str): 'content-type': 'application/json', }, api_params) - def update_session(self, session_id: str): - """Update session""" + def update_session(self, session_id: str) -> Dict[str, Any]: + """ + Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + Parameters + ---------- + session_id : str + Session ID. Use the string 'current' to update the current device session. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/{sessionId}' api_params = {} @@ -503,8 +1017,24 @@ def update_session(self, session_id: str): 'content-type': 'application/json', }, api_params) - def delete_session(self, session_id: str): - """Delete session""" + def delete_session(self, session_id: str) -> Dict[str, Any]: + """ + Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + Parameters + ---------- + session_id : str + Session ID. Use the string 'current' to delete the current device session. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/sessions/{sessionId}' api_params = {} @@ -518,8 +1048,19 @@ def delete_session(self, session_id: str): 'content-type': 'application/json', }, api_params) - def update_status(self): - """Update status""" + def update_status(self) -> Dict[str, Any]: + """ + Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/status' api_params = {} @@ -528,8 +1069,30 @@ def update_status(self): 'content-type': 'application/json', }, api_params) - def create_email_token(self, user_id: str, email: str, phrase: bool = None): - """Create email token (OTP)""" + def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> Dict[str, Any]: + """ + Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. + + A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + phrase : bool + Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/tokens/email' api_params = {} @@ -548,8 +1111,33 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None): 'content-type': 'application/json', }, api_params) - def create_magic_url_token(self, user_id: str, email: str, url: str = None, phrase: bool = None): - """Create magic URL token""" + def create_magic_url_token(self, user_id: str, email: str, url: str = None, phrase: bool = None) -> Dict[str, Any]: + """ + Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour. + + A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + + Parameters + ---------- + user_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + url : str + URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + phrase : bool + Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/tokens/magic-url' api_params = {} @@ -569,8 +1157,34 @@ 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[str] = None): - """Create OAuth2 token""" + def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, failure: str = None, scopes: List[str] = None) -> str: + """ + Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed. + + If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. + + A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters + ---------- + provider : OAuthProvider + OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + success : str + URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + failure : str + URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + scopes : List[str] + A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. + + Returns + ------- + str + Authentication response as a string + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/tokens/oauth2/{provider}' api_params = {} @@ -587,8 +1201,28 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai 'content-type': 'application/json', }, api_params, response_type='location') - def create_phone_token(self, user_id: str, phone: str): - """Create phone token""" + def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: + """ + Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. + + A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters + ---------- + user_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + phone : str + Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/tokens/phone' api_params = {} @@ -606,8 +1240,27 @@ def create_phone_token(self, user_id: str, phone: str): 'content-type': 'application/json', }, api_params) - def create_verification(self, url: str): - """Create email verification""" + def create_verification(self, url: str) -> Dict[str, Any]: + """ + Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days. + + Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + + Parameters + ---------- + url : str + URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/verification' api_params = {} @@ -621,8 +1274,26 @@ def create_verification(self, url: str): 'content-type': 'application/json', }, api_params) - def update_verification(self, user_id: str, secret: str): - """Create email verification (confirmation)""" + def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters + ---------- + user_id : str + User ID. + secret : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/verification' api_params = {} @@ -640,8 +1311,19 @@ def update_verification(self, user_id: str, secret: str): 'content-type': 'application/json', }, api_params) - def create_phone_verification(self): - """Create phone verification""" + def create_phone_verification(self) -> Dict[str, Any]: + """ + Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/verification/phone' api_params = {} @@ -650,8 +1332,26 @@ def create_phone_verification(self): 'content-type': 'application/json', }, api_params) - def update_phone_verification(self, user_id: str, secret: str): - """Update phone verification (confirmation)""" + def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters + ---------- + user_id : str + User ID. + secret : str + Valid verification token. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/account/verification/phone' api_params = {} diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 4220f35..85e0e44 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.browser import Browser; from ..enums.credit_card import CreditCard; @@ -7,11 +7,35 @@ class Avatars(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Avatars, self).__init__(client) - def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None): - """Get browser icon""" + def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + """ + You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. + + When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters + ---------- + code : Browser + Browser Code. + width : float + Image width. Pass an integer between 0 to 2000. Defaults to 100. + height : float + Image height. Pass an integer between 0 to 2000. Defaults to 100. + quality : float + Image quality. Pass an integer between 0 to 100. Defaults to 100. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/browsers/{code}' api_params = {} @@ -28,8 +52,33 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, 'content-type': 'application/json', }, api_params) - def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None): - """Get credit card icon""" + def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + """ + The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. + + When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + + Parameters + ---------- + code : CreditCard + Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro, rupay. + width : float + Image width. Pass an integer between 0 to 2000. Defaults to 100. + height : float + Image height. Pass an integer between 0 to 2000. Defaults to 100. + quality : float + Image quality. Pass an integer between 0 to 100. Defaults to 100. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/credit-cards/{code}' api_params = {} @@ -46,8 +95,26 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = 'content-type': 'application/json', }, api_params) - def get_favicon(self, url: str): - """Get favicon""" + def get_favicon(self, url: str) -> Dict[str, Any]: + """ + Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + + This endpoint does not follow HTTP redirects. + Parameters + ---------- + url : str + Website URL which you want to fetch the favicon from. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/favicon' api_params = {} @@ -61,8 +128,33 @@ def get_favicon(self, url: str): 'content-type': 'application/json', }, api_params) - def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None): - """Get country flag""" + def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + """ + You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + + When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + + Parameters + ---------- + code : Flag + Country Code. ISO Alpha-2 country code format. + width : float + Image width. Pass an integer between 0 to 2000. Defaults to 100. + height : float + Image height. Pass an integer between 0 to 2000. Defaults to 100. + quality : float + Image quality. Pass an integer between 0 to 100. Defaults to 100. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/flags/{code}' api_params = {} @@ -79,8 +171,32 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit 'content-type': 'application/json', }, api_params) - def get_image(self, url: str, width: float = None, height: float = None): - """Get image from URL""" + def get_image(self, url: str, width: float = None, height: float = None) -> Dict[str, Any]: + """ + Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. + + When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + + This endpoint does not follow HTTP redirects. + Parameters + ---------- + url : str + Image URL which you want to crop. + width : float + Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. + height : float + Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/image' api_params = {} @@ -96,8 +212,35 @@ def get_image(self, url: str, width: float = None, height: float = None): 'content-type': 'application/json', }, api_params) - def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None): - """Get user initials""" + def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> Dict[str, Any]: + """ + Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + + You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + + When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + + Parameters + ---------- + name : str + Full Name. When empty, current user name or email will be used. Max length: 128 chars. + width : float + Image width. Pass an integer between 0 to 2000. Defaults to 100. + height : float + Image height. Pass an integer between 0 to 2000. Defaults to 100. + background : str + Changes background color. By default a random color will be picked and stay will persistent to the given name. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/initials' api_params = {} @@ -111,8 +254,31 @@ def get_initials(self, name: str = None, width: float = None, height: float = No 'content-type': 'application/json', }, api_params) - def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None): - """Get QR code""" + def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> Dict[str, Any]: + """ + Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + + Parameters + ---------- + text : str + Plain text to be converted to QR code image. + size : float + QR code size. Pass an integer between 1 to 1000. Defaults to 400. + margin : float + Margin from edge. Pass an integer between 0 to 10. Defaults to 1. + download : bool + Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/avatars/qr' api_params = {} diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 08e8edf..583647a 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.relationship_type import RelationshipType; from ..enums.relation_mutate import RelationMutate; @@ -7,11 +7,29 @@ class Databases(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Databases, self).__init__(client) - def list(self, queries: List[str] = None, search: str = None): - """List databases""" + def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases' api_params = {} @@ -23,8 +41,29 @@ def list(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, database_id: str, name: str, enabled: bool = None): - """Create database""" + def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Database. + + Parameters + ---------- + database_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Database name. Max length: 128 chars. + enabled : bool + Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases' api_params = {} @@ -43,8 +82,24 @@ def create(self, database_id: str, name: str, enabled: bool = None): 'content-type': 'application/json', }, api_params) - def get(self, database_id: str): - """Get database""" + def get(self, database_id: str) -> Dict[str, Any]: + """ + Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + Parameters + ---------- + database_id : str + Database ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}' api_params = {} @@ -58,8 +113,28 @@ def get(self, database_id: str): 'content-type': 'application/json', }, api_params) - def update(self, database_id: str, name: str, enabled: bool = None): - """Update database""" + def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: + """ + Update a database by its unique ID. + Parameters + ---------- + database_id : str + Database ID. + name : str + Database name. Max length: 128 chars. + enabled : bool + Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}' api_params = {} @@ -78,8 +153,24 @@ def update(self, database_id: str, name: str, enabled: bool = None): 'content-type': 'application/json', }, api_params) - def delete(self, database_id: str): - """Delete database""" + def delete(self, database_id: str) -> Dict[str, Any]: + """ + Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + Parameters + ---------- + database_id : str + Database ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}' api_params = {} @@ -93,8 +184,28 @@ def delete(self, database_id: str): 'content-type': 'application/json', }, api_params) - def list_collections(self, database_id: str, queries: List[str] = None, search: str = None): - """List collections""" + def list_collections(self, database_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + Parameters + ---------- + database_id : str + Database ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections' api_params = {} @@ -110,8 +221,34 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: 'content-type': 'application/json', }, api_params) - 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""" + def create_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Collection name. Max length: 128 chars. + permissions : List[str] + An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + document_security : bool + Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections' api_params = {} @@ -136,8 +273,26 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per 'content-type': 'application/json', }, api_params) - def get_collection(self, database_id: str, collection_id: str): - """Get collection""" + def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any]: + """ + Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -155,8 +310,34 @@ 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[str] = None, document_security: bool = None, enabled: bool = None): - """Update collection""" + def update_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: + """ + Update a collection by its unique ID. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + name : str + Collection name. Max length: 128 chars. + permissions : List[str] + An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + document_security : bool + Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -181,8 +362,26 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per 'content-type': 'application/json', }, api_params) - def delete_collection(self, database_id: str, collection_id: str): - """Delete collection""" + def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, Any]: + """ + Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}' api_params = {} @@ -200,8 +399,28 @@ 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[str] = None): - """List attributes""" + def list_attributes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List attributes in the collection. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes' api_params = {} @@ -220,8 +439,35 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st 'content-type': 'application/json', }, 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""" + def create_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool = None, array: bool = None) -> Dict[str, Any]: + """ + Create a boolean attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : bool + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean' api_params = {} @@ -249,8 +495,34 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st 'content-type': 'application/json', }, 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""" + def update_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool, new_key: str = None) -> Dict[str, Any]: + """ + Update a boolean attribute. Changing the `default` value will not update already existing documents. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : bool + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}' api_params = {} @@ -278,8 +550,34 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st 'content-type': 'application/json', }, 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""" + def create_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create a date time attribute according to the ISO 8601 standard. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime' api_params = {} @@ -307,8 +605,34 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s 'content-type': 'application/json', }, 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""" + def update_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update a date time attribute. Changing the `default` value will not update already existing documents. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}' api_params = {} @@ -336,8 +660,35 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s 'content-type': 'application/json', }, 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""" + def create_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create an email attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email' api_params = {} @@ -365,8 +716,35 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, 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""" + def update_email_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an email attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}' api_params = {} @@ -394,8 +772,37 @@ 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[str], required: bool, default: str = None, array: bool = None): - """Create enum attribute""" + def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + elements : List[str] + Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum' api_params = {} @@ -427,8 +834,37 @@ 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[str], required: bool, default: str, new_key: str = None): - """Update enum attribute""" + def update_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an enum attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + elements : List[str] + Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}' api_params = {} @@ -460,8 +896,39 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a float attribute. Optionally, minimum and maximum values can be provided. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + min : float + Minimum value to enforce on new documents + max : float + Maximum value to enforce on new documents + default : float + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float' api_params = {} @@ -491,8 +958,39 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a float attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : float + Default value for attribute when not provided. Cannot be set when attribute is required. + min : float + Minimum value to enforce on new documents + max : float + Maximum value to enforce on new documents + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}' api_params = {} @@ -522,8 +1020,39 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create an integer attribute. Optionally, minimum and maximum values can be provided. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + min : float + Minimum value to enforce on new documents + max : float + Maximum value to enforce on new documents + default : float + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer' api_params = {} @@ -553,8 +1082,39 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update an integer attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : float + Default value for attribute when not provided. Cannot be set when attribute is required. + min : float + Minimum value to enforce on new documents + max : float + Maximum value to enforce on new documents + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}' api_params = {} @@ -584,8 +1144,35 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st 'content-type': 'application/json', }, 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""" + def create_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create IP address attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip' api_params = {} @@ -613,8 +1200,35 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re 'content-type': 'application/json', }, 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""" + def update_ip_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an ip attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}' api_params = {} @@ -642,8 +1256,39 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + related_collection_id : str + Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + type : RelationshipType + Relation type + two_way : bool + Is Two Way? + key : str + Attribute Key. + two_way_key : str + Two Way Attribute Key. + on_delete : RelationMutate + Constraints option + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship' api_params = {} @@ -673,8 +1318,39 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a string attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + size : float + Attribute size for text attributes, in number of characters. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + encrypt : bool + Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string' api_params = {} @@ -707,8 +1383,37 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str 'content-type': 'application/json', }, 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""" + def update_string_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, size: float = None, new_key: str = None) -> Dict[str, Any]: + """ + Update a string attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + size : float + Maximum size of the string attribute. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}' api_params = {} @@ -737,8 +1442,35 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str 'content-type': 'application/json', }, 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""" + def create_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create a URL attribute. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + array : bool + Is attribute an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url' api_params = {} @@ -766,8 +1498,35 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r 'content-type': 'application/json', }, 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""" + def update_url_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an url attribute. Changing the `default` value will not update already existing documents. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + required : bool + Is attribute required? + default : str + Default value for attribute when not provided. Cannot be set when attribute is required. + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}' api_params = {} @@ -795,8 +1554,28 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r 'content-type': 'application/json', }, api_params) - def get_attribute(self, database_id: str, collection_id: str, key: str): - """Get attribute""" + def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: + """ + Get attribute by ID. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} @@ -818,8 +1597,28 @@ def get_attribute(self, database_id: str, collection_id: str, key: str): 'content-type': 'application/json', }, api_params) - def delete_attribute(self, database_id: str, collection_id: str, key: str): - """Delete attribute""" + def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: + """ + Deletes an attribute. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}' api_params = {} @@ -841,8 +1640,33 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str): 'content-type': 'application/json', }, 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""" + def update_relationship_attribute(self, database_id: str, collection_id: str, key: str, on_delete: RelationMutate = None, new_key: str = None) -> Dict[str, Any]: + """ + Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Attribute Key. + on_delete : RelationMutate + Constraints option + new_key : str + New attribute key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship' api_params = {} @@ -866,8 +1690,28 @@ 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[str] = None): - """List documents""" + def list_documents(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} @@ -886,8 +1730,33 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str 'content-type': 'application/json', }, api_params) - def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None): - """Create document""" + def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: + """ + Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + document_id : str + Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + data : dict + Document data as JSON object. + permissions : List[str] + An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/documents' api_params = {} @@ -914,8 +1783,30 @@ 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[str] = None): - """Get document""" + def get_document(self, database_id: str, collection_id: str, document_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + document_id : str + Document ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -938,8 +1829,32 @@ 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[str] = None): - """Update document""" + def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: + """ + Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + data : dict + Document data as JSON object. Include only attribute and value pairs to be updated. + permissions : List[str] + An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -963,8 +1878,28 @@ def update_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) - def delete_document(self, database_id: str, collection_id: str, document_id: str): - """Delete document""" + def delete_document(self, database_id: str, collection_id: str, document_id: str) -> Dict[str, Any]: + """ + Delete a document by its unique ID. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + document_id : str + Document ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' api_params = {} @@ -986,8 +1921,28 @@ 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[str] = None): - """List indexes""" + def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List indexes in the collection. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} @@ -1006,8 +1961,35 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] 'content-type': 'application/json', }, api_params) - def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None): - """Create index""" + def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None) -> Dict[str, Any]: + """ + Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + Attributes can be `key`, `fulltext`, and `unique`. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Index Key. + type : IndexType + Index type. + attributes : List[str] + Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + orders : List[str] + Array of index orders. Maximum of 100 orders are allowed. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/indexes' api_params = {} @@ -1038,8 +2020,28 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind 'content-type': 'application/json', }, api_params) - def get_index(self, database_id: str, collection_id: str, key: str): - """Get index""" + def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: + """ + Get index by ID. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Index Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} @@ -1061,8 +2063,28 @@ def get_index(self, database_id: str, collection_id: str, key: str): 'content-type': 'application/json', }, api_params) - def delete_index(self, database_id: str, collection_id: str, key: str): - """Delete index""" + def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: + """ + Delete an index. + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + key : str + Index Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}' api_params = {} diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 0c990bd..ce0a60a 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.runtime import Runtime; from ..input_file import InputFile @@ -7,11 +7,29 @@ class Functions(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Functions, self).__init__(client) - def list(self, queries: List[str] = None, search: str = None): - """List functions""" + def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the project's functions. You can use the query params to filter your results. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions' api_params = {} @@ -23,8 +41,66 @@ def list(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + Parameters + ---------- + function_id : str + Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Function name. Max length: 128 chars. + runtime : Runtime + Execution runtime. + execute : List[str] + An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + events : List[str] + Events list. Maximum of 100 events are allowed. + schedule : str + Schedule CRON syntax. + timeout : float + Function maximum execution time in seconds. + enabled : bool + Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + logging : bool + Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. + entrypoint : str + Entrypoint File. This path is relative to the "providerRootDirectory". + commands : str + Build Commands. + scopes : List[str] + List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + installation_id : str + Appwrite Installation ID for VCS (Version Control System) deployment. + provider_repository_id : str + Repository ID of the repo linked to the function. + provider_branch : str + Production branch for the repo linked to the function. + provider_silent_mode : bool + Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + provider_root_directory : str + Path to function code in the linked repo. + template_repository : str + Repository name of the template. + template_owner : str + The name of the owner of the template. + template_root_directory : str + Path to function code in the template repo. + template_version : str + Version (tag) for the repo linked to the function template. + specification : str + Runtime specification for the function and builds. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions' api_params = {} @@ -65,8 +141,19 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st 'content-type': 'application/json', }, api_params) - def list_runtimes(self): - """List runtimes""" + def list_runtimes(self) -> Dict[str, Any]: + """ + Get a list of all runtimes that are currently active on your instance. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/runtimes' api_params = {} @@ -75,8 +162,20 @@ def list_runtimes(self): 'content-type': 'application/json', }, api_params) - def list_specifications(self): - """List available function runtime specifications""" + def list_specifications(self) -> Dict[str, Any]: + """ + List allowed function specifications for this instance. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/specifications' api_params = {} @@ -85,8 +184,24 @@ def list_specifications(self): 'content-type': 'application/json', }, api_params) - def get(self, function_id: str): - """Get function""" + def get(self, function_id: str) -> Dict[str, Any]: + """ + Get a function by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}' api_params = {} @@ -100,8 +215,58 @@ 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[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""" + 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) -> Dict[str, Any]: + """ + Update function by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + name : str + Function name. Max length: 128 chars. + runtime : Runtime + Execution runtime. + execute : List[str] + An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + events : List[str] + Events list. Maximum of 100 events are allowed. + schedule : str + Schedule CRON syntax. + timeout : float + Maximum execution time in seconds. + enabled : bool + Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + logging : bool + Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. + entrypoint : str + Entrypoint File. This path is relative to the "providerRootDirectory". + commands : str + Build Commands. + scopes : List[str] + List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + installation_id : str + Appwrite Installation ID for VCS (Version Controle System) deployment. + provider_repository_id : str + Repository ID of the repo linked to the function + provider_branch : str + Production branch for the repo linked to the function + provider_silent_mode : bool + Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + provider_root_directory : str + Path to function code in the linked repo. + specification : str + Runtime specification for the function and builds. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}' api_params = {} @@ -135,8 +300,24 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: 'content-type': 'application/json', }, api_params) - def delete(self, function_id: str): - """Delete function""" + def delete(self, function_id: str) -> Dict[str, Any]: + """ + Delete a function by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}' api_params = {} @@ -150,8 +331,28 @@ def delete(self, function_id: str): 'content-type': 'application/json', }, api_params) - def list_deployments(self, function_id: str, queries: List[str] = None, search: str = None): - """List deployments""" + def list_deployments(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the project's code deployments. You can use the query params to filter your results. + Parameters + ---------- + function_id : str + Function ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands, type, size + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments' api_params = {} @@ -167,8 +368,38 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: 'content-type': 'application/json', }, api_params) - def create_deployment(self, function_id: str, code: InputFile, activate: bool, entrypoint: str = None, commands: str = 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) -> Dict[str, Any]: + """ + Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + + This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + + Use the "command" param to set the entrypoint used to execute your code. + Parameters + ---------- + function_id : str + Function ID. + code : InputFile + Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + activate : bool + Automatically activate the deployment when it is finished building. + entrypoint : str + Entrypoint File. + commands : str + Build Commands. + on_progress : callable, optional + Optional callback for upload progress + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments' api_params = {} @@ -197,8 +428,26 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) - def get_deployment(self, function_id: str, deployment_id: str): - """Get deployment""" + def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Get a code deployment by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -216,8 +465,26 @@ def get_deployment(self, function_id: str, deployment_id: str): 'content-type': 'application/json', }, api_params) - def update_deployment(self, function_id: str, deployment_id: str): - """Update deployment""" + def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -235,8 +502,26 @@ def update_deployment(self, function_id: str, deployment_id: str): 'content-type': 'application/json', }, api_params) - def delete_deployment(self, function_id: str, deployment_id: str): - """Delete deployment""" + def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Delete a code deployment by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} @@ -254,8 +539,28 @@ def delete_deployment(self, function_id: str, deployment_id: str): 'content-type': 'application/json', }, api_params) - def create_build(self, function_id: str, deployment_id: str, build_id: str = None): - """Rebuild deployment""" + def create_build(self, function_id: str, deployment_id: str, build_id: str = None) -> Dict[str, Any]: + """ + Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + build_id : str + Build unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} @@ -274,8 +579,26 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non 'content-type': 'application/json', }, api_params) - def update_deployment_build(self, function_id: str, deployment_id: str): - """Cancel deployment""" + def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}/build' api_params = {} @@ -293,8 +616,26 @@ def update_deployment_build(self, function_id: str, deployment_id: str): 'content-type': 'application/json', }, api_params) - def get_deployment_download(self, function_id: str, deployment_id: str): - """Download deployment""" + def get_deployment_download(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/deployments/{deploymentId}/download' api_params = {} @@ -312,8 +653,28 @@ 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[str] = None, search: str = None): - """List executions""" + def list_executions(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the current user function execution logs. You can use the query params to filter your results. + Parameters + ---------- + function_id : str + Function ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/executions' api_params = {} @@ -329,8 +690,36 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + Parameters + ---------- + function_id : str + Function ID. + body : str + HTTP body of execution. Default value is empty string. + xasync : bool + Execute code in the background. Default value is false. + path : str + HTTP path of execution. Path can include query params. Default value is / + method : ExecutionMethod + HTTP method of execution. Default value is GET. + headers : dict + HTTP headers of execution. Defaults to empty. + scheduled_at : str + Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/executions' api_params = {} @@ -350,8 +739,26 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No 'content-type': 'application/json', }, api_params) - def get_execution(self, function_id: str, execution_id: str): - """Get execution""" + def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: + """ + Get a function execution log by its unique ID. + Parameters + ---------- + function_id : str + Function ID. + execution_id : str + Execution ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} @@ -369,8 +776,27 @@ def get_execution(self, function_id: str, execution_id: str): 'content-type': 'application/json', }, api_params) - def delete_execution(self, function_id: str, execution_id: str): - """Delete execution""" + def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: + """ + Delete a function execution by its unique ID. + + Parameters + ---------- + function_id : str + Function ID. + execution_id : str + Execution ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/executions/{executionId}' api_params = {} @@ -388,8 +814,24 @@ def delete_execution(self, function_id: str, execution_id: str): 'content-type': 'application/json', }, api_params) - def list_variables(self, function_id: str): - """List variables""" + def list_variables(self, function_id: str) -> Dict[str, Any]: + """ + Get a list of all variables of a specific function. + Parameters + ---------- + function_id : str + Function unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/variables' api_params = {} @@ -403,8 +845,28 @@ def list_variables(self, function_id: str): 'content-type': 'application/json', }, api_params) - def create_variable(self, function_id: str, key: str, value: str): - """Create variable""" + def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, Any]: + """ + Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + Parameters + ---------- + function_id : str + Function unique ID. + key : str + Variable key. Max length: 255 chars. + value : str + Variable value. Max length: 8192 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/variables' api_params = {} @@ -426,8 +888,26 @@ def create_variable(self, function_id: str, key: str, value: str): 'content-type': 'application/json', }, api_params) - def get_variable(self, function_id: str, variable_id: str): - """Get variable""" + def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: + """ + Get a variable by its unique ID. + Parameters + ---------- + function_id : str + Function unique ID. + variable_id : str + Variable unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} @@ -445,8 +925,30 @@ def get_variable(self, function_id: str, variable_id: str): 'content-type': 'application/json', }, api_params) - def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None): - """Update variable""" + def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]: + """ + Update variable by its unique ID. + Parameters + ---------- + function_id : str + Function unique ID. + variable_id : str + Variable unique ID. + key : str + Variable key. Max length: 255 chars. + value : str + Variable value. Max length: 8192 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} @@ -469,8 +971,26 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s 'content-type': 'application/json', }, api_params) - def delete_variable(self, function_id: str, variable_id: str): - """Delete variable""" + def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: + """ + Delete a variable by its unique ID. + Parameters + ---------- + function_id : str + Function unique ID. + variable_id : str + Variable unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/functions/{functionId}/variables/{variableId}' api_params = {} diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 4a0fd36..0981afa 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -1,14 +1,30 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException class Graphql(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Graphql, self).__init__(client) - def query(self, query: dict): - """GraphQL endpoint""" + def query(self, query: dict) -> Dict[str, Any]: + """ + Execute a GraphQL mutation. + Parameters + ---------- + query : dict + The query or queries to execute. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/graphql' api_params = {} @@ -23,8 +39,24 @@ def query(self, query: dict): 'content-type': 'application/json', }, api_params) - def mutation(self, query: dict): - """GraphQL endpoint""" + def mutation(self, query: dict) -> Dict[str, Any]: + """ + Execute a GraphQL mutation. + Parameters + ---------- + query : dict + The query or queries to execute. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/graphql/mutation' api_params = {} diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 014b536..0007496 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -1,15 +1,26 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.name import Name; class Health(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Health, self).__init__(client) - def get(self): - """Get HTTP""" + def get(self) -> Dict[str, Any]: + """ + Check the Appwrite HTTP server is up and responsive. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health' api_params = {} @@ -18,8 +29,19 @@ def get(self): 'content-type': 'application/json', }, api_params) - def get_antivirus(self): - """Get antivirus""" + def get_antivirus(self) -> Dict[str, Any]: + """ + Check the Appwrite Antivirus server is up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/anti-virus' api_params = {} @@ -28,8 +50,19 @@ def get_antivirus(self): 'content-type': 'application/json', }, api_params) - def get_cache(self): - """Get cache""" + def get_cache(self) -> Dict[str, Any]: + """ + Check the Appwrite in-memory cache servers are up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/cache' api_params = {} @@ -38,8 +71,24 @@ def get_cache(self): 'content-type': 'application/json', }, api_params) - def get_certificate(self, domain: str = None): - """Get the SSL certificate for a domain""" + def get_certificate(self, domain: str = None) -> Dict[str, Any]: + """ + Get the SSL certificate for a domain + Parameters + ---------- + domain : str + string + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/certificate' api_params = {} @@ -50,8 +99,19 @@ def get_certificate(self, domain: str = None): 'content-type': 'application/json', }, api_params) - def get_db(self): - """Get DB""" + def get_db(self) -> Dict[str, Any]: + """ + Check the Appwrite database servers are up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/db' api_params = {} @@ -60,8 +120,19 @@ def get_db(self): 'content-type': 'application/json', }, api_params) - def get_pub_sub(self): - """Get pubsub""" + def get_pub_sub(self) -> Dict[str, Any]: + """ + Check the Appwrite pub-sub servers are up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/pubsub' api_params = {} @@ -70,8 +141,24 @@ def get_pub_sub(self): 'content-type': 'application/json', }, api_params) - def get_queue_builds(self, threshold: float = None): - """Get builds queue""" + def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/builds' api_params = {} @@ -82,8 +169,24 @@ def get_queue_builds(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_certificates(self, threshold: float = None): - """Get certificates queue""" + def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/certificates' api_params = {} @@ -94,8 +197,26 @@ def get_queue_certificates(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_databases(self, name: str = None, threshold: float = None): - """Get databases queue""" + def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + name : str + Queue name for which to check the queue size + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/databases' api_params = {} @@ -107,8 +228,24 @@ def get_queue_databases(self, name: str = None, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_deletes(self, threshold: float = None): - """Get deletes queue""" + def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/deletes' api_params = {} @@ -119,8 +256,27 @@ def get_queue_deletes(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_failed_jobs(self, name: Name, threshold: float = None): - """Get number of failed queue jobs""" + def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any]: + """ + Returns the amount of failed jobs in a given queue. + + Parameters + ---------- + name : Name + The name of the queue + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/failed/{name}' api_params = {} @@ -135,8 +291,24 @@ def get_failed_jobs(self, name: Name, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_functions(self, threshold: float = None): - """Get functions queue""" + def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/functions' api_params = {} @@ -147,8 +319,24 @@ def get_queue_functions(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_logs(self, threshold: float = None): - """Get logs queue""" + def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/logs' api_params = {} @@ -159,8 +347,24 @@ def get_queue_logs(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_mails(self, threshold: float = None): - """Get mails queue""" + def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/mails' api_params = {} @@ -171,8 +375,24 @@ def get_queue_mails(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_messaging(self, threshold: float = None): - """Get messaging queue""" + def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/messaging' api_params = {} @@ -183,8 +403,24 @@ def get_queue_messaging(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_migrations(self, threshold: float = None): - """Get migrations queue""" + def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/migrations' api_params = {} @@ -195,8 +431,24 @@ def get_queue_migrations(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_stats_resources(self, threshold: float = None): - """Get stats resources queue""" + def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/stats-resources' api_params = {} @@ -207,8 +459,24 @@ def get_queue_stats_resources(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_usage(self, threshold: float = None): - """Get stats usage queue""" + def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/stats-usage' api_params = {} @@ -219,8 +487,24 @@ def get_queue_usage(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_stats_usage_dump(self, threshold: float = None): - """Get usage dump queue""" + def get_queue_stats_usage_dump(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/stats-usage-dump' api_params = {} @@ -231,8 +515,24 @@ def get_queue_stats_usage_dump(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_queue_webhooks(self, threshold: float = None): - """Get webhooks queue""" + def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: + """ + Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + Parameters + ---------- + threshold : float + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/queue/webhooks' api_params = {} @@ -243,8 +543,19 @@ def get_queue_webhooks(self, threshold: float = None): 'content-type': 'application/json', }, api_params) - def get_storage(self): - """Get storage""" + def get_storage(self) -> Dict[str, Any]: + """ + Check the Appwrite storage device is up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/storage' api_params = {} @@ -253,8 +564,19 @@ def get_storage(self): 'content-type': 'application/json', }, api_params) - def get_storage_local(self): - """Get local storage""" + def get_storage_local(self) -> Dict[str, Any]: + """ + Check the Appwrite local storage device is up and connection is successful. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/storage/local' api_params = {} @@ -263,8 +585,19 @@ def get_storage_local(self): 'content-type': 'application/json', }, api_params) - def get_time(self): - """Get time""" + def get_time(self) -> Dict[str, Any]: + """ + Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/health/time' api_params = {} diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 6c14eaf..3f137a5 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -1,14 +1,27 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException class Locale(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Locale, self).__init__(client) - def get(self): - """Get user locale""" + def get(self) -> Dict[str, Any]: + """ + Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + + ([IP Geolocation by DB-IP](https://db-ip.com)) + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale' api_params = {} @@ -17,8 +30,19 @@ def get(self): 'content-type': 'application/json', }, api_params) - def list_codes(self): - """List locale codes""" + def list_codes(self) -> Dict[str, Any]: + """ + List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/codes' api_params = {} @@ -27,8 +51,19 @@ def list_codes(self): 'content-type': 'application/json', }, api_params) - def list_continents(self): - """List continents""" + def list_continents(self) -> Dict[str, Any]: + """ + List of all continents. You can use the locale header to get the data in a supported language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/continents' api_params = {} @@ -37,8 +72,19 @@ def list_continents(self): 'content-type': 'application/json', }, api_params) - def list_countries(self): - """List countries""" + def list_countries(self) -> Dict[str, Any]: + """ + List of all countries. You can use the locale header to get the data in a supported language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/countries' api_params = {} @@ -47,8 +93,19 @@ def list_countries(self): 'content-type': 'application/json', }, api_params) - def list_countries_eu(self): - """List EU countries""" + def list_countries_eu(self) -> Dict[str, Any]: + """ + List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/countries/eu' api_params = {} @@ -57,8 +114,19 @@ def list_countries_eu(self): 'content-type': 'application/json', }, api_params) - def list_countries_phones(self): - """List countries phone codes""" + def list_countries_phones(self) -> Dict[str, Any]: + """ + List of all countries phone codes. You can use the locale header to get the data in a supported language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/countries/phones' api_params = {} @@ -67,8 +135,19 @@ def list_countries_phones(self): 'content-type': 'application/json', }, api_params) - def list_currencies(self): - """List currencies""" + def list_currencies(self) -> Dict[str, Any]: + """ + List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/currencies' api_params = {} @@ -77,8 +156,19 @@ def list_currencies(self): 'content-type': 'application/json', }, api_params) - def list_languages(self): - """List languages""" + def list_languages(self) -> Dict[str, Any]: + """ + List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/locale/languages' api_params = {} diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 9b41d18..d3aa1fb 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -1,16 +1,34 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.message_priority import MessagePriority; from ..enums.smtp_encryption import SmtpEncryption; class Messaging(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Messaging, self).__init__(client) - def list_messages(self, queries: List[str] = None, search: str = None): - """List messages""" + def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all messages from the current Appwrite project. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages' api_params = {} @@ -22,8 +40,46 @@ def list_messages(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Create a new email message. + Parameters + ---------- + message_id : str + Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + subject : str + Email Subject. + content : str + Email Content. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + cc : List[str] + Array of target IDs to be added as CC. + bcc : List[str] + Array of target IDs to be added as BCC. + attachments : List[str] + Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + draft : bool + Is message a draft + html : bool + Is content of type HTML + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/email' api_params = {} @@ -54,8 +110,47 @@ 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[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""" + 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) -> Dict[str, Any]: + """ + Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + + Parameters + ---------- + message_id : str + Message ID. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + subject : str + Email Subject. + content : str + Email Content. + draft : bool + Is message a draft + html : bool + Is content of type HTML + cc : List[str] + Array of target IDs to be added as CC. + bcc : List[str] + Array of target IDs to be added as BCC. + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + attachments : List[str] + Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/email/{messageId}' api_params = {} @@ -80,8 +175,60 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Create a new push notification. + Parameters + ---------- + message_id : str + Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + title : str + Title for push notification. + body : str + Body for push notification. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + data : dict + Additional key-value pair data for push notification. + action : str + Action for push notification. + image : str + Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + icon : str + Icon for push notification. Available only for Android and Web Platform. + sound : str + Sound for push notification. Available only for Android and iOS Platform. + color : str + Color for push notification. Available only for Android Platform. + tag : str + Tag for push notification. Available only for Android Platform. + badge : float + Badge for push notification. Available only for iOS Platform. + draft : bool + Is message a draft + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + content_available : bool + If set to true, the notification will be delivered in the background. Available only for iOS Platform. + critical : bool + If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + priority : MessagePriority + Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/push' api_params = {} @@ -113,8 +260,61 @@ 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[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""" + 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) -> Dict[str, Any]: + """ + Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + + Parameters + ---------- + message_id : str + Message ID. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + title : str + Title for push notification. + body : str + Body for push notification. + data : dict + Additional Data for push notification. + action : str + Action for push notification. + image : str + Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + icon : str + Icon for push notification. Available only for Android and Web platforms. + sound : str + Sound for push notification. Available only for Android and iOS platforms. + color : str + Color for push notification. Available only for Android platforms. + tag : str + Tag for push notification. Available only for Android platforms. + badge : float + Badge for push notification. Available only for iOS platforms. + draft : bool + Is message a draft + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + content_available : bool + If set to true, the notification will be delivered in the background. Available only for iOS Platform. + critical : bool + If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + priority : MessagePriority + Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/push/{messageId}' api_params = {} @@ -146,8 +346,36 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Create a new SMS message. + Parameters + ---------- + message_id : str + Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + content : str + SMS Content. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + draft : bool + Is message a draft + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/sms' api_params = {} @@ -170,8 +398,37 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + + Parameters + ---------- + message_id : str + Message ID. + topics : List[str] + List of Topic IDs. + users : List[str] + List of User IDs. + targets : List[str] + List of Targets IDs. + content : str + Email Content. + draft : bool + Is message a draft + scheduled_at : str + Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/sms/{messageId}' api_params = {} @@ -191,8 +448,25 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] 'content-type': 'application/json', }, api_params) - def get_message(self, message_id: str): - """Get message""" + def get_message(self, message_id: str) -> Dict[str, Any]: + """ + Get a message by its unique ID. + + Parameters + ---------- + message_id : str + Message ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/{messageId}' api_params = {} @@ -206,8 +480,24 @@ def get_message(self, message_id: str): 'content-type': 'application/json', }, api_params) - def delete(self, message_id: str): - """Delete message""" + def delete(self, message_id: str) -> Dict[str, Any]: + """ + Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + Parameters + ---------- + message_id : str + Message ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/{messageId}' api_params = {} @@ -221,8 +511,26 @@ def delete(self, message_id: str): 'content-type': 'application/json', }, api_params) - def list_message_logs(self, message_id: str, queries: List[str] = None): - """List message logs""" + def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the message activity logs listed by its unique ID. + Parameters + ---------- + message_id : str + Message ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/{messageId}/logs' api_params = {} @@ -237,8 +545,26 @@ def list_message_logs(self, message_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_targets(self, message_id: str, queries: List[str] = None): - """List message targets""" + def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a list of the targets associated with a message. + Parameters + ---------- + message_id : str + Message ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/messages/{messageId}/targets' api_params = {} @@ -253,8 +579,26 @@ def list_targets(self, message_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_providers(self, queries: List[str] = None, search: str = None): - """List providers""" + def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all providers from the current Appwrite project. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers' api_params = {} @@ -266,8 +610,38 @@ def list_providers(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new Apple Push Notification service provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + auth_key : str + APNS authentication key. + auth_key_id : str + APNS authentication key ID. + team_id : str + APNS team ID. + bundle_id : str + APNS bundle ID. + sandbox : bool + Use APNS sandbox environment. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/apns' api_params = {} @@ -291,8 +665,38 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Apple Push Notification service provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + auth_key : str + APNS authentication key. + auth_key_id : str + APNS authentication key ID. + team_id : str + APNS team ID. + bundle_id : str + APNS bundle ID. + sandbox : bool + Use APNS sandbox environment. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/apns/{providerId}' api_params = {} @@ -313,8 +717,30 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool 'content-type': 'application/json', }, api_params) - def create_fcm_provider(self, provider_id: str, name: str, service_account_json: dict = None, enabled: bool = None): - """Create FCM provider""" + def create_fcm_provider(self, provider_id: str, name: str, service_account_json: dict = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Firebase Cloud Messaging provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + service_account_json : dict + FCM service account JSON. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/fcm' api_params = {} @@ -334,8 +760,30 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: 'content-type': 'application/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""" + def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool = None, service_account_json: dict = None) -> Dict[str, Any]: + """ + Update a Firebase Cloud Messaging provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + service_account_json : dict + FCM service account JSON. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/fcm/{providerId}' api_params = {} @@ -352,8 +800,42 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new Mailgun provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + api_key : str + Mailgun API Key. + domain : str + Mailgun Domain. + is_eu_region : bool + Set as EU region. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. + reply_to_email : str + Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/mailgun' api_params = {} @@ -379,8 +861,42 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Mailgun provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + api_key : str + Mailgun API Key. + domain : str + Mailgun Domain. + is_eu_region : bool + Set as EU region. + enabled : bool + Set as enabled. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the reply to field for the mail. Default value is sender name. + reply_to_email : str + Email set in the reply to field for the mail. Default value is sender email. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/mailgun/{providerId}' api_params = {} @@ -403,8 +919,34 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new MSG91 provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + template_id : str + Msg91 template ID + sender_id : str + Msg91 sender ID. + auth_key : str + Msg91 auth key. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/msg91' api_params = {} @@ -426,8 +968,34 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a MSG91 provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + template_id : str + Msg91 template ID. + sender_id : str + Msg91 sender ID. + auth_key : str + Msg91 auth key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/msg91/{providerId}' api_params = {} @@ -446,8 +1014,38 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new Sendgrid provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + api_key : str + Sendgrid API key. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the reply to field for the mail. Default value is sender name. + reply_to_email : str + Email set in the reply to field for the mail. Default value is sender email. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/sendgrid' api_params = {} @@ -471,8 +1069,38 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Sendgrid provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + api_key : str + Sendgrid API key. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the Reply To field for the mail. Default value is Sender Name. + reply_to_email : str + Email set in the Reply To field for the mail. Default value is Sender Email. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/sendgrid/{providerId}' api_params = {} @@ -493,8 +1121,50 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new SMTP provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + host : str + SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + port : float + The default SMTP server port. + username : str + Authentication username. + password : str + Authentication password. + encryption : SmtpEncryption + Encryption type. Can be omitted, 'ssl', or 'tls' + auto_tls : bool + Enable SMTP AutoTLS feature. + mailer : str + The value to use for the X-Mailer header. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the reply to field for the mail. Default value is sender name. + reply_to_email : str + Email set in the reply to field for the mail. Default value is sender email. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/smtp' api_params = {} @@ -527,8 +1197,50 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a SMTP provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + host : str + SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + port : float + SMTP port. + username : str + Authentication username. + password : str + Authentication password. + encryption : SmtpEncryption + Encryption type. Can be 'ssl' or 'tls' + auto_tls : bool + Enable SMTP AutoTLS feature. + mailer : str + The value to use for the X-Mailer header. + from_name : str + Sender Name. + from_email : str + Sender email address. + reply_to_name : str + Name set in the Reply To field for the mail. Default value is Sender Name. + reply_to_email : str + Email set in the Reply To field for the mail. Default value is Sender Email. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/smtp/{providerId}' api_params = {} @@ -555,8 +1267,34 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N 'content-type': 'application/json', }, 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""" + def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = None, customer_id: str = None, api_key: str = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Telesign provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + xfrom : str + Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + customer_id : str + Telesign customer ID. + api_key : str + Telesign API key. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/telesign' api_params = {} @@ -578,8 +1316,34 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Telesign provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + customer_id : str + Telesign customer ID. + api_key : str + Telesign API key. + xfrom : str + Sender number. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/telesign/{providerId}' api_params = {} @@ -598,8 +1362,34 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: 'content-type': 'application/json', }, 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""" + def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = None, username: str = None, api_key: str = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Textmagic provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + xfrom : str + Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + username : str + Textmagic username. + api_key : str + Textmagic apiKey. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/textmagic' api_params = {} @@ -621,8 +1411,34 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No 'content-type': 'application/json', }, 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""" + def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: bool = None, username: str = None, api_key: str = None, xfrom: str = None) -> Dict[str, Any]: + """ + Update a Textmagic provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + username : str + Textmagic username. + api_key : str + Textmagic apiKey. + xfrom : str + Sender number. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/textmagic/{providerId}' api_params = {} @@ -641,8 +1457,34 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: 'content-type': 'application/json', }, 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""" + def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, account_sid: str = None, auth_token: str = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Twilio provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + xfrom : str + Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + account_sid : str + Twilio account secret ID. + auth_token : str + Twilio authentication token. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/twilio' api_params = {} @@ -664,8 +1506,34 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Twilio provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + account_sid : str + Twilio account secret ID. + auth_token : str + Twilio authentication token. + xfrom : str + Sender number. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/twilio/{providerId}' api_params = {} @@ -684,8 +1552,34 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo 'content-type': 'application/json', }, 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""" + def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, api_key: str = None, api_secret: str = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Vonage provider. + Parameters + ---------- + provider_id : str + Provider ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Provider name. + xfrom : str + Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + api_key : str + Vonage API key. + api_secret : str + Vonage API secret. + enabled : bool + Set as enabled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/vonage' api_params = {} @@ -707,8 +1601,34 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Update a Vonage provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + name : str + Provider name. + enabled : bool + Set as enabled. + api_key : str + Vonage API key. + api_secret : str + Vonage API secret. + xfrom : str + Sender number. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/vonage/{providerId}' api_params = {} @@ -727,8 +1647,25 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo 'content-type': 'application/json', }, api_params) - def get_provider(self, provider_id: str): - """Get provider""" + def get_provider(self, provider_id: str) -> Dict[str, Any]: + """ + Get a provider by its unique ID. + + Parameters + ---------- + provider_id : str + Provider ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/{providerId}' api_params = {} @@ -742,8 +1679,24 @@ def get_provider(self, provider_id: str): 'content-type': 'application/json', }, api_params) - def delete_provider(self, provider_id: str): - """Delete provider""" + def delete_provider(self, provider_id: str) -> Dict[str, Any]: + """ + Delete a provider by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/{providerId}' api_params = {} @@ -757,8 +1710,26 @@ def delete_provider(self, provider_id: str): 'content-type': 'application/json', }, api_params) - def list_provider_logs(self, provider_id: str, queries: List[str] = None): - """List provider logs""" + def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the provider activity logs listed by its unique ID. + Parameters + ---------- + provider_id : str + Provider ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/providers/{providerId}/logs' api_params = {} @@ -773,8 +1744,26 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None): - """List subscriber logs""" + def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the subscriber activity logs listed by its unique ID. + Parameters + ---------- + subscriber_id : str + Subscriber ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/subscribers/{subscriberId}/logs' api_params = {} @@ -789,8 +1778,26 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_topics(self, queries: List[str] = None, search: str = None): - """List topics""" + def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all topics from the current Appwrite project. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics' api_params = {} @@ -802,8 +1809,28 @@ def list_topics(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None): - """Create topic""" + def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> Dict[str, Any]: + """ + Create a new topic. + Parameters + ---------- + topic_id : str + Topic ID. Choose a custom Topic ID or a new Topic ID. + name : str + Topic Name. + subscribe : List[str] + An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics' api_params = {} @@ -822,8 +1849,25 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None): 'content-type': 'application/json', }, api_params) - def get_topic(self, topic_id: str): - """Get topic""" + def get_topic(self, topic_id: str) -> Dict[str, Any]: + """ + Get a topic by its unique ID. + + Parameters + ---------- + topic_id : str + Topic ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}' api_params = {} @@ -837,8 +1881,29 @@ 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[str] = None): - """Update topic""" + def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = None) -> Dict[str, Any]: + """ + Update a topic by its unique ID. + + Parameters + ---------- + topic_id : str + Topic ID. + name : str + Topic Name. + subscribe : List[str] + An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}' api_params = {} @@ -854,8 +1919,24 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N 'content-type': 'application/json', }, api_params) - def delete_topic(self, topic_id: str): - """Delete topic""" + def delete_topic(self, topic_id: str) -> Dict[str, Any]: + """ + Delete a topic by its unique ID. + Parameters + ---------- + topic_id : str + Topic ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}' api_params = {} @@ -869,8 +1950,26 @@ def delete_topic(self, topic_id: str): 'content-type': 'application/json', }, api_params) - def list_topic_logs(self, topic_id: str, queries: List[str] = None): - """List topic logs""" + def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the topic activity logs listed by its unique ID. + Parameters + ---------- + topic_id : str + Topic ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}/logs' api_params = {} @@ -885,8 +1984,28 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str = None): - """List subscribers""" + def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all subscribers from the current Appwrite project. + Parameters + ---------- + topic_id : str + Topic ID. The topic ID subscribed to. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} @@ -902,8 +2021,28 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str 'content-type': 'application/json', }, api_params) - def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str): - """Create subscriber""" + def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) -> Dict[str, Any]: + """ + Create a new subscriber. + Parameters + ---------- + topic_id : str + Topic ID. The topic ID to subscribe to. + subscriber_id : str + Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. + target_id : str + Target ID. The target ID to link to the specified Topic ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}/subscribers' api_params = {} @@ -925,8 +2064,27 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str): 'content-type': 'application/json', }, api_params) - def get_subscriber(self, topic_id: str, subscriber_id: str): - """Get subscriber""" + def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: + """ + Get a subscriber by its unique ID. + + Parameters + ---------- + topic_id : str + Topic ID. The topic ID subscribed to. + subscriber_id : str + Subscriber ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} @@ -944,8 +2102,26 @@ def get_subscriber(self, topic_id: str, subscriber_id: str): 'content-type': 'application/json', }, api_params) - def delete_subscriber(self, topic_id: str, subscriber_id: str): - """Delete subscriber""" + def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: + """ + Delete a subscriber by its unique ID. + Parameters + ---------- + topic_id : str + Topic ID. The topic ID subscribed to. + subscriber_id : str + Subscriber ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/messaging/topics/{topicId}/subscribers/{subscriberId}' api_params = {} diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index ac73261..c1d6d58 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.compression import Compression; from ..input_file import InputFile @@ -8,11 +8,29 @@ class Storage(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Storage, self).__init__(client) - def list_buckets(self, queries: List[str] = None, search: str = None): - """List buckets""" + def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the storage buckets. You can use the query params to filter your results. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets' api_params = {} @@ -24,8 +42,42 @@ def list_buckets(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Create a new storage bucket. + Parameters + ---------- + bucket_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Bucket name + permissions : List[str] + An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + file_security : bool + Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + maximum_file_size : float + Maximum file size allowed in bytes. Maximum allowed value is 30MB. + allowed_file_extensions : List[str] + Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + compression : Compression + Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + encryption : bool + Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + antivirus : bool + Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets' api_params = {} @@ -51,8 +103,24 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None 'content-type': 'application/json', }, api_params) - def get_bucket(self, bucket_id: str): - """Get bucket""" + def get_bucket(self, bucket_id: str) -> Dict[str, Any]: + """ + Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + Parameters + ---------- + bucket_id : str + Bucket unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -66,8 +134,42 @@ def get_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Update a storage bucket by its unique ID. + Parameters + ---------- + bucket_id : str + Bucket unique ID. + name : str + Bucket name + permissions : List[str] + An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + file_security : bool + Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + maximum_file_size : float + Maximum file size allowed in bytes. Maximum allowed value is 30MB. + allowed_file_extensions : List[str] + Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + compression : Compression + Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + encryption : bool + Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + antivirus : bool + Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -93,8 +195,24 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None 'content-type': 'application/json', }, api_params) - def delete_bucket(self, bucket_id: str): - """Delete bucket""" + def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: + """ + Delete a storage bucket by its unique ID. + Parameters + ---------- + bucket_id : str + Bucket unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}' api_params = {} @@ -108,8 +226,28 @@ def delete_bucket(self, bucket_id: str): 'content-type': 'application/json', }, api_params) - def list_files(self, bucket_id: str, queries: List[str] = None, search: str = None): - """List files""" + def list_files(self, bucket_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the user files. You can use the query params to filter your results. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files' api_params = {} @@ -125,8 +263,39 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No 'content-type': 'application/json', }, api_params) - def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: List[str] = None, on_progress = None): - """Create file""" + def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: List[str] = None, on_progress = None) -> Dict[str, Any]: + """ + Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. + + Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + + When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + + If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + file : InputFile + Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). + permissions : List[str] + An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + on_progress : callable, optional + Optional callback for upload progress + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files' api_params = {} @@ -155,8 +324,26 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) - def get_file(self, bucket_id: str, file_id: str): - """Get file""" + def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + """ + Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -174,8 +361,30 @@ 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[str] = None): - """Update file""" + def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: List[str] = None) -> Dict[str, Any]: + """ + Update a file by its unique ID. Only users with write permissions have access to update this resource. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File unique ID. + name : str + Name of the file + permissions : List[str] + An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -195,8 +404,26 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission 'content-type': 'application/json', }, api_params) - def delete_file(self, bucket_id: str, file_id: str): - """Delete file""" + def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + """ + Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}' api_params = {} @@ -214,8 +441,26 @@ def delete_file(self, bucket_id: str, file_id: str): 'content-type': 'application/json', }, api_params) - def get_file_download(self, bucket_id: str, file_id: str): - """Get file for download""" + def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + """ + Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters + ---------- + bucket_id : str + Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}/download' api_params = {} @@ -233,8 +478,48 @@ def get_file_download(self, bucket_id: str, file_id: str): 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID + width : float + Resize preview image width, Pass an integer between 0 to 4000. + height : float + Resize preview image height, Pass an integer between 0 to 4000. + gravity : ImageGravity + Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right + quality : float + Preview image quality. Pass an integer between 0 to 100. Defaults to 100. + border_width : float + Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. + border_color : str + Preview image border color. Use a valid HEX color, no # is needed for prefix. + border_radius : float + Preview image border radius in pixels. Pass an integer between 0 to 4000. + opacity : float + Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. + rotation : float + Preview image rotation in degrees. Pass an integer between -360 and 360. + background : str + Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. + output : ImageFormat + Output format type (jpeg, jpg, png, gif and webp). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview' api_params = {} @@ -263,8 +548,26 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he 'content-type': 'application/json', }, api_params) - def get_file_view(self, bucket_id: str, file_id: str): - """Get file for view""" + def get_file_view(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + """ + Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/storage/buckets/{bucketId}/files/{fileId}/view' api_params = {} diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index fd28540..f330966 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -1,14 +1,32 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException class Teams(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Teams, self).__init__(client) - def list(self, queries: List[str] = None, search: str = None): - """List teams""" + def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams' api_params = {} @@ -20,8 +38,28 @@ def list(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, team_id: str, name: str, roles: List[str] = None): - """Create team""" + def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, Any]: + """ + Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + Parameters + ---------- + team_id : str + Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Team name. Max length: 128 chars. + roles : List[str] + Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams' api_params = {} @@ -40,8 +78,24 @@ def create(self, team_id: str, name: str, roles: List[str] = None): 'content-type': 'application/json', }, api_params) - def get(self, team_id: str): - """Get team""" + def get(self, team_id: str) -> Dict[str, Any]: + """ + Get a team by its ID. All team members have read access for this resource. + Parameters + ---------- + team_id : str + Team ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}' api_params = {} @@ -55,8 +109,26 @@ def get(self, team_id: str): 'content-type': 'application/json', }, api_params) - def update_name(self, team_id: str, name: str): - """Update name""" + def update_name(self, team_id: str, name: str) -> Dict[str, Any]: + """ + Update the team's name by its unique ID. + Parameters + ---------- + team_id : str + Team ID. + name : str + New team name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}' api_params = {} @@ -74,8 +146,24 @@ def update_name(self, team_id: str, name: str): 'content-type': 'application/json', }, api_params) - def delete(self, team_id: str): - """Delete team""" + def delete(self, team_id: str) -> Dict[str, Any]: + """ + Delete a team using its ID. Only team members with the owner role can delete the team. + Parameters + ---------- + team_id : str + Team ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}' api_params = {} @@ -89,8 +177,28 @@ def delete(self, team_id: str): 'content-type': 'application/json', }, api_params) - def list_memberships(self, team_id: str, queries: List[str] = None, search: str = None): - """List team memberships""" + def list_memberships(self, team_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters + ---------- + team_id : str + Team ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships' api_params = {} @@ -106,8 +214,43 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str 'content-type': 'application/json', }, api_params) - 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""" + 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) -> Dict[str, Any]: + """ + Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. + + You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + + Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + + Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + + Parameters + ---------- + team_id : str + Team ID. + roles : List[str] + Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + email : str + Email of the new team member. + user_id : str + ID of the user to be added to a team. + phone : str + Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + url : str + URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. + name : str + Name of the new team member. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships' api_params = {} @@ -130,8 +273,26 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u 'content-type': 'application/json', }, api_params) - def get_membership(self, team_id: str, membership_id: str): - """Get team membership""" + def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: + """ + Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters + ---------- + team_id : str + Team ID. + membership_id : str + Membership ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -149,8 +310,29 @@ 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[str]): - """Update membership""" + def update_membership(self, team_id: str, membership_id: str, roles: List[str]) -> Dict[str, Any]: + """ + Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + + Parameters + ---------- + team_id : str + Team ID. + membership_id : str + Membership ID. + roles : List[str] + An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -172,8 +354,26 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]): 'content-type': 'application/json', }, api_params) - def delete_membership(self, team_id: str, membership_id: str): - """Delete team membership""" + def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: + """ + This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + Parameters + ---------- + team_id : str + Team ID. + membership_id : str + Membership ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships/{membershipId}' api_params = {} @@ -191,8 +391,33 @@ def delete_membership(self, team_id: str, membership_id: str): 'content-type': 'application/json', }, api_params) - def update_membership_status(self, team_id: str, membership_id: str, user_id: str, secret: str): - """Update team membership status""" + def update_membership_status(self, team_id: str, membership_id: str, user_id: str, secret: str) -> Dict[str, Any]: + """ + Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. + + If the request is successful, a session for the user is automatically created. + + Parameters + ---------- + team_id : str + Team ID. + membership_id : str + Membership ID. + user_id : str + User ID. + secret : str + Secret key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/memberships/{membershipId}/status' api_params = {} @@ -218,8 +443,24 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st 'content-type': 'application/json', }, api_params) - def get_prefs(self, team_id: str): - """Get team preferences""" + def get_prefs(self, team_id: str) -> Dict[str, Any]: + """ + Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + Parameters + ---------- + team_id : str + Team ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/prefs' api_params = {} @@ -233,8 +474,26 @@ def get_prefs(self, team_id: str): 'content-type': 'application/json', }, api_params) - def update_prefs(self, team_id: str, prefs: dict): - """Update preferences""" + def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: + """ + Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + Parameters + ---------- + team_id : str + Team ID. + prefs : dict + Prefs key-value JSON object. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/teams/{teamId}/prefs' api_params = {} diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 09155c3..afa8b7d 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1,5 +1,5 @@ from ..service import Service -from typing import List +from typing import List, Dict, Any from ..exception import AppwriteException from ..enums.password_hash import PasswordHash; from ..enums.authenticator_type import AuthenticatorType; @@ -7,11 +7,29 @@ class Users(Service): - def __init__(self, client): + def __init__(self, client) -> None: super(Users, self).__init__(client) - def list(self, queries: List[str] = None, search: str = None): - """List users""" + def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the project's users. You can use the query params to filter your results. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users' api_params = {} @@ -23,8 +41,32 @@ def list(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None): - """Create user""" + def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None) -> Dict[str, Any]: + """ + Create a new user. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + phone : str + Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + password : str + Plain text user password. Must be at least 8 chars. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users' api_params = {} @@ -42,8 +84,30 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s 'content-type': 'application/json', }, api_params) - def create_argon2_user(self, user_id: str, email: str, password: str, name: str = None): - """Create user with Argon2 password""" + def create_argon2_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using Argon2. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/argon2' api_params = {} @@ -66,8 +130,30 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str 'content-type': 'application/json', }, api_params) - def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str = None): - """Create user with bcrypt password""" + def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using Bcrypt. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/bcrypt' api_params = {} @@ -90,8 +176,26 @@ 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[str] = None, search: str = None): - """List identities""" + def list_identities(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get identities for all users. + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/identities' api_params = {} @@ -103,8 +207,24 @@ def list_identities(self, queries: List[str] = None, search: str = None): 'content-type': 'application/json', }, api_params) - def delete_identity(self, identity_id: str): - """Delete identity""" + def delete_identity(self, identity_id: str) -> Dict[str, Any]: + """ + Delete an identity by its unique ID. + Parameters + ---------- + identity_id : str + Identity ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/identities/{identityId}' api_params = {} @@ -118,8 +238,30 @@ def delete_identity(self, identity_id: str): 'content-type': 'application/json', }, api_params) - def create_md5_user(self, user_id: str, email: str, password: str, name: str = None): - """Create user with MD5 password""" + def create_md5_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using MD5. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/md5' api_params = {} @@ -142,8 +284,30 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N 'content-type': 'application/json', }, api_params) - def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str = None): - """Create user with PHPass password""" + def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using PHPass. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/phpass' api_params = {} @@ -166,8 +330,40 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using Scrypt. + password_salt : str + Optional salt used to hash password. + password_cpu : float + Optional CPU cost used to hash password. + password_memory : float + Optional memory cost used to hash password. + password_parallel : float + Optional parallelization cost used to hash password. + password_length : float + Optional hash length used to hash password. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/scrypt' api_params = {} @@ -210,8 +406,36 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s 'content-type': 'application/json', }, 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""" + 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) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using Scrypt Modified. + password_salt : str + Salt used to hash password. + password_salt_separator : str + Salt separator used to hash password. + password_signer_key : str + Signer key used to hash password. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/scrypt-modified' api_params = {} @@ -246,8 +470,32 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p 'content-type': 'application/json', }, 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""" + def create_sha_user(self, user_id: str, email: str, password: str, password_version: PasswordHash = None, name: str = None) -> Dict[str, Any]: + """ + Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + email : str + User email. + password : str + User password hashed using SHA. + password_version : PasswordHash + Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/sha' api_params = {} @@ -271,8 +519,24 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers 'content-type': 'application/json', }, api_params) - def get(self, user_id: str): - """Get user""" + def get(self, user_id: str) -> Dict[str, Any]: + """ + Get a user by its unique ID. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}' api_params = {} @@ -286,8 +550,24 @@ def get(self, user_id: str): 'content-type': 'application/json', }, api_params) - def delete(self, user_id: str): - """Delete user""" + def delete(self, user_id: str) -> Dict[str, Any]: + """ + Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}' api_params = {} @@ -301,8 +581,26 @@ def delete(self, user_id: str): 'content-type': 'application/json', }, api_params) - def update_email(self, user_id: str, email: str): - """Update email""" + def update_email(self, user_id: str, email: str) -> Dict[str, Any]: + """ + Update the user email by its unique ID. + Parameters + ---------- + user_id : str + User ID. + email : str + User email. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/email' api_params = {} @@ -320,8 +618,28 @@ def update_email(self, user_id: str, email: str): 'content-type': 'application/json', }, api_params) - def create_jwt(self, user_id: str, session_id: str = None, duration: float = None): - """Create user JWT""" + def create_jwt(self, user_id: str, session_id: str = None, duration: float = None) -> Dict[str, Any]: + """ + Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + Parameters + ---------- + user_id : str + User ID. + session_id : str + Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + duration : float + Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/jwts' api_params = {} @@ -337,8 +655,28 @@ 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[str]): - """Update user labels""" + def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: + """ + Update the user labels by its unique ID. + + Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + Parameters + ---------- + user_id : str + User ID. + labels : List[str] + Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/labels' api_params = {} @@ -356,8 +694,26 @@ def update_labels(self, user_id: str, labels: List[str]): 'content-type': 'application/json', }, api_params) - def list_logs(self, user_id: str, queries: List[str] = None): - """List user logs""" + def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get the user activity logs list by its unique ID. + Parameters + ---------- + user_id : str + User ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/logs' api_params = {} @@ -372,8 +728,24 @@ def list_logs(self, user_id: str, queries: List[str] = None): 'content-type': 'application/json', }, api_params) - def list_memberships(self, user_id: str): - """List user memberships""" + def list_memberships(self, user_id: str) -> Dict[str, Any]: + """ + Get the user membership list by its unique ID. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/memberships' api_params = {} @@ -387,8 +759,26 @@ def list_memberships(self, user_id: str): 'content-type': 'application/json', }, api_params) - def update_mfa(self, user_id: str, mfa: bool): - """Update MFA""" + def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: + """ + Enable or disable MFA on a user account. + Parameters + ---------- + user_id : str + User ID. + mfa : bool + Enable or disable MFA. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa' api_params = {} @@ -406,8 +796,26 @@ def update_mfa(self, user_id: str, mfa: bool): 'content-type': 'application/json', }, api_params) - def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType): - """Delete authenticator""" + def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dict[str, Any]: + """ + Delete an authenticator app. + Parameters + ---------- + user_id : str + User ID. + type : AuthenticatorType + Type of authenticator. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa/authenticators/{type}' api_params = {} @@ -425,8 +833,24 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType): 'content-type': 'application/json', }, api_params) - def list_mfa_factors(self, user_id: str): - """List factors""" + def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: + """ + List the factors available on the account to be used as a MFA challange. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa/factors' api_params = {} @@ -440,8 +864,24 @@ def list_mfa_factors(self, user_id: str): 'content-type': 'application/json', }, api_params) - def get_mfa_recovery_codes(self, user_id: str): - """Get MFA recovery codes""" + def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: + """ + Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -455,8 +895,24 @@ def get_mfa_recovery_codes(self, user_id: str): 'content-type': 'application/json', }, api_params) - def update_mfa_recovery_codes(self, user_id: str): - """Regenerate MFA recovery codes""" + def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: + """ + Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -470,8 +926,24 @@ def update_mfa_recovery_codes(self, user_id: str): 'content-type': 'application/json', }, api_params) - def create_mfa_recovery_codes(self, user_id: str): - """Create MFA recovery codes""" + def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: + """ + Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/mfa/recovery-codes' api_params = {} @@ -485,8 +957,26 @@ def create_mfa_recovery_codes(self, user_id: str): 'content-type': 'application/json', }, api_params) - def update_name(self, user_id: str, name: str): - """Update name""" + def update_name(self, user_id: str, name: str) -> Dict[str, Any]: + """ + Update the user name by its unique ID. + Parameters + ---------- + user_id : str + User ID. + name : str + User name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/name' api_params = {} @@ -504,8 +994,26 @@ def update_name(self, user_id: str, name: str): 'content-type': 'application/json', }, api_params) - def update_password(self, user_id: str, password: str): - """Update password""" + def update_password(self, user_id: str, password: str) -> Dict[str, Any]: + """ + Update the user password by its unique ID. + Parameters + ---------- + user_id : str + User ID. + password : str + New user password. Must be at least 8 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/password' api_params = {} @@ -523,8 +1031,26 @@ def update_password(self, user_id: str, password: str): 'content-type': 'application/json', }, api_params) - def update_phone(self, user_id: str, number: str): - """Update phone""" + def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: + """ + Update the user phone by its unique ID. + Parameters + ---------- + user_id : str + User ID. + number : str + User phone number. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/phone' api_params = {} @@ -542,8 +1068,24 @@ def update_phone(self, user_id: str, number: str): 'content-type': 'application/json', }, api_params) - def get_prefs(self, user_id: str): - """Get user preferences""" + def get_prefs(self, user_id: str) -> Dict[str, Any]: + """ + Get the user preferences by its unique ID. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/prefs' api_params = {} @@ -557,8 +1099,26 @@ def get_prefs(self, user_id: str): 'content-type': 'application/json', }, api_params) - def update_prefs(self, user_id: str, prefs: dict): - """Update user preferences""" + def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: + """ + Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters + ---------- + user_id : str + User ID. + prefs : dict + Prefs key-value JSON object. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/prefs' api_params = {} @@ -576,8 +1136,24 @@ def update_prefs(self, user_id: str, prefs: dict): 'content-type': 'application/json', }, api_params) - def list_sessions(self, user_id: str): - """List user sessions""" + def list_sessions(self, user_id: str) -> Dict[str, Any]: + """ + Get the user sessions list by its unique ID. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/sessions' api_params = {} @@ -591,8 +1167,26 @@ def list_sessions(self, user_id: str): 'content-type': 'application/json', }, api_params) - def create_session(self, user_id: str): - """Create session""" + def create_session(self, user_id: str) -> Dict[str, Any]: + """ + Creates a session for a user. Returns an immediately usable session object. + + If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + Parameters + ---------- + user_id : str + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/sessions' api_params = {} @@ -606,8 +1200,24 @@ def create_session(self, user_id: str): 'content-type': 'application/json', }, api_params) - def delete_sessions(self, user_id: str): - """Delete user sessions""" + def delete_sessions(self, user_id: str) -> Dict[str, Any]: + """ + Delete all user's sessions by using the user's unique ID. + Parameters + ---------- + user_id : str + User ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/sessions' api_params = {} @@ -621,8 +1231,26 @@ def delete_sessions(self, user_id: str): 'content-type': 'application/json', }, api_params) - def delete_session(self, user_id: str, session_id: str): - """Delete user session""" + def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: + """ + Delete a user sessions by its unique ID. + Parameters + ---------- + user_id : str + User ID. + session_id : str + Session ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/sessions/{sessionId}' api_params = {} @@ -640,8 +1268,26 @@ def delete_session(self, user_id: str, session_id: str): 'content-type': 'application/json', }, api_params) - def update_status(self, user_id: str, status: bool): - """Update user status""" + def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: + """ + Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + Parameters + ---------- + user_id : str + User ID. + status : bool + User Status. To activate the user pass `true` and to block the user pass `false`. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/status' api_params = {} @@ -659,8 +1305,26 @@ def update_status(self, user_id: str, status: bool): 'content-type': 'application/json', }, api_params) - def list_targets(self, user_id: str, queries: List[str] = None): - """List user targets""" + def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List the messaging targets that are associated with a user. + Parameters + ---------- + user_id : str + User ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/targets' api_params = {} @@ -675,8 +1339,34 @@ def list_targets(self, user_id: str, queries: List[str] = None): 'content-type': 'application/json', }, 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""" + def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None) -> Dict[str, Any]: + """ + Create a messaging target. + Parameters + ---------- + user_id : str + User ID. + target_id : str + Target ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + provider_type : MessagingProviderType + The target provider type. Can be one of the following: `email`, `sms` or `push`. + identifier : str + The target identifier (token, email, phone etc.) + provider_id : str + Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + name : str + Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/targets' api_params = {} @@ -704,8 +1394,26 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr 'content-type': 'application/json', }, api_params) - def get_target(self, user_id: str, target_id: str): - """Get user target""" + def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: + """ + Get a user's push notification target by ID. + Parameters + ---------- + user_id : str + User ID. + target_id : str + Target ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -723,8 +1431,32 @@ def get_target(self, user_id: str, target_id: str): 'content-type': 'application/json', }, 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""" + def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None) -> Dict[str, Any]: + """ + Update a messaging target. + Parameters + ---------- + user_id : str + User ID. + target_id : str + Target ID. + identifier : str + The target identifier (token, email, phone etc.) + provider_id : str + Provider ID. Message will be sent to this target from the specified provider ID. If no provider ID is set the first setup provider will be used. + name : str + Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -745,8 +1477,26 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr 'content-type': 'application/json', }, api_params) - def delete_target(self, user_id: str, target_id: str): - """Delete user target""" + def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: + """ + Delete a messaging target. + Parameters + ---------- + user_id : str + User ID. + target_id : str + Target ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/targets/{targetId}' api_params = {} @@ -764,8 +1514,29 @@ def delete_target(self, user_id: str, target_id: str): 'content-type': 'application/json', }, api_params) - def create_token(self, user_id: str, length: float = None, expire: float = None): - """Create token""" + def create_token(self, user_id: str, length: float = None, expire: float = None) -> Dict[str, Any]: + """ + Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + + Parameters + ---------- + user_id : str + User ID. + length : float + Token length in characters. The default length is 6 characters + expire : float + Token expiration period in seconds. The default expiration is 15 minutes. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/tokens' api_params = {} @@ -781,8 +1552,26 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) 'content-type': 'application/json', }, api_params) - def update_email_verification(self, user_id: str, email_verification: bool): - """Update email verification""" + def update_email_verification(self, user_id: str, email_verification: bool) -> Dict[str, Any]: + """ + Update the user email verification status by its unique ID. + Parameters + ---------- + user_id : str + User ID. + email_verification : bool + User email verification status. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/verification' api_params = {} @@ -800,8 +1589,26 @@ def update_email_verification(self, user_id: str, email_verification: bool): 'content-type': 'application/json', }, api_params) - def update_phone_verification(self, user_id: str, phone_verification: bool): - """Update phone verification""" + def update_phone_verification(self, user_id: str, phone_verification: bool) -> Dict[str, Any]: + """ + Update the user phone verification status by its unique ID. + Parameters + ---------- + user_id : str + User ID. + phone_verification : bool + User phone verification status. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ api_path = '/users/{userId}/verification/phone' api_params = {} diff --git a/setup.py b/setup.py index d427818..6ffadf7 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.2', + version = '9.0.3', 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/9.0.2.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.3.tar.gz', install_requires=[ 'requests', ], From 38f20eb17a35a60eb66a10e138fce562e3af03eb Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Tue, 25 Mar 2025 14:24:54 +0000 Subject: [PATCH 11/24] chore: add addtional space --- appwrite/services/account.py | 43 +++++++++++++++++++++++++++++++ appwrite/services/avatars.py | 7 ++++++ appwrite/services/databases.py | 42 +++++++++++++++++++++++++++++++ appwrite/services/functions.py | 24 ++++++++++++++++++ appwrite/services/graphql.py | 2 ++ appwrite/services/health.py | 23 +++++++++++++++++ appwrite/services/locale.py | 8 ++++++ appwrite/services/messaging.py | 46 ++++++++++++++++++++++++++++++++++ appwrite/services/storage.py | 13 ++++++++++ appwrite/services/teams.py | 13 ++++++++++ appwrite/services/users.py | 42 +++++++++++++++++++++++++++++++ 11 files changed, 263 insertions(+) diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 70b7eab..d2fdf9a 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -13,6 +13,7 @@ def __init__(self, client) -> None: def get(self) -> Dict[str, Any]: """ Get the currently logged in user. + Returns ------- Dict[str, Any] @@ -34,6 +35,7 @@ def get(self) -> Dict[str, Any]: def create(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: """ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + Parameters ---------- user_id : str @@ -82,6 +84,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + Parameters ---------- email : str @@ -119,6 +122,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. + Parameters ---------- queries : List[str] @@ -147,6 +151,7 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -178,6 +183,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: def create_jwt(self) -> Dict[str, Any]: """ Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame. + Returns ------- Dict[str, Any] @@ -199,6 +205,7 @@ def create_jwt(self) -> Dict[str, Any]: def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. + Parameters ---------- queries : List[str] @@ -227,6 +234,7 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: def update_mfa(self, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on an account. + Parameters ---------- mfa : bool @@ -258,6 +266,7 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -289,6 +298,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[str, Any]: """ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -326,6 +336,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. + Parameters ---------- type : AuthenticatorType @@ -357,6 +368,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: """ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + Parameters ---------- factor : AuthenticationFactor @@ -388,6 +400,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: """ Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Parameters ---------- challenge_id : str @@ -425,6 +438,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: def list_mfa_factors(self) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. + Returns ------- Dict[str, Any] @@ -446,6 +460,7 @@ def list_mfa_factors(self) -> Dict[str, Any]: def get_mfa_recovery_codes(self) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes. + Returns ------- Dict[str, Any] @@ -467,6 +482,7 @@ def get_mfa_recovery_codes(self) -> Dict[str, Any]: def create_mfa_recovery_codes(self) -> Dict[str, Any]: """ Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Returns ------- Dict[str, Any] @@ -488,6 +504,7 @@ def create_mfa_recovery_codes(self) -> Dict[str, Any]: def update_mfa_recovery_codes(self) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes. + Returns ------- Dict[str, Any] @@ -509,6 +526,7 @@ def update_mfa_recovery_codes(self) -> Dict[str, Any]: def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. + Parameters ---------- name : str @@ -540,6 +558,7 @@ def update_name(self, name: str) -> Dict[str, Any]: def update_password(self, password: str, old_password: str = None) -> Dict[str, Any]: """ Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + Parameters ---------- password : str @@ -574,6 +593,7 @@ def update_password(self, password: str, old_password: str = None) -> Dict[str, def update_phone(self, phone: str, password: str) -> Dict[str, Any]: """ Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + Parameters ---------- phone : str @@ -611,6 +631,7 @@ def update_phone(self, phone: str, password: str) -> Dict[str, Any]: def get_prefs(self) -> Dict[str, Any]: """ Get the preferences as a key-value object for the currently logged in user. + Returns ------- Dict[str, Any] @@ -632,6 +653,7 @@ def get_prefs(self) -> Dict[str, Any]: def update_prefs(self, prefs: dict) -> Dict[str, Any]: """ Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- prefs : dict @@ -663,6 +685,7 @@ def update_prefs(self, prefs: dict) -> Dict[str, Any]: def create_recovery(self, email: str, url: str) -> Dict[str, Any]: """ Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + Parameters ---------- email : str @@ -702,6 +725,7 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint. Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- user_id : str @@ -745,6 +769,7 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, def list_sessions(self) -> Dict[str, Any]: """ Get the list of active sessions across different devices for the currently logged in user. + Returns ------- Dict[str, Any] @@ -766,6 +791,7 @@ def list_sessions(self) -> Dict[str, Any]: def delete_sessions(self) -> Dict[str, Any]: """ Delete all sessions from the user account and remove any sessions cookies from the end client. + Returns ------- Dict[str, Any] @@ -787,6 +813,7 @@ def delete_sessions(self) -> Dict[str, Any]: def create_anonymous_session(self) -> Dict[str, Any]: """ Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session). + Returns ------- Dict[str, Any] @@ -810,6 +837,7 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- email : str @@ -847,6 +875,7 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -884,6 +913,7 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -921,6 +951,7 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -958,6 +989,7 @@ def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: def get_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + Parameters ---------- session_id : str @@ -989,6 +1021,7 @@ def get_session(self, session_id: str) -> Dict[str, Any]: def update_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + Parameters ---------- session_id : str @@ -1020,6 +1053,7 @@ def update_session(self, session_id: str) -> Dict[str, Any]: def delete_session(self, session_id: str) -> Dict[str, Any]: """ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + Parameters ---------- session_id : str @@ -1051,6 +1085,7 @@ def delete_session(self, session_id: str) -> Dict[str, Any]: def update_status(self) -> Dict[str, Any]: """ Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead. + Returns ------- Dict[str, Any] @@ -1074,6 +1109,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> D Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1117,6 +1153,7 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1164,6 +1201,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- provider : OAuthProvider @@ -1206,6 +1244,7 @@ def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1246,6 +1285,7 @@ def create_verification(self, url: str) -> Dict[str, Any]: Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- url : str @@ -1277,6 +1317,7 @@ def create_verification(self, url: str) -> Dict[str, Any]: def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str @@ -1314,6 +1355,7 @@ def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: def create_phone_verification(self) -> Dict[str, Any]: """ Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes. + Returns ------- Dict[str, Any] @@ -1335,6 +1377,7 @@ def create_phone_verification(self) -> Dict[str, Any]: def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 85e0e44..2778447 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -15,6 +15,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Browser @@ -58,6 +59,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : CreditCard @@ -100,6 +102,7 @@ def get_favicon(self, url: str) -> Dict[str, Any]: Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -134,6 +137,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Flag @@ -178,6 +182,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> Dict When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -220,6 +225,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- name : str @@ -258,6 +264,7 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: """ Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + Parameters ---------- text : str diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 583647a..facfdea 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -13,6 +13,7 @@ def __init__(self, client) -> None: def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + Parameters ---------- queries : List[str] @@ -45,6 +46,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Create a new Database. + Parameters ---------- database_id : str @@ -85,6 +87,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, def get(self, database_id: str) -> Dict[str, Any]: """ Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + Parameters ---------- database_id : str @@ -116,6 +119,7 @@ def get(self, database_id: str) -> Dict[str, Any]: def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: """ Update a database by its unique ID. + Parameters ---------- database_id : str @@ -156,6 +160,7 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, def delete(self, database_id: str) -> Dict[str, Any]: """ Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + Parameters ---------- database_id : str @@ -187,6 +192,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: def list_collections(self, database_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + Parameters ---------- database_id : str @@ -224,6 +230,7 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: def create_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -276,6 +283,7 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any]: """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + Parameters ---------- database_id : str @@ -313,6 +321,7 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] def update_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: """ Update a collection by its unique ID. + Parameters ---------- database_id : str @@ -365,6 +374,7 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, Any]: """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- database_id : str @@ -402,6 +412,7 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A def list_attributes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ List attributes in the collection. + Parameters ---------- database_id : str @@ -443,6 +454,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Create a boolean attribute. + Parameters ---------- database_id : str @@ -498,6 +510,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st def update_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool, new_key: str = None) -> Dict[str, Any]: """ Update a boolean attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -553,6 +566,7 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st def create_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: """ Create a date time attribute according to the ISO 8601 standard. + Parameters ---------- database_id : str @@ -608,6 +622,7 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s def update_datetime_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: """ Update a date time attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -664,6 +679,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, """ Create an email attribute. + Parameters ---------- database_id : str @@ -720,6 +736,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, """ Update an email attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -776,6 +793,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, """ Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + Parameters ---------- database_id : str @@ -838,6 +856,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, """ Update an enum attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -900,6 +919,7 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, """ Create a float attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -962,6 +982,7 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, """ Update a float attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1024,6 +1045,7 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st """ Create an integer attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -1086,6 +1108,7 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st """ Update an integer attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1148,6 +1171,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re """ Create IP address attribute. + Parameters ---------- database_id : str @@ -1204,6 +1228,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re """ Update an ip attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1260,6 +1285,7 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re """ Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1322,6 +1348,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str """ Create a string attribute. + Parameters ---------- database_id : str @@ -1387,6 +1414,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str """ Update a string attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1446,6 +1474,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r """ Create a URL attribute. + Parameters ---------- database_id : str @@ -1502,6 +1531,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r """ Update an url attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1557,6 +1587,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: """ Get attribute by ID. + Parameters ---------- database_id : str @@ -1600,6 +1631,7 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: """ Deletes an attribute. + Parameters ---------- database_id : str @@ -1644,6 +1676,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke """ Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1693,6 +1726,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke def list_documents(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + Parameters ---------- database_id : str @@ -1734,6 +1768,7 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1786,6 +1821,7 @@ def create_document(self, database_id: str, collection_id: str, document_id: str def get_document(self, database_id: str, collection_id: str, document_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + Parameters ---------- database_id : str @@ -1832,6 +1868,7 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + Parameters ---------- database_id : str @@ -1881,6 +1918,7 @@ def update_document(self, database_id: str, collection_id: str, document_id: str def delete_document(self, database_id: str, collection_id: str, document_id: str) -> Dict[str, Any]: """ Delete a document by its unique ID. + Parameters ---------- database_id : str @@ -1924,6 +1962,7 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ List indexes in the collection. + Parameters ---------- database_id : str @@ -1965,6 +2004,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind """ Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. + Parameters ---------- database_id : str @@ -2023,6 +2063,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: """ Get index by ID. + Parameters ---------- database_id : str @@ -2066,6 +2107,7 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: """ Delete an index. + Parameters ---------- database_id : str diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index ce0a60a..6567166 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -13,6 +13,7 @@ def __init__(self, client) -> None: def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -44,6 +45,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: 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) -> Dict[str, Any]: """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + Parameters ---------- function_id : str @@ -144,6 +146,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st def list_runtimes(self) -> Dict[str, Any]: """ Get a list of all runtimes that are currently active on your instance. + Returns ------- Dict[str, Any] @@ -166,6 +169,7 @@ def list_specifications(self) -> Dict[str, Any]: """ List allowed function specifications for this instance. + Returns ------- Dict[str, Any] @@ -187,6 +191,7 @@ def list_specifications(self) -> Dict[str, Any]: def get(self, function_id: str) -> Dict[str, Any]: """ Get a function by its unique ID. + Parameters ---------- function_id : str @@ -218,6 +223,7 @@ def get(self, function_id: str) -> Dict[str, Any]: 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) -> Dict[str, Any]: """ Update function by its unique ID. + Parameters ---------- function_id : str @@ -303,6 +309,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: def delete(self, function_id: str) -> Dict[str, Any]: """ Delete a function by its unique ID. + Parameters ---------- function_id : str @@ -334,6 +341,7 @@ def delete(self, function_id: str) -> Dict[str, Any]: def list_deployments(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's code deployments. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -375,6 +383,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). Use the "command" param to set the entrypoint used to execute your code. + Parameters ---------- function_id : str @@ -431,6 +440,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a code deployment by its unique ID. + Parameters ---------- function_id : str @@ -468,6 +478,7 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. + Parameters ---------- function_id : str @@ -505,6 +516,7 @@ def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ Delete a code deployment by its unique ID. + Parameters ---------- function_id : str @@ -542,6 +554,7 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A def create_build(self, function_id: str, deployment_id: str, build_id: str = None) -> Dict[str, Any]: """ Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- function_id : str @@ -582,6 +595,7 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- function_id : str @@ -619,6 +633,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[ def get_deployment_download(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. + Parameters ---------- function_id : str @@ -656,6 +671,7 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> Dict[ def list_executions(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the current user function execution logs. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -693,6 +709,7 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s 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) -> Dict[str, Any]: """ Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + Parameters ---------- function_id : str @@ -742,6 +759,7 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Get a function execution log by its unique ID. + Parameters ---------- function_id : str @@ -780,6 +798,7 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any """ Delete a function execution by its unique ID. + Parameters ---------- function_id : str @@ -817,6 +836,7 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any def list_variables(self, function_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific function. + Parameters ---------- function_id : str @@ -848,6 +868,7 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, Any]: """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + Parameters ---------- function_id : str @@ -891,6 +912,7 @@ def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, A def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- function_id : str @@ -928,6 +950,7 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]: """ Update variable by its unique ID. + Parameters ---------- function_id : str @@ -974,6 +997,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- function_id : str diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 0981afa..22ca3aa 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -10,6 +10,7 @@ def __init__(self, client) -> None: def query(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict @@ -42,6 +43,7 @@ def query(self, query: dict) -> Dict[str, Any]: def mutation(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 0007496..23f5aa9 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -11,6 +11,7 @@ def __init__(self, client) -> None: def get(self) -> Dict[str, Any]: """ Check the Appwrite HTTP server is up and responsive. + Returns ------- Dict[str, Any] @@ -32,6 +33,7 @@ def get(self) -> Dict[str, Any]: def get_antivirus(self) -> Dict[str, Any]: """ Check the Appwrite Antivirus server is up and connection is successful. + Returns ------- Dict[str, Any] @@ -53,6 +55,7 @@ def get_antivirus(self) -> Dict[str, Any]: def get_cache(self) -> Dict[str, Any]: """ Check the Appwrite in-memory cache servers are up and connection is successful. + Returns ------- Dict[str, Any] @@ -74,6 +77,7 @@ def get_cache(self) -> Dict[str, Any]: def get_certificate(self, domain: str = None) -> Dict[str, Any]: """ Get the SSL certificate for a domain + Parameters ---------- domain : str @@ -102,6 +106,7 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: def get_db(self) -> Dict[str, Any]: """ Check the Appwrite database servers are up and connection is successful. + Returns ------- Dict[str, Any] @@ -123,6 +128,7 @@ def get_db(self) -> Dict[str, Any]: def get_pub_sub(self) -> Dict[str, Any]: """ Check the Appwrite pub-sub servers are up and connection is successful. + Returns ------- Dict[str, Any] @@ -144,6 +150,7 @@ def get_pub_sub(self) -> Dict[str, Any]: def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -172,6 +179,7 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -200,6 +208,7 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict[str, Any]: """ Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- name : str @@ -231,6 +240,7 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -260,6 +270,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] """ Returns the amount of failed jobs in a given queue. + Parameters ---------- name : Name @@ -294,6 +305,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -322,6 +334,7 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -350,6 +363,7 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -378,6 +392,7 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -406,6 +421,7 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -434,6 +450,7 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + Parameters ---------- threshold : float @@ -462,6 +479,7 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -490,6 +508,7 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: def get_queue_stats_usage_dump(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -518,6 +537,7 @@ def get_queue_stats_usage_dump(self, threshold: float = None) -> Dict[str, Any]: def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -546,6 +566,7 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: def get_storage(self) -> Dict[str, Any]: """ Check the Appwrite storage device is up and connection is successful. + Returns ------- Dict[str, Any] @@ -567,6 +588,7 @@ def get_storage(self) -> Dict[str, Any]: def get_storage_local(self) -> Dict[str, Any]: """ Check the Appwrite local storage device is up and connection is successful. + Returns ------- Dict[str, Any] @@ -588,6 +610,7 @@ def get_storage_local(self) -> Dict[str, Any]: def get_time(self) -> Dict[str, Any]: """ Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. + Returns ------- Dict[str, Any] diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 3f137a5..67f7a9c 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -12,6 +12,7 @@ def get(self) -> Dict[str, Any]: Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. ([IP Geolocation by DB-IP](https://db-ip.com)) + Returns ------- Dict[str, Any] @@ -33,6 +34,7 @@ def get(self) -> Dict[str, Any]: def list_codes(self) -> Dict[str, Any]: """ List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + Returns ------- Dict[str, Any] @@ -54,6 +56,7 @@ def list_codes(self) -> Dict[str, Any]: def list_continents(self) -> Dict[str, Any]: """ List of all continents. You can use the locale header to get the data in a supported language. + Returns ------- Dict[str, Any] @@ -75,6 +78,7 @@ def list_continents(self) -> Dict[str, Any]: def list_countries(self) -> Dict[str, Any]: """ List of all countries. You can use the locale header to get the data in a supported language. + Returns ------- Dict[str, Any] @@ -96,6 +100,7 @@ def list_countries(self) -> Dict[str, Any]: def list_countries_eu(self) -> Dict[str, Any]: """ List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. + Returns ------- Dict[str, Any] @@ -117,6 +122,7 @@ def list_countries_eu(self) -> Dict[str, Any]: def list_countries_phones(self) -> Dict[str, Any]: """ List of all countries phone codes. You can use the locale header to get the data in a supported language. + Returns ------- Dict[str, Any] @@ -138,6 +144,7 @@ def list_countries_phones(self) -> Dict[str, Any]: def list_currencies(self) -> Dict[str, Any]: """ List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. + Returns ------- Dict[str, Any] @@ -159,6 +166,7 @@ def list_currencies(self) -> Dict[str, Any]: def list_languages(self) -> Dict[str, Any]: """ List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. + Returns ------- Dict[str, Any] diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index d3aa1fb..684c08d 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -12,6 +12,7 @@ def __init__(self, client) -> None: def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all messages from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -43,6 +44,7 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s 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) -> Dict[str, Any]: """ Create a new email message. + Parameters ---------- message_id : str @@ -114,6 +116,7 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st """ Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -178,6 +181,7 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st 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) -> Dict[str, Any]: """ Create a new push notification. + Parameters ---------- message_id : str @@ -264,6 +268,7 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str """ Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -349,6 +354,7 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str 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) -> Dict[str, Any]: """ Create a new SMS message. + Parameters ---------- message_id : str @@ -402,6 +408,7 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] """ Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -452,6 +459,7 @@ def get_message(self, message_id: str) -> Dict[str, Any]: """ Get a message by its unique ID. + Parameters ---------- message_id : str @@ -483,6 +491,7 @@ def get_message(self, message_id: str) -> Dict[str, Any]: def delete(self, message_id: str) -> Dict[str, Any]: """ Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + Parameters ---------- message_id : str @@ -514,6 +523,7 @@ def delete(self, message_id: str) -> Dict[str, Any]: def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the message activity logs listed by its unique ID. + Parameters ---------- message_id : str @@ -548,6 +558,7 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of the targets associated with a message. + Parameters ---------- message_id : str @@ -582,6 +593,7 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all providers from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -613,6 +625,7 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ 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) -> Dict[str, Any]: """ Create a new Apple Push Notification service provider. + Parameters ---------- provider_id : str @@ -668,6 +681,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None 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) -> Dict[str, Any]: """ Update a Apple Push Notification service provider by its unique ID. + Parameters ---------- provider_id : str @@ -720,6 +734,7 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool def create_fcm_provider(self, provider_id: str, name: str, service_account_json: dict = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Firebase Cloud Messaging provider. + Parameters ---------- provider_id : str @@ -763,6 +778,7 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool = None, service_account_json: dict = None) -> Dict[str, Any]: """ Update a Firebase Cloud Messaging provider by its unique ID. + Parameters ---------- provider_id : str @@ -803,6 +819,7 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool 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) -> Dict[str, Any]: """ Create a new Mailgun provider. + Parameters ---------- provider_id : str @@ -864,6 +881,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No 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) -> Dict[str, Any]: """ Update a Mailgun provider by its unique ID. + Parameters ---------- provider_id : str @@ -922,6 +940,7 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s 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) -> Dict[str, Any]: """ Create a new MSG91 provider. + Parameters ---------- provider_id : str @@ -971,6 +990,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = 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) -> Dict[str, Any]: """ Update a MSG91 provider by its unique ID. + Parameters ---------- provider_id : str @@ -1017,6 +1037,7 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo 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) -> Dict[str, Any]: """ Create a new Sendgrid provider. + Parameters ---------- provider_id : str @@ -1072,6 +1093,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N 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) -> Dict[str, Any]: """ Update a Sendgrid provider by its unique ID. + Parameters ---------- provider_id : str @@ -1124,6 +1146,7 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: 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) -> Dict[str, Any]: """ Create a new SMTP provider. + Parameters ---------- provider_id : str @@ -1200,6 +1223,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo 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) -> Dict[str, Any]: """ Update a SMTP provider by its unique ID. + Parameters ---------- provider_id : str @@ -1270,6 +1294,7 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = None, customer_id: str = None, api_key: str = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Telesign provider. + Parameters ---------- provider_id : str @@ -1319,6 +1344,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non 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) -> Dict[str, Any]: """ Update a Telesign provider by its unique ID. + Parameters ---------- provider_id : str @@ -1365,6 +1391,7 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = None, username: str = None, api_key: str = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Textmagic provider. + Parameters ---------- provider_id : str @@ -1414,6 +1441,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: bool = None, username: str = None, api_key: str = None, xfrom: str = None) -> Dict[str, Any]: """ Update a Textmagic provider by its unique ID. + Parameters ---------- provider_id : str @@ -1460,6 +1488,7 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, account_sid: str = None, auth_token: str = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Twilio provider. + Parameters ---------- provider_id : str @@ -1509,6 +1538,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, 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) -> Dict[str, Any]: """ Update a Twilio provider by its unique ID. + Parameters ---------- provider_id : str @@ -1555,6 +1585,7 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, api_key: str = None, api_secret: str = None, enabled: bool = None) -> Dict[str, Any]: """ Create a new Vonage provider. + Parameters ---------- provider_id : str @@ -1604,6 +1635,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, 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) -> Dict[str, Any]: """ Update a Vonage provider by its unique ID. + Parameters ---------- provider_id : str @@ -1651,6 +1683,7 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: """ Get a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1682,6 +1715,7 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1713,6 +1747,7 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the provider activity logs listed by its unique ID. + Parameters ---------- provider_id : str @@ -1747,6 +1782,7 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the subscriber activity logs listed by its unique ID. + Parameters ---------- subscriber_id : str @@ -1781,6 +1817,7 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all topics from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -1812,6 +1849,7 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> Dict[str, Any]: """ Create a new topic. + Parameters ---------- topic_id : str @@ -1853,6 +1891,7 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: """ Get a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1885,6 +1924,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N """ Update a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1922,6 +1962,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1953,6 +1994,7 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the topic activity logs listed by its unique ID. + Parameters ---------- topic_id : str @@ -1987,6 +2029,7 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all subscribers from the current Appwrite project. + Parameters ---------- topic_id : str @@ -2024,6 +2067,7 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) -> Dict[str, Any]: """ Create a new subscriber. + Parameters ---------- topic_id : str @@ -2068,6 +2112,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: """ Get a subscriber by its unique ID. + Parameters ---------- topic_id : str @@ -2105,6 +2150,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: """ Delete a subscriber by its unique ID. + Parameters ---------- topic_id : str diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index c1d6d58..128698c 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -14,6 +14,7 @@ def __init__(self, client) -> None: def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the storage buckets. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -45,6 +46,7 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st 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) -> Dict[str, Any]: """ Create a new storage bucket. + Parameters ---------- bucket_id : str @@ -106,6 +108,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None def get_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + Parameters ---------- bucket_id : str @@ -137,6 +140,7 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: 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) -> Dict[str, Any]: """ Update a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -198,6 +202,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Delete a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -229,6 +234,7 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: def list_files(self, bucket_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the user files. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -273,6 +279,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + Parameters ---------- bucket_id : str @@ -327,6 +334,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + Parameters ---------- bucket_id : str @@ -364,6 +372,7 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: List[str] = None) -> Dict[str, Any]: """ Update a file by its unique ID. Only users with write permissions have access to update this resource. + Parameters ---------- bucket_id : str @@ -407,6 +416,7 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- bucket_id : str @@ -444,6 +454,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- bucket_id : str @@ -481,6 +492,7 @@ def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: 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) -> Dict[str, Any]: """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + Parameters ---------- bucket_id : str @@ -551,6 +563,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he def get_file_view(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + Parameters ---------- bucket_id : str diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index f330966..2a106a5 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -10,6 +10,7 @@ def __init__(self, client) -> None: def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + Parameters ---------- queries : List[str] @@ -41,6 +42,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, Any]: """ Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + Parameters ---------- team_id : str @@ -81,6 +83,7 @@ def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, def get(self, team_id: str) -> Dict[str, Any]: """ Get a team by its ID. All team members have read access for this resource. + Parameters ---------- team_id : str @@ -112,6 +115,7 @@ def get(self, team_id: str) -> Dict[str, Any]: def update_name(self, team_id: str, name: str) -> Dict[str, Any]: """ Update the team's name by its unique ID. + Parameters ---------- team_id : str @@ -149,6 +153,7 @@ def update_name(self, team_id: str, name: str) -> Dict[str, Any]: def delete(self, team_id: str) -> Dict[str, Any]: """ Delete a team using its ID. Only team members with the owner role can delete the team. + Parameters ---------- team_id : str @@ -180,6 +185,7 @@ def delete(self, team_id: str) -> Dict[str, Any]: def list_memberships(self, team_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -224,6 +230,7 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + Parameters ---------- team_id : str @@ -276,6 +283,7 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -314,6 +322,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) """ Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + Parameters ---------- team_id : str @@ -357,6 +366,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + Parameters ---------- team_id : str @@ -397,6 +407,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st If the request is successful, a session for the user is automatically created. + Parameters ---------- team_id : str @@ -446,6 +457,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st def get_prefs(self, team_id: str) -> Dict[str, Any]: """ Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + Parameters ---------- team_id : str @@ -477,6 +489,7 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: """ Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + Parameters ---------- team_id : str diff --git a/appwrite/services/users.py b/appwrite/services/users.py index afa8b7d..f4497c1 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -13,6 +13,7 @@ def __init__(self, client) -> None: def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -44,6 +45,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None) -> Dict[str, Any]: """ Create a new user. + Parameters ---------- user_id : str @@ -87,6 +89,7 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s def create_argon2_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -133,6 +136,7 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -179,6 +183,7 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str def list_identities(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get identities for all users. + Parameters ---------- queries : List[str] @@ -210,6 +215,7 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -241,6 +247,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: def create_md5_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -287,6 +294,7 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -333,6 +341,7 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str 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) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -409,6 +418,7 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s 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) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -473,6 +483,7 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p def create_sha_user(self, user_id: str, email: str, password: str, password_version: PasswordHash = None, name: str = None) -> Dict[str, Any]: """ Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -522,6 +533,7 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers def get(self, user_id: str) -> Dict[str, Any]: """ Get a user by its unique ID. + Parameters ---------- user_id : str @@ -553,6 +565,7 @@ def get(self, user_id: str) -> Dict[str, Any]: def delete(self, user_id: str) -> Dict[str, Any]: """ Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + Parameters ---------- user_id : str @@ -584,6 +597,7 @@ def delete(self, user_id: str) -> Dict[str, Any]: def update_email(self, user_id: str, email: str) -> Dict[str, Any]: """ Update the user email by its unique ID. + Parameters ---------- user_id : str @@ -621,6 +635,7 @@ def update_email(self, user_id: str, email: str) -> Dict[str, Any]: def create_jwt(self, user_id: str, session_id: str = None, duration: float = None) -> Dict[str, Any]: """ Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + Parameters ---------- user_id : str @@ -660,6 +675,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: Update the user labels by its unique ID. Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + Parameters ---------- user_id : str @@ -697,6 +713,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. + Parameters ---------- user_id : str @@ -731,6 +748,7 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: def list_memberships(self, user_id: str) -> Dict[str, Any]: """ Get the user membership list by its unique ID. + Parameters ---------- user_id : str @@ -762,6 +780,7 @@ def list_memberships(self, user_id: str) -> Dict[str, Any]: def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. + Parameters ---------- user_id : str @@ -799,6 +818,7 @@ def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator app. + Parameters ---------- user_id : str @@ -836,6 +856,7 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. + Parameters ---------- user_id : str @@ -867,6 +888,7 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -898,6 +920,7 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -929,6 +952,7 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + Parameters ---------- user_id : str @@ -960,6 +984,7 @@ def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: def update_name(self, user_id: str, name: str) -> Dict[str, Any]: """ Update the user name by its unique ID. + Parameters ---------- user_id : str @@ -997,6 +1022,7 @@ def update_name(self, user_id: str, name: str) -> Dict[str, Any]: def update_password(self, user_id: str, password: str) -> Dict[str, Any]: """ Update the user password by its unique ID. + Parameters ---------- user_id : str @@ -1034,6 +1060,7 @@ def update_password(self, user_id: str, password: str) -> Dict[str, Any]: def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: """ Update the user phone by its unique ID. + Parameters ---------- user_id : str @@ -1071,6 +1098,7 @@ def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: def get_prefs(self, user_id: str) -> Dict[str, Any]: """ Get the user preferences by its unique ID. + Parameters ---------- user_id : str @@ -1102,6 +1130,7 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: """ Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- user_id : str @@ -1139,6 +1168,7 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: def list_sessions(self, user_id: str) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. + Parameters ---------- user_id : str @@ -1172,6 +1202,7 @@ def create_session(self, user_id: str) -> Dict[str, Any]: Creates a session for a user. Returns an immediately usable session object. If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + Parameters ---------- user_id : str @@ -1203,6 +1234,7 @@ def create_session(self, user_id: str) -> Dict[str, Any]: def delete_sessions(self, user_id: str) -> Dict[str, Any]: """ Delete all user's sessions by using the user's unique ID. + Parameters ---------- user_id : str @@ -1234,6 +1266,7 @@ def delete_sessions(self, user_id: str) -> Dict[str, Any]: def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: """ Delete a user sessions by its unique ID. + Parameters ---------- user_id : str @@ -1271,6 +1304,7 @@ def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: """ Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + Parameters ---------- user_id : str @@ -1308,6 +1342,7 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ List the messaging targets that are associated with a user. + Parameters ---------- user_id : str @@ -1342,6 +1377,7 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None) -> Dict[str, Any]: """ Create a messaging target. + Parameters ---------- user_id : str @@ -1397,6 +1433,7 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Get a user's push notification target by ID. + Parameters ---------- user_id : str @@ -1434,6 +1471,7 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None) -> Dict[str, Any]: """ Update a messaging target. + Parameters ---------- user_id : str @@ -1480,6 +1518,7 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. + Parameters ---------- user_id : str @@ -1518,6 +1557,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) """ Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + Parameters ---------- user_id : str @@ -1555,6 +1595,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) def update_email_verification(self, user_id: str, email_verification: bool) -> Dict[str, Any]: """ Update the user email verification status by its unique ID. + Parameters ---------- user_id : str @@ -1592,6 +1633,7 @@ def update_email_verification(self, user_id: str, email_verification: bool) -> D def update_phone_verification(self, user_id: str, phone_verification: bool) -> Dict[str, Any]: """ Update the user phone verification status by its unique ID. + Parameters ---------- user_id : str From a09439f5b5b72285b5760e94d43294cdbfe9b54d Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Tue, 25 Mar 2025 16:10:50 +0000 Subject: [PATCH 12/24] fix: return type for some sdks --- appwrite/services/avatars.py | 42 +++++++++++++++++----------------- appwrite/services/functions.py | 6 ++--- appwrite/services/storage.py | 18 +++++++-------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 2778447..26e576a 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -10,7 +10,7 @@ class Avatars(Service): def __init__(self, client) -> None: super(Avatars, self).__init__(client) - def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> str: """ You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. @@ -29,8 +29,8 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -53,7 +53,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, 'content-type': 'application/json', }, api_params) - def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> str: """ The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. @@ -73,8 +73,8 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -97,7 +97,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = 'content-type': 'application/json', }, api_params) - def get_favicon(self, url: str) -> Dict[str, Any]: + def get_favicon(self, url: str) -> str: """ Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. @@ -110,8 +110,8 @@ def get_favicon(self, url: str) -> Dict[str, Any]: Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -131,7 +131,7 @@ def get_favicon(self, url: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> Dict[str, Any]: + def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> str: """ You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. @@ -151,8 +151,8 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -175,7 +175,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit 'content-type': 'application/json', }, api_params) - def get_image(self, url: str, width: float = None, height: float = None) -> Dict[str, Any]: + def get_image(self, url: str, width: float = None, height: float = None) -> str: """ Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. @@ -194,8 +194,8 @@ def get_image(self, url: str, width: float = None, height: float = None) -> Dict Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -217,7 +217,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> Dict 'content-type': 'application/json', }, api_params) - def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> Dict[str, Any]: + def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> str: """ Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. @@ -239,8 +239,8 @@ def get_initials(self, name: str = None, width: float = None, height: float = No Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -260,7 +260,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No 'content-type': 'application/json', }, api_params) - def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> Dict[str, Any]: + def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> str: """ Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. @@ -278,8 +278,8 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 6567166..baf500b 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -630,7 +630,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[ 'content-type': 'application/json', }, api_params) - def get_deployment_download(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + def get_deployment_download(self, function_id: str, deployment_id: str) -> str: """ Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. @@ -643,8 +643,8 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> Dict[ Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 128698c..e289978 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -451,7 +451,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + def get_file_download(self, bucket_id: str, file_id: str) -> str: """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. @@ -464,8 +464,8 @@ def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -489,7 +489,7 @@ def get_file_download(self, bucket_id: str, file_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, 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) -> Dict[str, Any]: + 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) -> str: """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. @@ -524,8 +524,8 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ @@ -560,7 +560,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he 'content-type': 'application/json', }, api_params) - def get_file_view(self, bucket_id: str, file_id: str) -> Dict[str, Any]: + def get_file_view(self, bucket_id: str, file_id: str) -> str: """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. @@ -573,8 +573,8 @@ def get_file_view(self, bucket_id: str, file_id: str) -> Dict[str, Any]: Returns ------- - Dict[str, Any] - API response as a dictionary + str + Response as a string Raises ------ From 6770a335f60b95ba455cd52c752caa1c6864b2cd Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Tue, 25 Mar 2025 16:34:40 +0000 Subject: [PATCH 13/24] fix: typing to be bytes --- appwrite/services/avatars.py | 42 +++++++++++++++++----------------- appwrite/services/functions.py | 6 ++--- appwrite/services/storage.py | 18 +++++++-------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 26e576a..efec859 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -10,7 +10,7 @@ class Avatars(Service): def __init__(self, client) -> None: super(Avatars, self).__init__(client) - def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> str: + def get_browser(self, code: Browser, width: float = None, height: float = None, quality: float = None) -> bytes: """ You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. @@ -29,8 +29,8 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -53,7 +53,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, 'content-type': 'application/json', }, api_params) - def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> str: + def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> bytes: """ The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. @@ -73,8 +73,8 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -97,7 +97,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = 'content-type': 'application/json', }, api_params) - def get_favicon(self, url: str) -> str: + def get_favicon(self, url: str) -> bytes: """ Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. @@ -110,8 +110,8 @@ def get_favicon(self, url: str) -> str: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -131,7 +131,7 @@ def get_favicon(self, url: str) -> str: 'content-type': 'application/json', }, api_params) - def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> str: + def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> bytes: """ You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. @@ -151,8 +151,8 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -175,7 +175,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit 'content-type': 'application/json', }, api_params) - def get_image(self, url: str, width: float = None, height: float = None) -> str: + def get_image(self, url: str, width: float = None, height: float = None) -> bytes: """ Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. @@ -194,8 +194,8 @@ def get_image(self, url: str, width: float = None, height: float = None) -> str: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -217,7 +217,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> str: 'content-type': 'application/json', }, api_params) - def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> str: + def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> bytes: """ Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. @@ -239,8 +239,8 @@ def get_initials(self, name: str = None, width: float = None, height: float = No Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -260,7 +260,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No 'content-type': 'application/json', }, api_params) - def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> str: + def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> bytes: """ Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. @@ -278,8 +278,8 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index baf500b..7db7323 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -630,7 +630,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[ 'content-type': 'application/json', }, api_params) - def get_deployment_download(self, function_id: str, deployment_id: str) -> str: + def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes: """ Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. @@ -643,8 +643,8 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> str: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index e289978..cf43652 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -451,7 +451,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def get_file_download(self, bucket_id: str, file_id: str) -> str: + def get_file_download(self, bucket_id: str, file_id: str) -> bytes: """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. @@ -464,8 +464,8 @@ def get_file_download(self, bucket_id: str, file_id: str) -> str: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -489,7 +489,7 @@ def get_file_download(self, bucket_id: str, file_id: str) -> str: 'content-type': 'application/json', }, 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) -> str: + 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) -> bytes: """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. @@ -524,8 +524,8 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ @@ -560,7 +560,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he 'content-type': 'application/json', }, api_params) - def get_file_view(self, bucket_id: str, file_id: str) -> str: + def get_file_view(self, bucket_id: str, file_id: str) -> bytes: """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. @@ -573,8 +573,8 @@ def get_file_view(self, bucket_id: str, file_id: str) -> str: Returns ------- - str - Response as a string + bytes + Response as bytes Raises ------ From 54c05a4b657b388a88e52a4e30748ce2b67a6930 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 17 Apr 2025 19:55:00 +0100 Subject: [PATCH 14/24] fix: remove content-type from GET requests --- README.md | 2 +- appwrite/client.py | 7 ++- appwrite/enums/name.py | 1 - appwrite/enums/o_auth_provider.py | 1 + appwrite/services/account.py | 11 +--- appwrite/services/avatars.py | 7 --- appwrite/services/databases.py | 10 ---- appwrite/services/functions.py | 11 ---- appwrite/services/health.py | 51 ------------------- appwrite/services/locale.py | 8 --- appwrite/services/messaging.py | 13 ----- appwrite/services/storage.py | 7 --- appwrite/services/teams.py | 5 -- appwrite/services/users.py | 11 ---- .../health/get-queue-stats-usage-dump.md | 13 ----- setup.py | 4 +- 16 files changed, 10 insertions(+), 152 deletions(-) delete mode 100644 docs/examples/health/get-queue-stats-usage-dump.md diff --git a/README.md b/README.md index 466c7ac..c16cd61 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite/client.py b/appwrite/client.py index a65edeb..ce46fde 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.3 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/9.0.4 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.3', + 'x-sdk-version': '9.0.4', 'X-Appwrite-Response-Format' : '1.6.0', } @@ -27,6 +27,9 @@ def set_self_signed(self, status=True): return self def set_endpoint(self, endpoint): + if not endpoint.startswith('http://') and not endpoint.startswith('https://'): + raise AppwriteException('Invalid endpoint URL: ' + endpoint) + self._endpoint = endpoint return self diff --git a/appwrite/enums/name.py b/appwrite/enums/name.py index 0ac227e..c4b981e 100644 --- a/appwrite/enums/name.py +++ b/appwrite/enums/name.py @@ -8,7 +8,6 @@ class Name(Enum): V1_FUNCTIONS = "v1-functions" 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/enums/o_auth_provider.py b/appwrite/enums/o_auth_provider.py index 3d46c8e..6c1e6bd 100644 --- a/appwrite/enums/o_auth_provider.py +++ b/appwrite/enums/o_auth_provider.py @@ -15,6 +15,7 @@ class OAuthProvider(Enum): DROPBOX = "dropbox" ETSY = "etsy" FACEBOOK = "facebook" + FIGMA = "figma" GITHUB = "github" GITLAB = "gitlab" GOOGLE = "google" diff --git a/appwrite/services/account.py b/appwrite/services/account.py index d2fdf9a..9dd3c5e 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -29,7 +29,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, user_id: str, email: str, password: str, name: str = None) -> Dict[str, Any]: @@ -145,7 +144,6 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_identity(self, identity_id: str) -> Dict[str, Any]: @@ -228,7 +226,6 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa(self, mfa: bool) -> Dict[str, Any]: @@ -454,7 +451,6 @@ def list_mfa_factors(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_mfa_recovery_codes(self) -> Dict[str, Any]: @@ -476,7 +472,6 @@ def get_mfa_recovery_codes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_mfa_recovery_codes(self) -> Dict[str, Any]: @@ -647,7 +642,6 @@ def get_prefs(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, prefs: dict) -> Dict[str, Any]: @@ -785,7 +779,6 @@ def list_sessions(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_sessions(self) -> Dict[str, Any]: @@ -1015,7 +1008,6 @@ def get_session(self, session_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_session(self, session_id: str) -> Dict[str, Any]: @@ -1205,7 +1197,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai Parameters ---------- provider : OAuthProvider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. + OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom. success : str URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. failure : str @@ -1236,7 +1228,6 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai api_params['scopes'] = scopes return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params, response_type='location') def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index efec859..36e15d8 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -50,7 +50,6 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_credit_card(self, code: CreditCard, width: float = None, height: float = None, quality: float = None) -> bytes: @@ -94,7 +93,6 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_favicon(self, url: str) -> bytes: @@ -128,7 +126,6 @@ def get_favicon(self, url: str) -> bytes: api_params['url'] = url return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_flag(self, code: Flag, width: float = None, height: float = None, quality: float = None) -> bytes: @@ -172,7 +169,6 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit api_params['quality'] = quality return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_image(self, url: str, width: float = None, height: float = None) -> bytes: @@ -214,7 +210,6 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte api_params['height'] = height return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_initials(self, name: str = None, width: float = None, height: float = None, background: str = None) -> bytes: @@ -257,7 +252,6 @@ def get_initials(self, name: str = None, width: float = None, height: float = No api_params['background'] = background return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_qr(self, text: str, size: float = None, margin: float = None, download: bool = None) -> bytes: @@ -299,5 +293,4 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: api_params['download'] = download return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index facfdea..0335087 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: @@ -113,7 +112,6 @@ def get(self, database_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: @@ -224,7 +222,6 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: @@ -315,7 +312,6 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_collection(self, database_id: str, collection_id: str, name: str, permissions: List[str] = None, document_security: bool = None, enabled: bool = None) -> Dict[str, Any]: @@ -447,7 +443,6 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_boolean_attribute(self, database_id: str, collection_id: str, key: str, required: bool, default: bool = None, array: bool = None) -> Dict[str, Any]: @@ -1625,7 +1620,6 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: @@ -1761,7 +1755,6 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: @@ -1862,7 +1855,6 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: @@ -1997,7 +1989,6 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None) -> Dict[str, Any]: @@ -2101,7 +2092,6 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, Any]: diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 7db7323..a483a22 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -162,7 +161,6 @@ def list_runtimes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_specifications(self) -> Dict[str, Any]: @@ -185,7 +183,6 @@ def list_specifications(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get(self, function_id: str) -> Dict[str, Any]: @@ -217,7 +214,6 @@ def get(self, function_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -373,7 +369,6 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_deployment(self, function_id: str, code: InputFile, activate: bool, entrypoint: str = None, commands: str = None, on_progress = None) -> Dict[str, Any]: @@ -472,7 +467,6 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: @@ -665,7 +659,6 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_executions(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -703,7 +696,6 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, 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) -> Dict[str, Any]: @@ -791,7 +783,6 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: @@ -862,7 +853,6 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, Any]: @@ -944,7 +934,6 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]: diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 23f5aa9..dd1d183 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -27,7 +27,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_antivirus(self) -> Dict[str, Any]: @@ -49,7 +48,6 @@ def get_antivirus(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_cache(self) -> Dict[str, Any]: @@ -71,7 +69,6 @@ def get_cache(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_certificate(self, domain: str = None) -> Dict[str, Any]: @@ -100,7 +97,6 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: api_params['domain'] = domain return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_db(self) -> Dict[str, Any]: @@ -122,7 +118,6 @@ def get_db(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_pub_sub(self) -> Dict[str, Any]: @@ -144,7 +139,6 @@ def get_pub_sub(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: @@ -173,7 +167,6 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: @@ -202,7 +195,6 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict[str, Any]: @@ -234,7 +226,6 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: @@ -263,7 +254,6 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any]: @@ -299,7 +289,6 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: @@ -328,7 +317,6 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: @@ -357,7 +345,6 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: @@ -386,7 +373,6 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: @@ -415,7 +401,6 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: @@ -444,7 +429,6 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: @@ -473,7 +457,6 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: 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) -> Dict[str, Any]: @@ -502,36 +485,6 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_queue_stats_usage_dump(self, threshold: float = None) -> Dict[str, Any]: - """ - Get the number of projects containing metrics that are waiting to be processed in the Appwrite internal queue server. - - Parameters - ---------- - threshold : float - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/health/queue/stats-usage-dump' - api_params = {} - - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: @@ -560,7 +513,6 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: api_params['threshold'] = threshold return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_storage(self) -> Dict[str, Any]: @@ -582,7 +534,6 @@ def get_storage(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_storage_local(self) -> Dict[str, Any]: @@ -604,7 +555,6 @@ def get_storage_local(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_time(self) -> Dict[str, Any]: @@ -626,5 +576,4 @@ def get_time(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/locale.py b/appwrite/services/locale.py index 67f7a9c..c34ddee 100644 --- a/appwrite/services/locale.py +++ b/appwrite/services/locale.py @@ -28,7 +28,6 @@ def get(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_codes(self) -> Dict[str, Any]: @@ -50,7 +49,6 @@ def list_codes(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_continents(self) -> Dict[str, Any]: @@ -72,7 +70,6 @@ def list_continents(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries(self) -> Dict[str, Any]: @@ -94,7 +91,6 @@ def list_countries(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries_eu(self) -> Dict[str, Any]: @@ -116,7 +112,6 @@ def list_countries_eu(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_countries_phones(self) -> Dict[str, Any]: @@ -138,7 +133,6 @@ def list_countries_phones(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_currencies(self) -> Dict[str, Any]: @@ -160,7 +154,6 @@ def list_currencies(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_languages(self) -> Dict[str, Any]: @@ -182,5 +175,4 @@ def list_languages(self) -> Dict[str, Any]: api_params = {} return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 684c08d..639a820 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -38,7 +38,6 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -485,7 +484,6 @@ def get_message(self, message_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete(self, message_id: str) -> Dict[str, Any]: @@ -552,7 +550,6 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, Any]: @@ -587,7 +584,6 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -619,7 +615,6 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, 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) -> Dict[str, Any]: @@ -1709,7 +1704,6 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_provider(self, provider_id: str) -> Dict[str, Any]: @@ -1776,7 +1770,6 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> Dict[str, Any]: @@ -1811,7 +1804,6 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -1843,7 +1835,6 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> Dict[str, Any]: @@ -1917,7 +1908,6 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = None) -> Dict[str, Any]: @@ -2023,7 +2013,6 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: @@ -2061,7 +2050,6 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) -> Dict[str, Any]: @@ -2144,7 +2132,6 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index cf43652..610e11e 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -40,7 +40,6 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -134,7 +133,6 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -266,7 +264,6 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions: List[str] = None, on_progress = None) -> Dict[str, Any]: @@ -366,7 +363,6 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_file(self, bucket_id: str, file_id: str, name: str = None, permissions: List[str] = None) -> Dict[str, Any]: @@ -486,7 +482,6 @@ def get_file_download(self, bucket_id: str, file_id: str) -> bytes: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, 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) -> bytes: @@ -557,7 +552,6 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he api_params['output'] = output return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_file_view(self, bucket_id: str, file_id: str) -> bytes: @@ -595,5 +589,4 @@ def get_file_view(self, bucket_id: str, file_id: str) -> bytes: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 2a106a5..778cd07 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -36,7 +36,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, Any]: @@ -109,7 +108,6 @@ def get(self, team_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_name(self, team_id: str, name: str) -> Dict[str, Any]: @@ -217,7 +215,6 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) 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) -> Dict[str, Any]: @@ -315,7 +312,6 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_membership(self, team_id: str, membership_id: str, roles: List[str]) -> Dict[str, Any]: @@ -483,7 +479,6 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: diff --git a/appwrite/services/users.py b/appwrite/services/users.py index f4497c1..532c69f 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -39,7 +39,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create(self, user_id: str, email: str = None, phone: str = None, password: str = None, name: str = None) -> Dict[str, Any]: @@ -209,7 +208,6 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict api_params['search'] = search return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete_identity(self, identity_id: str) -> Dict[str, Any]: @@ -559,7 +557,6 @@ def get(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def delete(self, user_id: str) -> Dict[str, Any]: @@ -742,7 +739,6 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def list_memberships(self, user_id: str) -> Dict[str, Any]: @@ -774,7 +770,6 @@ def list_memberships(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: @@ -882,7 +877,6 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: @@ -914,7 +908,6 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: @@ -1124,7 +1117,6 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: @@ -1194,7 +1186,6 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_session(self, user_id: str) -> Dict[str, Any]: @@ -1371,7 +1362,6 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any api_params['queries'] = queries return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def create_target(self, user_id: str, target_id: str, provider_type: MessagingProviderType, identifier: str, provider_id: str = None, name: str = None) -> Dict[str, Any]: @@ -1465,7 +1455,6 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { - 'content-type': 'application/json', }, api_params) def update_target(self, user_id: str, target_id: str, identifier: str = None, provider_id: str = None, name: str = None) -> Dict[str, Any]: diff --git a/docs/examples/health/get-queue-stats-usage-dump.md b/docs/examples/health/get-queue-stats-usage-dump.md deleted file mode 100644 index c58059e..0000000 --- a/docs/examples/health/get-queue-stats-usage-dump.md +++ /dev/null @@ -1,13 +0,0 @@ -from appwrite.client import Client -from appwrite.services.health import Health - -client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -health = Health(client) - -result = health.get_queue_stats_usage_dump( - threshold = None # optional -) diff --git a/setup.py b/setup.py index 6ffadf7..1b9067b 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.3', + version = '9.0.4', 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/9.0.3.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/9.0.4.tar.gz', install_requires=[ 'requests', ], From 0a2355c3e9bc73830a1d262bbc7b1315e4aaff13 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Thu, 17 Apr 2025 20:37:44 +0100 Subject: [PATCH 15/24] chore: major version bump --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index ce46fde..2548979 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/9.0.4 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/10.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '9.0.4', + 'x-sdk-version': '10.0.0', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/setup.py b/setup.py index 1b9067b..2534ed2 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '9.0.4', + version = '10.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/9.0.4.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/10.0.0.tar.gz', install_requires=[ 'requests', ], From ec6af741333f34ba153107a756c693bc69392111 Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Thu, 8 May 2025 23:26:59 +1200 Subject: [PATCH 16/24] Add bulk API methods --- appwrite/client.py | 4 +- appwrite/services/databases.py | 173 +++++++++++++++++- .../account/create-anonymous-session.md | 2 +- .../account/create-email-password-session.md | 2 +- docs/examples/account/create-email-token.md | 2 +- docs/examples/account/create-j-w-t.md | 2 +- .../account/create-magic-u-r-l-token.md | 2 +- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- docs/examples/account/create-o-auth2token.md | 2 +- docs/examples/account/create-phone-token.md | 2 +- .../account/create-phone-verification.md | 2 +- docs/examples/account/create-recovery.md | 2 +- docs/examples/account/create-session.md | 2 +- docs/examples/account/create-verification.md | 2 +- docs/examples/account/create.md | 2 +- docs/examples/account/delete-identity.md | 2 +- .../account/delete-mfa-authenticator.md | 2 +- docs/examples/account/delete-session.md | 2 +- docs/examples/account/delete-sessions.md | 2 +- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/get-prefs.md | 2 +- docs/examples/account/get-session.md | 2 +- docs/examples/account/get.md | 2 +- docs/examples/account/list-identities.md | 2 +- docs/examples/account/list-logs.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- docs/examples/account/list-sessions.md | 2 +- docs/examples/account/update-email.md | 2 +- docs/examples/account/update-m-f-a.md | 2 +- .../account/update-magic-u-r-l-session.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- docs/examples/account/update-name.md | 2 +- docs/examples/account/update-password.md | 2 +- docs/examples/account/update-phone-session.md | 2 +- .../account/update-phone-verification.md | 2 +- docs/examples/account/update-phone.md | 2 +- docs/examples/account/update-prefs.md | 2 +- docs/examples/account/update-recovery.md | 2 +- docs/examples/account/update-session.md | 2 +- docs/examples/account/update-status.md | 2 +- docs/examples/account/update-verification.md | 2 +- docs/examples/avatars/get-browser.md | 2 +- docs/examples/avatars/get-credit-card.md | 2 +- docs/examples/avatars/get-favicon.md | 2 +- docs/examples/avatars/get-flag.md | 2 +- docs/examples/avatars/get-image.md | 2 +- docs/examples/avatars/get-initials.md | 2 +- docs/examples/avatars/get-q-r.md | 2 +- .../databases/create-boolean-attribute.md | 2 +- docs/examples/databases/create-collection.md | 2 +- .../databases/create-datetime-attribute.md | 2 +- docs/examples/databases/create-document.md | 2 +- docs/examples/databases/create-documents.md | 15 ++ .../databases/create-email-attribute.md | 2 +- .../databases/create-enum-attribute.md | 2 +- .../databases/create-float-attribute.md | 2 +- docs/examples/databases/create-index.md | 2 +- .../databases/create-integer-attribute.md | 2 +- .../examples/databases/create-ip-attribute.md | 2 +- .../create-relationship-attribute.md | 2 +- .../databases/create-string-attribute.md | 2 +- .../databases/create-url-attribute.md | 2 +- docs/examples/databases/create.md | 2 +- docs/examples/databases/delete-attribute.md | 2 +- docs/examples/databases/delete-collection.md | 2 +- docs/examples/databases/delete-document.md | 2 +- docs/examples/databases/delete-documents.md | 15 ++ docs/examples/databases/delete-index.md | 2 +- docs/examples/databases/delete.md | 2 +- docs/examples/databases/get-attribute.md | 2 +- docs/examples/databases/get-collection.md | 2 +- docs/examples/databases/get-document.md | 2 +- docs/examples/databases/get-index.md | 2 +- docs/examples/databases/get.md | 2 +- docs/examples/databases/list-attributes.md | 2 +- docs/examples/databases/list-collections.md | 2 +- docs/examples/databases/list-documents.md | 2 +- docs/examples/databases/list-indexes.md | 2 +- docs/examples/databases/list.md | 2 +- .../databases/update-boolean-attribute.md | 2 +- docs/examples/databases/update-collection.md | 2 +- .../databases/update-datetime-attribute.md | 2 +- docs/examples/databases/update-document.md | 2 +- docs/examples/databases/update-documents.md | 16 ++ .../databases/update-email-attribute.md | 2 +- .../databases/update-enum-attribute.md | 2 +- .../databases/update-float-attribute.md | 2 +- .../databases/update-integer-attribute.md | 2 +- .../examples/databases/update-ip-attribute.md | 2 +- .../update-relationship-attribute.md | 2 +- .../databases/update-string-attribute.md | 2 +- .../databases/update-url-attribute.md | 2 +- docs/examples/databases/update.md | 2 +- docs/examples/databases/upsert-documents.md | 15 ++ docs/examples/functions/create-build.md | 2 +- docs/examples/functions/create-deployment.md | 2 +- docs/examples/functions/create-execution.md | 2 +- docs/examples/functions/create-variable.md | 2 +- docs/examples/functions/create.md | 2 +- docs/examples/functions/delete-deployment.md | 2 +- docs/examples/functions/delete-execution.md | 2 +- docs/examples/functions/delete-variable.md | 2 +- docs/examples/functions/delete.md | 2 +- .../functions/get-deployment-download.md | 2 +- docs/examples/functions/get-deployment.md | 2 +- docs/examples/functions/get-execution.md | 2 +- docs/examples/functions/get-variable.md | 2 +- docs/examples/functions/get.md | 2 +- docs/examples/functions/list-deployments.md | 2 +- docs/examples/functions/list-executions.md | 2 +- docs/examples/functions/list-runtimes.md | 2 +- .../examples/functions/list-specifications.md | 2 +- docs/examples/functions/list-variables.md | 2 +- docs/examples/functions/list.md | 2 +- .../functions/update-deployment-build.md | 2 +- docs/examples/functions/update-deployment.md | 2 +- docs/examples/functions/update-variable.md | 2 +- docs/examples/functions/update.md | 2 +- docs/examples/graphql/mutation.md | 2 +- docs/examples/graphql/query.md | 2 +- docs/examples/health/get-antivirus.md | 2 +- docs/examples/health/get-cache.md | 2 +- docs/examples/health/get-certificate.md | 2 +- docs/examples/health/get-d-b.md | 2 +- docs/examples/health/get-failed-jobs.md | 2 +- docs/examples/health/get-pub-sub.md | 2 +- docs/examples/health/get-queue-builds.md | 2 +- .../examples/health/get-queue-certificates.md | 2 +- docs/examples/health/get-queue-databases.md | 2 +- docs/examples/health/get-queue-deletes.md | 2 +- docs/examples/health/get-queue-functions.md | 2 +- docs/examples/health/get-queue-logs.md | 2 +- docs/examples/health/get-queue-mails.md | 2 +- docs/examples/health/get-queue-messaging.md | 2 +- docs/examples/health/get-queue-migrations.md | 2 +- .../health/get-queue-stats-resources.md | 2 +- docs/examples/health/get-queue-usage.md | 2 +- docs/examples/health/get-queue-webhooks.md | 2 +- docs/examples/health/get-storage-local.md | 2 +- docs/examples/health/get-storage.md | 2 +- docs/examples/health/get-time.md | 2 +- docs/examples/health/get.md | 2 +- docs/examples/locale/get.md | 2 +- docs/examples/locale/list-codes.md | 2 +- docs/examples/locale/list-continents.md | 2 +- docs/examples/locale/list-countries-e-u.md | 2 +- docs/examples/locale/list-countries-phones.md | 2 +- docs/examples/locale/list-countries.md | 2 +- docs/examples/locale/list-currencies.md | 2 +- docs/examples/locale/list-languages.md | 2 +- .../messaging/create-apns-provider.md | 2 +- docs/examples/messaging/create-email.md | 2 +- .../examples/messaging/create-fcm-provider.md | 2 +- .../messaging/create-mailgun-provider.md | 2 +- .../messaging/create-msg91provider.md | 2 +- docs/examples/messaging/create-push.md | 2 +- .../messaging/create-sendgrid-provider.md | 2 +- docs/examples/messaging/create-sms.md | 2 +- .../messaging/create-smtp-provider.md | 2 +- docs/examples/messaging/create-subscriber.md | 2 +- .../messaging/create-telesign-provider.md | 2 +- .../messaging/create-textmagic-provider.md | 2 +- docs/examples/messaging/create-topic.md | 2 +- .../messaging/create-twilio-provider.md | 2 +- .../messaging/create-vonage-provider.md | 2 +- docs/examples/messaging/delete-provider.md | 2 +- docs/examples/messaging/delete-subscriber.md | 2 +- docs/examples/messaging/delete-topic.md | 2 +- docs/examples/messaging/delete.md | 2 +- docs/examples/messaging/get-message.md | 2 +- docs/examples/messaging/get-provider.md | 2 +- docs/examples/messaging/get-subscriber.md | 2 +- docs/examples/messaging/get-topic.md | 2 +- docs/examples/messaging/list-message-logs.md | 2 +- docs/examples/messaging/list-messages.md | 2 +- docs/examples/messaging/list-provider-logs.md | 2 +- docs/examples/messaging/list-providers.md | 2 +- .../messaging/list-subscriber-logs.md | 2 +- docs/examples/messaging/list-subscribers.md | 2 +- docs/examples/messaging/list-targets.md | 2 +- docs/examples/messaging/list-topic-logs.md | 2 +- docs/examples/messaging/list-topics.md | 2 +- .../messaging/update-apns-provider.md | 2 +- docs/examples/messaging/update-email.md | 2 +- .../examples/messaging/update-fcm-provider.md | 2 +- .../messaging/update-mailgun-provider.md | 2 +- .../messaging/update-msg91provider.md | 2 +- docs/examples/messaging/update-push.md | 2 +- .../messaging/update-sendgrid-provider.md | 2 +- docs/examples/messaging/update-sms.md | 2 +- .../messaging/update-smtp-provider.md | 2 +- .../messaging/update-telesign-provider.md | 2 +- .../messaging/update-textmagic-provider.md | 2 +- docs/examples/messaging/update-topic.md | 2 +- .../messaging/update-twilio-provider.md | 2 +- .../messaging/update-vonage-provider.md | 2 +- docs/examples/storage/create-bucket.md | 2 +- docs/examples/storage/create-file.md | 2 +- docs/examples/storage/delete-bucket.md | 2 +- docs/examples/storage/delete-file.md | 2 +- docs/examples/storage/get-bucket.md | 2 +- docs/examples/storage/get-file-download.md | 2 +- docs/examples/storage/get-file-preview.md | 2 +- docs/examples/storage/get-file-view.md | 2 +- docs/examples/storage/get-file.md | 2 +- docs/examples/storage/list-buckets.md | 2 +- docs/examples/storage/list-files.md | 2 +- docs/examples/storage/update-bucket.md | 2 +- docs/examples/storage/update-file.md | 2 +- docs/examples/teams/create-membership.md | 2 +- docs/examples/teams/create.md | 2 +- docs/examples/teams/delete-membership.md | 2 +- docs/examples/teams/delete.md | 2 +- docs/examples/teams/get-membership.md | 2 +- docs/examples/teams/get-prefs.md | 2 +- docs/examples/teams/get.md | 2 +- docs/examples/teams/list-memberships.md | 2 +- docs/examples/teams/list.md | 2 +- .../teams/update-membership-status.md | 2 +- docs/examples/teams/update-membership.md | 2 +- docs/examples/teams/update-name.md | 2 +- docs/examples/teams/update-prefs.md | 2 +- docs/examples/users/create-argon2user.md | 2 +- docs/examples/users/create-bcrypt-user.md | 2 +- docs/examples/users/create-j-w-t.md | 2 +- docs/examples/users/create-m-d5user.md | 2 +- .../users/create-mfa-recovery-codes.md | 2 +- docs/examples/users/create-p-h-pass-user.md | 2 +- docs/examples/users/create-s-h-a-user.md | 2 +- .../users/create-scrypt-modified-user.md | 2 +- docs/examples/users/create-scrypt-user.md | 2 +- docs/examples/users/create-session.md | 2 +- docs/examples/users/create-target.md | 2 +- docs/examples/users/create-token.md | 2 +- docs/examples/users/create.md | 2 +- docs/examples/users/delete-identity.md | 2 +- .../users/delete-mfa-authenticator.md | 2 +- docs/examples/users/delete-session.md | 2 +- docs/examples/users/delete-sessions.md | 2 +- docs/examples/users/delete-target.md | 2 +- docs/examples/users/delete.md | 2 +- docs/examples/users/get-mfa-recovery-codes.md | 2 +- docs/examples/users/get-prefs.md | 2 +- docs/examples/users/get-target.md | 2 +- docs/examples/users/get.md | 2 +- docs/examples/users/list-identities.md | 2 +- docs/examples/users/list-logs.md | 2 +- docs/examples/users/list-memberships.md | 2 +- docs/examples/users/list-mfa-factors.md | 2 +- docs/examples/users/list-sessions.md | 2 +- docs/examples/users/list-targets.md | 2 +- docs/examples/users/list.md | 2 +- .../users/update-email-verification.md | 2 +- docs/examples/users/update-email.md | 2 +- docs/examples/users/update-labels.md | 2 +- .../users/update-mfa-recovery-codes.md | 2 +- docs/examples/users/update-mfa.md | 2 +- docs/examples/users/update-name.md | 2 +- docs/examples/users/update-password.md | 2 +- .../users/update-phone-verification.md | 2 +- docs/examples/users/update-phone.md | 2 +- docs/examples/users/update-prefs.md | 2 +- docs/examples/users/update-status.md | 2 +- docs/examples/users/update-target.md | 2 +- setup.py | 4 +- 269 files changed, 499 insertions(+), 267 deletions(-) create mode 100644 docs/examples/databases/create-documents.md create mode 100644 docs/examples/databases/delete-documents.md create mode 100644 docs/examples/databases/update-documents.md create mode 100644 docs/examples/databases/upsert-documents.md diff --git a/appwrite/client.py b/appwrite/client.py index 2548979..bab61ea 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/10.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/10.1.0-rc.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '10.0.0', + 'x-sdk-version': '10.1.0-rc.1', 'X-Appwrite-Response-Format' : '1.6.0', } diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 0335087..4561066 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1760,7 +1760,6 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str def create_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- @@ -1811,6 +1810,178 @@ def create_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) + def create_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: + """ + Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + documents : List[dict] + Array of documents data as JSON objects. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if documents is None: + raise AppwriteException('Missing required parameter: "documents"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + + api_params['documents'] = documents + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict] = None) -> Dict[str, Any]: + """ + Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + documents : List[dict] + Array of document data as JSON objects. May contain partial documents. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + + api_params['documents'] = documents + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_documents(self, database_id: str, collection_id: str, data: dict = None, queries: List[str] = None) -> Dict[str, Any]: + """ + Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + data : dict + Document data as JSON object. Include only attribute and value pairs to be updated. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + + api_params['data'] = data + api_params['queries'] = queries + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_documents(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Bulk delete documents using queries, if no queries are passed then all documents are deleted. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + + api_params['queries'] = queries + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + def get_document(self, database_id: str, collection_id: str, document_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index ce5a92a..c3b7a87 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 5e869fd..e831821 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 5cf2bfb..7ff4f6b 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-j-w-t.md b/docs/examples/account/create-j-w-t.md index c737f1b..172f45f 100644 --- a/docs/examples/account/create-j-w-t.md +++ b/docs/examples/account/create-j-w-t.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-magic-u-r-l-token.md b/docs/examples/account/create-magic-u-r-l-token.md index 0077817..14e76ed 100644 --- a/docs/examples/account/create-magic-u-r-l-token.md +++ b/docs/examples/account/create-magic-u-r-l-token.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index a6f09eb..70cee1d 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -3,7 +3,7 @@ from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index deb4c9c..abd746c 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -3,7 +3,7 @@ from appwrite.services.account import Account from appwrite.enums import AuthenticationFactor client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index a149cb9..69aaa60 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/create-o-auth2token.md b/docs/examples/account/create-o-auth2token.md index fa11d31..2dc171b 100644 --- a/docs/examples/account/create-o-auth2token.md +++ b/docs/examples/account/create-o-auth2token.md @@ -3,7 +3,7 @@ from appwrite.services.account import Account from appwrite.enums import OAuthProvider client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index d242d71..06c2b20 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index bb2058e..c130646 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 3d215a4..51c1777 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index d00e8cb..1048dfe 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 329d19e..d66fc2c 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 39b33c6..7eda5a3 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index 3556122..0c894fa 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 939ea71..83709c7 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -3,7 +3,7 @@ from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9ddb443..5967d70 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 751ab9b..5061f84 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index f70b968..c8fe494 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 52df645..d577b4b 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index f38466f..3e2937b 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index b414047..5426228 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 4bf9beb..aeb23be 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 5d8c27a..67d193d 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index ba3796b..72a3924 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 7473313..c553a7b 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 004d071..14de4fd 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-m-f-a.md b/docs/examples/account/update-m-f-a.md index 2f9321c..7083d09 100644 --- a/docs/examples/account/update-m-f-a.md +++ b/docs/examples/account/update-m-f-a.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-magic-u-r-l-session.md b/docs/examples/account/update-magic-u-r-l-session.md index ca8e8e5..0146083 100644 --- a/docs/examples/account/update-magic-u-r-l-session.md +++ b/docs/examples/account/update-magic-u-r-l-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index a5a9519..d53607f 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -3,7 +3,7 @@ from appwrite.services.account import Account from appwrite.enums import AuthenticatorType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index d28a251..cfc58c5 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 38cb41c..51718eb 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 9b4bf82..534a94e 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index ecb4228..3c072e3 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index d29ab28..52e7723 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID account = Account(client) diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index e64d79f..bcc57de 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 65a6a38..a2cb7d3 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index c368300..e2ac7a2 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 2493dc5..ed140ab 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index ee3a2f7..abee773 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index c8318a4..a5272f0 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 63a7f26..fbc7af5 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.account import Account client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 7ed8318..c7ae77f 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -3,7 +3,7 @@ from appwrite.services.avatars import Avatars from appwrite.enums import Browser client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index aa66b86..160636d 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -3,7 +3,7 @@ from appwrite.services.avatars import Avatars from appwrite.enums import CreditCard client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 2c6a67e..f034ea4 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.avatars import Avatars client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 435c855..844dbb6 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -3,7 +3,7 @@ from appwrite.services.avatars import Avatars from appwrite.enums import Flag client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index ee9e0cb..9272c4d 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.avatars import Avatars client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index edcbbb3..2729ff5 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.avatars import Avatars client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/avatars/get-q-r.md b/docs/examples/avatars/get-q-r.md index 7f6da32..3fb76a7 100644 --- a/docs/examples/avatars/get-q-r.md +++ b/docs/examples/avatars/get-q-r.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.avatars import Avatars client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index 2b4209d..f12f446 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 99c44a2..596d4a9 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index db81c02..8fd59e6 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 22f2c07..1eaf024 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md new file mode 100644 index 0000000..1178a0f --- /dev/null +++ b/docs/examples/databases/create-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.create_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + documents = [] +) diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 2e28e0b..230567a 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index b1efdc7..de1ceb9 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index b36863b..53305c8 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 9885c06..fe78b5e 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -3,7 +3,7 @@ from appwrite.services.databases import Databases from appwrite.enums import IndexType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 8cb140a..92e8b0f 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index d4b4ab6..a7f424b 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index 4172c27..6c8f4dc 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -3,7 +3,7 @@ from appwrite.services.databases import Databases from appwrite.enums import RelationshipType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index e696871..dc434cc 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 4ad03c4..af37573 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index d5cbb99..0492203 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index b317ba9..e1c4eec 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index ab274c6..02f1e1c 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 69151aa..57f8b3b 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md new file mode 100644 index 0000000..a315f0c --- /dev/null +++ b/docs/examples/databases/delete-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 2ed0165..0060064 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index e7e988a..be64e8c 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index a717552..dcdb0a6 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index f63298e..0833b4f 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index acdc25d..aff5008 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index ca5a995..6971683 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index deadf6a..c8191a3 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 245ec60..c97a5ce 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index ca18267..17d0a3d 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 41f0380..8b450cd 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index bf18bd1..1457151 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 11669b3..58336c9 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index c9300ea..a0f72a4 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index d929728..2e5be50 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 96c7fb5..29bc6be 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 7b9cce9..9ef6527 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md new file mode 100644 index 0000000..5a50d1a --- /dev/null +++ b/docs/examples/databases/update-documents.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + data = {}, # optional + queries = [] # optional +) diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 5b042d4..c833789 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index caa1b4e..6186a72 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index d16b9bb..68cb7d7 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index ab0ccd6..05c6bfe 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index a2b8bad..550d3af 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 0aacc13..3b6c8e9 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index c85eb25..5b66fb0 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 53da6ae..4a62027 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index da59776..35d2c0c 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.databases import Databases client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md new file mode 100644 index 0000000..9972064 --- /dev/null +++ b/docs/examples/databases/upsert-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.upsert_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + documents = [] # optional +) diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-build.md index ce2ffb7..3d784b0 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-build.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index c86fdf6..0774005 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -3,7 +3,7 @@ from appwrite.services.functions import Functions from appwrite.input_file import InputFile client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index cb3fddd..b41c7e3 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 101ecdf..84c286f 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index f10a953..68d6e99 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -3,7 +3,7 @@ from appwrite.services.functions import Functions from appwrite.enums import client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index f98bd60..f874b2d 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index b723fd6..df7ce7c 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index e17afed..a6e3dc8 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index a34d476..ed2fef7 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 90f029a..8cc16fa 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 0617b04..59a1374 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 0a9a347..a299f35 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index 174c8b2..629948e 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index a463fa6..eeab5a5 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 4d8feea..4eb92f6 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 293bab0..e83f727 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index b624733..9c89a36 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index 5e1ec7f..d7d0036 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index ee1a516..ebc19c5 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 0b5f18d..b1d696d 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-build.md index c69cd7c..ef2b8a6 100644 --- a/docs/examples/functions/update-deployment-build.md +++ b/docs/examples/functions/update-deployment-build.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-deployment.md index 0f4c96e..6b96434 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-deployment.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index bcab368..e333ec1 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index a728241..64ee39b 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.functions import Functions client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index e05f602..189892a 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.graphql import Graphql client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index c8f3c78..585a502 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.graphql import Graphql client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 7bc0475..2b62147 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 7e69825..595c4bf 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index f6a713e..5b3e2c0 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-d-b.md b/docs/examples/health/get-d-b.md index a23a073..47c7bd8 100644 --- a/docs/examples/health/get-d-b.md +++ b/docs/examples/health/get-d-b.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index d0fe64f..5362a2d 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -3,7 +3,7 @@ from appwrite.services.health import Health from appwrite.enums import client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 109b288..e5115d0 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index b1d4d62..18ed8e3 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 99f52b8..b0a29e2 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 7d5e5a0..491d1f7 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index d677af5..fa860c6 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 3ffc4b8..d4ca938 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 0cb6417..1479f03 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 97a501c..6835efe 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index ea93eab..34cbad2 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 09e35df..019db4e 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md index 3b09342..92aebc3 100644 --- a/docs/examples/health/get-queue-stats-resources.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index dbee75f..266ca82 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index 1072a20..df5e2d5 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index d3b94b2..7d2ea44 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index 65af2f9..821d9f3 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index d63beb9..907e964 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index f5c494e..c544fcc 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.health import Health client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index a44f497..6f2a877 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 12cd12e..5f3e501 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index ea4ac53..0aead81 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-countries-e-u.md b/docs/examples/locale/list-countries-e-u.md index 7fb6aaa..f88e331 100644 --- a/docs/examples/locale/list-countries-e-u.md +++ b/docs/examples/locale/list-countries-e-u.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index aafdb3d..b1fdc1a 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index a2f1ec4..0c5b23c 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 39267c6..20009d6 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 6dec1b9..1962a83 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.locale import Locale client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 700e909..b57fa00 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 92353e2..8b4c9d2 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index d13ba02..9c40eb7 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 8389971..6703f6f 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-msg91provider.md b/docs/examples/messaging/create-msg91provider.md index 117c46e..9315dcd 100644 --- a/docs/examples/messaging/create-msg91provider.md +++ b/docs/examples/messaging/create-msg91provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index d405185..8671b56 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 5d20cde..46ff54f 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index c7e66d8..d1c7b49 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 85c5823..99914f0 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index cb8f4f7..bc0c892 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index b602213..aff09fe 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 03287e8..46ded71 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index 4dd16da..c1cb465 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 524348f..4438563 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index 68416bd..6ffded5 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 2a1840d..649e504 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 94085ef..c012a9a 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 1c2f563..76f9093 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index aee928a..0153ac9 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 9e32d80..3fadcff 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 6bc85f2..58e6228 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 43185d7..ca997f2 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index dea6cbf..c238a98 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index 1c2ab0b..f28c3e5 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 8457f99..211649d 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index c8544fa..da87e59 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 258e7cd..03e5c4e 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index d2049bd..df8ec72 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index ba9e09d..f949b40 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index b941ccb..786ee42 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 57ba7f8..f8a3995 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index cb21567..1c2cefc 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 3f0205d..f695b61 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index b8f9d71..5731d5f 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 862e579..0119d71 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index aa1d4e9..039475f 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-msg91provider.md b/docs/examples/messaging/update-msg91provider.md index 2d4efdb..c5bd057 100644 --- a/docs/examples/messaging/update-msg91provider.md +++ b/docs/examples/messaging/update-msg91provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index 1266353..e3bb02e 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index e528bd5..fc0a44d 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 7cb0087..2eec4e2 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index 2d798d4..80019aa 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 91de1f1..193a26f 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index c303104..159f954 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 160ac26..721f160 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 865fcb5..b80c55b 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 8e01128..b25f416 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.messaging import Messaging client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 7e321f1..9672782 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index fa0b117..6e57284 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -3,7 +3,7 @@ from appwrite.services.storage import Storage from appwrite.input_file import InputFile client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 8cddfb9..dd8e8eb 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 08bba5c..17bc251 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 79f903f..e5eeb4c 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 1a82b26..d21db63 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 40f32f1..20939b2 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 3947c76..bf70d13 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 0c2d5e3..461543e 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 88540cd..51a1ae6 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index e26ac2e..4034bd4 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 61388b0..f2e741a 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index 336e8a0..cf1e577 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.storage import Storage client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 1af9f25..cb3bf73 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 7085d39..f623151 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index adf065c..6fb2182 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 762f532..056114b 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index 17bacff..3c028a5 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 035777d..8d64589 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 985924e..55f172e 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 885a4c2..6e6f15a 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index c92d4c9..bf91a50 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index ae6e524..9c08421 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index c50f345..db20c5a 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index d25c8db..160b496 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 9eca847..e82da1b 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.teams import Teams client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with diff --git a/docs/examples/users/create-argon2user.md b/docs/examples/users/create-argon2user.md index 3d65496..5e95cc2 100644 --- a/docs/examples/users/create-argon2user.md +++ b/docs/examples/users/create-argon2user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 76532a9..d3d9e21 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-j-w-t.md b/docs/examples/users/create-j-w-t.md index 2e1fdf6..bed6c48 100644 --- a/docs/examples/users/create-j-w-t.md +++ b/docs/examples/users/create-j-w-t.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-m-d5user.md b/docs/examples/users/create-m-d5user.md index da9d471..b1cbb53 100644 --- a/docs/examples/users/create-m-d5user.md +++ b/docs/examples/users/create-m-d5user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index a4477b0..64a87c0 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-p-h-pass-user.md b/docs/examples/users/create-p-h-pass-user.md index 363be4f..33f65f4 100644 --- a/docs/examples/users/create-p-h-pass-user.md +++ b/docs/examples/users/create-p-h-pass-user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-s-h-a-user.md b/docs/examples/users/create-s-h-a-user.md index bb78ff7..5b4c8f8 100644 --- a/docs/examples/users/create-s-h-a-user.md +++ b/docs/examples/users/create-s-h-a-user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 1cfbcfc..9d644ce 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 2d1e72b..f442ab9 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index bebd46b..7e4c49f 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index c11c7ca..dfa64ac 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -3,7 +3,7 @@ from appwrite.services.users import Users from appwrite.enums import MessagingProviderType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 00a0e78..b40658c 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index c8dac9f..4c51a3f 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 85c5b6d..412fbd3 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index b22d391..6472498 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -3,7 +3,7 @@ from appwrite.services.users import Users from appwrite.enums import AuthenticatorType client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index dda5713..815a96e 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 268c311..2dde88f 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 38cc5a9..287f5a2 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 090c20f..7032b0f 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index ec9986c..bca43b0 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index eb14d3a..ec9d363 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index f549f08..3b80b1f 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index 6e018c2..267086a 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index b10c320..0fc7811 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 10d8ae0..6cbbe49 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index fbb3b4c..9e3b005 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 1f40b1f..a2b5989 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index a9eead0..77b04c9 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 4766646..14107fa 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 4b09ca5..778f339 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 4623bc3..2605861 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 083715b..c4a468e 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 24c5b27..b9af53a 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index d0e4da4..c0990e1 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index efd6730..9b35701 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 6014ef5..1e328b4 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 90ac15f..d104184 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index a62e6a8..1d2656c 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index f522730..14826bb 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 64d9df3..76903b7 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index 8943ef5..49c0516 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 8951385..119c5fa 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.users import Users client = Client() -client.set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key diff --git a/setup.py b/setup.py index 2534ed2..7c9c69d 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '10.0.0', + version = '10.1.0-rc.1', 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/10.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/10.1.0-rc.1.tar.gz', install_requires=[ 'requests', ], From 500d1a50cbe046476abe198d9ca31286b3488225 Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Sun, 18 May 2025 00:04:57 +1200 Subject: [PATCH 17/24] Add support for 1.7 --- README.md | 4 +- appwrite/client.py | 6 +- appwrite/encoders/value_class_encoder.py | 20 + appwrite/enums/adapter.py | 5 + appwrite/enums/build_runtime.py | 66 + appwrite/enums/deployment_download_type.py | 5 + appwrite/enums/framework.py | 17 + appwrite/enums/image_format.py | 1 - appwrite/enums/runtime.py | 4 + appwrite/enums/vcs_deployment_type.py | 6 + appwrite/services/avatars.py | 6 +- appwrite/services/databases.py | 6 +- appwrite/services/functions.py | 230 +++- appwrite/services/sites.py | 1079 +++++++++++++++++ appwrite/services/storage.py | 17 +- appwrite/services/teams.py | 2 +- appwrite/services/tokens.py | 187 +++ appwrite/services/users.py | 8 +- docs/examples/avatars/get-browser.md | 2 +- docs/examples/avatars/get-credit-card.md | 2 +- docs/examples/avatars/get-flag.md | 2 +- docs/examples/databases/create-document.md | 3 +- docs/examples/databases/create-documents.md | 3 +- docs/examples/databases/create-index.md | 3 +- ...uild.md => create-duplicate-deployment.md} | 2 +- .../functions/create-template-deployment.md | 18 + docs/examples/functions/create-variable.md | 3 +- .../functions/create-vcs-deployment.md | 17 + docs/examples/functions/create.md | 4 - .../functions/get-deployment-download.md | 3 +- docs/examples/functions/list-executions.md | 3 +- ...t-build.md => update-deployment-status.md} | 2 +- ...yment.md => update-function-deployment.md} | 2 +- docs/examples/functions/update-variable.md | 3 +- docs/examples/sites/create-deployment.md | 19 + .../sites/create-duplicate-deployment.md | 14 + .../sites/create-template-deployment.md | 18 + docs/examples/sites/create-variable.md | 16 + docs/examples/sites/create-vcs-deployment.md | 17 + docs/examples/sites/create.md | 32 + docs/examples/sites/delete-deployment.md | 14 + docs/examples/sites/delete-log.md | 14 + docs/examples/sites/delete-variable.md | 14 + docs/examples/sites/delete.md | 13 + .../examples/sites/get-deployment-download.md | 15 + docs/examples/sites/get-deployment.md | 14 + docs/examples/sites/get-log.md | 14 + docs/examples/sites/get-variable.md | 14 + docs/examples/sites/get.md | 13 + docs/examples/sites/list-deployments.md | 15 + docs/examples/sites/list-frameworks.md | 11 + docs/examples/sites/list-logs.md | 14 + docs/examples/sites/list-specifications.md | 11 + docs/examples/sites/list-variables.md | 13 + docs/examples/sites/list.md | 14 + .../sites/update-deployment-status.md | 14 + docs/examples/sites/update-site-deployment.md | 14 + docs/examples/sites/update-variable.md | 17 + docs/examples/sites/update.md | 31 + docs/examples/storage/get-file-download.md | 3 +- docs/examples/storage/get-file-preview.md | 5 +- docs/examples/storage/get-file-view.md | 3 +- docs/examples/tokens/create-file-token.md | 15 + docs/examples/tokens/delete.md | 13 + docs/examples/tokens/get.md | 13 + docs/examples/tokens/list.md | 15 + docs/examples/tokens/update.md | 14 + docs/examples/users/list-memberships.md | 4 +- setup.py | 4 +- 69 files changed, 2119 insertions(+), 106 deletions(-) create mode 100644 appwrite/enums/adapter.py create mode 100644 appwrite/enums/build_runtime.py create mode 100644 appwrite/enums/deployment_download_type.py create mode 100644 appwrite/enums/framework.py create mode 100644 appwrite/enums/vcs_deployment_type.py create mode 100644 appwrite/services/sites.py create mode 100644 appwrite/services/tokens.py rename docs/examples/functions/{create-build.md => create-duplicate-deployment.md} (90%) create mode 100644 docs/examples/functions/create-template-deployment.md create mode 100644 docs/examples/functions/create-vcs-deployment.md rename docs/examples/functions/{update-deployment-build.md => update-deployment-status.md} (90%) rename docs/examples/functions/{update-deployment.md => update-function-deployment.md} (89%) create mode 100644 docs/examples/sites/create-deployment.md create mode 100644 docs/examples/sites/create-duplicate-deployment.md create mode 100644 docs/examples/sites/create-template-deployment.md create mode 100644 docs/examples/sites/create-variable.md create mode 100644 docs/examples/sites/create-vcs-deployment.md create mode 100644 docs/examples/sites/create.md create mode 100644 docs/examples/sites/delete-deployment.md create mode 100644 docs/examples/sites/delete-log.md create mode 100644 docs/examples/sites/delete-variable.md create mode 100644 docs/examples/sites/delete.md create mode 100644 docs/examples/sites/get-deployment-download.md create mode 100644 docs/examples/sites/get-deployment.md create mode 100644 docs/examples/sites/get-log.md create mode 100644 docs/examples/sites/get-variable.md create mode 100644 docs/examples/sites/get.md create mode 100644 docs/examples/sites/list-deployments.md create mode 100644 docs/examples/sites/list-frameworks.md create mode 100644 docs/examples/sites/list-logs.md create mode 100644 docs/examples/sites/list-specifications.md create mode 100644 docs/examples/sites/list-variables.md create mode 100644 docs/examples/sites/list.md create mode 100644 docs/examples/sites/update-deployment-status.md create mode 100644 docs/examples/sites/update-site-deployment.md create mode 100644 docs/examples/sites/update-variable.md create mode 100644 docs/examples/sites/update.md create mode 100644 docs/examples/tokens/create-file-token.md create mode 100644 docs/examples/tokens/delete.md create mode 100644 docs/examples/tokens/get.md create mode 100644 docs/examples/tokens/list.md create mode 100644 docs/examples/tokens/update.md diff --git a/README.md b/README.md index c16cd61..2efa745 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite/client.py b/appwrite/client.py index bab61ea..bda3b80 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,12 +14,12 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/10.1.0-rc.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/10.2.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '10.1.0-rc.1', - 'X-Appwrite-Response-Format' : '1.6.0', + 'x-sdk-version': '10.2.0', + 'X-Appwrite-Response-Format' : '1.7.0', } def set_self_signed(self, status=True): diff --git a/appwrite/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index 95b06b7..72297a5 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -9,10 +9,15 @@ from ..enums.relation_mutate import RelationMutate from ..enums.index_type import IndexType from ..enums.runtime import Runtime +from ..enums.vcs_deployment_type import VCSDeploymentType +from ..enums.deployment_download_type import DeploymentDownloadType from ..enums.execution_method import ExecutionMethod from ..enums.name import Name from ..enums.message_priority import MessagePriority from ..enums.smtp_encryption import SmtpEncryption +from ..enums.framework import Framework +from ..enums.build_runtime import BuildRuntime +from ..enums.adapter import Adapter from ..enums.compression import Compression from ..enums.image_gravity import ImageGravity from ..enums.image_format import ImageFormat @@ -51,6 +56,12 @@ def default(self, o): if isinstance(o, Runtime): return o.value + if isinstance(o, VCSDeploymentType): + return o.value + + if isinstance(o, DeploymentDownloadType): + return o.value + if isinstance(o, ExecutionMethod): return o.value @@ -63,6 +74,15 @@ def default(self, o): if isinstance(o, SmtpEncryption): return o.value + if isinstance(o, Framework): + return o.value + + if isinstance(o, BuildRuntime): + return o.value + + if isinstance(o, Adapter): + return o.value + if isinstance(o, Compression): return o.value diff --git a/appwrite/enums/adapter.py b/appwrite/enums/adapter.py new file mode 100644 index 0000000..821aa24 --- /dev/null +++ b/appwrite/enums/adapter.py @@ -0,0 +1,5 @@ +from enum import Enum + +class Adapter(Enum): + STATIC = "static" + SSR = "ssr" diff --git a/appwrite/enums/build_runtime.py b/appwrite/enums/build_runtime.py new file mode 100644 index 0000000..9ba151b --- /dev/null +++ b/appwrite/enums/build_runtime.py @@ -0,0 +1,66 @@ +from enum import Enum + +class BuildRuntime(Enum): + NODE_14_5 = "node-14.5" + NODE_16_0 = "node-16.0" + NODE_18_0 = "node-18.0" + NODE_19_0 = "node-19.0" + NODE_20_0 = "node-20.0" + NODE_21_0 = "node-21.0" + NODE_22 = "node-22" + PHP_8_0 = "php-8.0" + PHP_8_1 = "php-8.1" + PHP_8_2 = "php-8.2" + PHP_8_3 = "php-8.3" + RUBY_3_0 = "ruby-3.0" + RUBY_3_1 = "ruby-3.1" + RUBY_3_2 = "ruby-3.2" + RUBY_3_3 = "ruby-3.3" + PYTHON_3_8 = "python-3.8" + PYTHON_3_9 = "python-3.9" + PYTHON_3_10 = "python-3.10" + PYTHON_3_11 = "python-3.11" + PYTHON_3_12 = "python-3.12" + PYTHON_ML_3_11 = "python-ml-3.11" + PYTHON_ML_3_12 = "python-ml-3.12" + DENO_1_21 = "deno-1.21" + DENO_1_24 = "deno-1.24" + DENO_1_35 = "deno-1.35" + DENO_1_40 = "deno-1.40" + DENO_1_46 = "deno-1.46" + DENO_2_0 = "deno-2.0" + DART_2_15 = "dart-2.15" + DART_2_16 = "dart-2.16" + DART_2_17 = "dart-2.17" + DART_2_18 = "dart-2.18" + DART_2_19 = "dart-2.19" + DART_3_0 = "dart-3.0" + DART_3_1 = "dart-3.1" + DART_3_3 = "dart-3.3" + DART_3_5 = "dart-3.5" + DOTNET_6_0 = "dotnet-6.0" + DOTNET_7_0 = "dotnet-7.0" + DOTNET_8_0 = "dotnet-8.0" + JAVA_8_0 = "java-8.0" + JAVA_11_0 = "java-11.0" + JAVA_17_0 = "java-17.0" + JAVA_18_0 = "java-18.0" + JAVA_21_0 = "java-21.0" + JAVA_22 = "java-22" + SWIFT_5_5 = "swift-5.5" + SWIFT_5_8 = "swift-5.8" + SWIFT_5_9 = "swift-5.9" + SWIFT_5_10 = "swift-5.10" + KOTLIN_1_6 = "kotlin-1.6" + KOTLIN_1_8 = "kotlin-1.8" + KOTLIN_1_9 = "kotlin-1.9" + KOTLIN_2_0 = "kotlin-2.0" + CPP_17 = "cpp-17" + CPP_20 = "cpp-20" + BUN_1_0 = "bun-1.0" + BUN_1_1 = "bun-1.1" + GO_1_23 = "go-1.23" + STATIC_1 = "static-1" + FLUTTER_3_24 = "flutter-3.24" + FLUTTER_3_27 = "flutter-3.27" + FLUTTER_3_29 = "flutter-3.29" diff --git a/appwrite/enums/deployment_download_type.py b/appwrite/enums/deployment_download_type.py new file mode 100644 index 0000000..e26e2d5 --- /dev/null +++ b/appwrite/enums/deployment_download_type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class DeploymentDownloadType(Enum): + SOURCE = "source" + OUTPUT = "output" diff --git a/appwrite/enums/framework.py b/appwrite/enums/framework.py new file mode 100644 index 0000000..b3a9fb6 --- /dev/null +++ b/appwrite/enums/framework.py @@ -0,0 +1,17 @@ +from enum import Enum + +class Framework(Enum): + ANALOG = "analog" + ANGULAR = "angular" + NEXTJS = "nextjs" + REACT = "react" + NUXT = "nuxt" + VUE = "vue" + SVELTEKIT = "sveltekit" + ASTRO = "astro" + REMIX = "remix" + LYNX = "lynx" + FLUTTER = "flutter" + REACT_NATIVE = "react-native" + VITE = "vite" + OTHER = "other" diff --git a/appwrite/enums/image_format.py b/appwrite/enums/image_format.py index ba2f59e..33c6c99 100644 --- a/appwrite/enums/image_format.py +++ b/appwrite/enums/image_format.py @@ -3,7 +3,6 @@ class ImageFormat(Enum): JPG = "jpg" JPEG = "jpeg" - GIF = "gif" PNG = "png" WEBP = "webp" HEIC = "heic" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index 1485f48..df2cb34 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -22,6 +22,7 @@ class Runtime(Enum): PYTHON_3_11 = "python-3.11" PYTHON_3_12 = "python-3.12" PYTHON_ML_3_11 = "python-ml-3.11" + PYTHON_ML_3_12 = "python-ml-3.12" DENO_1_21 = "deno-1.21" DENO_1_24 = "deno-1.24" DENO_1_35 = "deno-1.35" @@ -32,6 +33,7 @@ class Runtime(Enum): DART_2_16 = "dart-2.16" DART_2_17 = "dart-2.17" DART_2_18 = "dart-2.18" + DART_2_19 = "dart-2.19" DART_3_0 = "dart-3.0" DART_3_1 = "dart-3.1" DART_3_3 = "dart-3.3" @@ -60,3 +62,5 @@ class Runtime(Enum): GO_1_23 = "go-1.23" STATIC_1 = "static-1" FLUTTER_3_24 = "flutter-3.24" + FLUTTER_3_27 = "flutter-3.27" + FLUTTER_3_29 = "flutter-3.29" diff --git a/appwrite/enums/vcs_deployment_type.py b/appwrite/enums/vcs_deployment_type.py new file mode 100644 index 0000000..d78e99f --- /dev/null +++ b/appwrite/enums/vcs_deployment_type.py @@ -0,0 +1,6 @@ +from enum import Enum + +class VCSDeploymentType(Enum): + BRANCH = "branch" + COMMIT = "commit" + TAG = "tag" diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 36e15d8..6ee1d4f 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -25,7 +25,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, height : float Image height. Pass an integer between 0 to 2000. Defaults to 100. quality : float - Image quality. Pass an integer between 0 to 100. Defaults to 100. + Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. Returns ------- @@ -68,7 +68,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = height : float Image height. Pass an integer between 0 to 2000. Defaults to 100. quality : float - Image quality. Pass an integer between 0 to 100. Defaults to 100. + Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. Returns ------- @@ -144,7 +144,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit height : float Image height. Pass an integer between 0 to 2000. Defaults to 100. quality : float - Image quality. Pass an integer between 0 to 100. Defaults to 100. + Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. Returns ------- diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 4561066..b798f7c 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1813,7 +1813,6 @@ def create_document(self, database_id: str, collection_id: str, document_id: str def create_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- @@ -2162,7 +2161,7 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] return self.client.call('get', api_path, { }, api_params) - def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None) -> Dict[str, Any]: + def create_index(self, database_id: str, collection_id: str, key: str, type: IndexType, attributes: List[str], orders: List[str] = None, lengths: List[float] = None) -> Dict[str, Any]: """ Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. @@ -2181,6 +2180,8 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. orders : List[str] Array of index orders. Maximum of 100 orders are allowed. + lengths : List[float] + Length of index. Maximum of 100 Returns ------- @@ -2217,6 +2218,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind api_params['type'] = type api_params['attributes'] = attributes api_params['orders'] = orders + api_params['lengths'] = lengths return self.client.call('post', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index a483a22..9dce425 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -3,6 +3,8 @@ from ..exception import AppwriteException from ..enums.runtime import Runtime; from ..input_file import InputFile +from ..enums.vcs_deployment_type import VCSDeploymentType; +from ..enums.deployment_download_type import DeploymentDownloadType; from ..enums.execution_method import ExecutionMethod; class Functions(Service): @@ -17,7 +19,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: Parameters ---------- queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId search : str Search term to filter your list results. Max length: 256 chars. @@ -41,7 +43,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - 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) -> Dict[str, Any]: + 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, specification: str = None) -> Dict[str, Any]: """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. @@ -64,7 +66,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st enabled : bool Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. logging : bool - Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. + When disabled, executions will exclude logs and errors, and will be slightly faster. entrypoint : str Entrypoint File. This path is relative to the "providerRootDirectory". commands : str @@ -81,14 +83,6 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. provider_root_directory : str Path to function code in the linked repo. - template_repository : str - Repository name of the template. - template_owner : str - The name of the owner of the template. - template_root_directory : str - Path to function code in the template repo. - template_version : str - Version (tag) for the repo linked to the function template. specification : str Runtime specification for the function and builds. @@ -132,10 +126,6 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st api_params['providerBranch'] = provider_branch api_params['providerSilentMode'] = provider_silent_mode api_params['providerRootDirectory'] = provider_root_directory - api_params['templateRepository'] = template_repository - api_params['templateOwner'] = template_owner - api_params['templateRootDirectory'] = template_root_directory - api_params['templateVersion'] = template_version api_params['specification'] = specification return self.client.call('post', api_path, { @@ -166,7 +156,6 @@ def list_runtimes(self) -> Dict[str, Any]: def list_specifications(self) -> Dict[str, Any]: """ List allowed function specifications for this instance. - Returns ------- @@ -239,7 +228,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: enabled : bool Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. logging : bool - Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project. + When disabled, executions will exclude logs and errors, and will be slightly faster. entrypoint : str Entrypoint File. This path is relative to the "providerRootDirectory". commands : str @@ -334,16 +323,54 @@ def delete(self, function_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + def update_function_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/functions/{functionId}/deployment' + api_params = {} + if function_id is None: + raise AppwriteException('Missing required parameter: "function_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{functionId}', function_id) + + api_params['deploymentId'] = deployment_id + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + def list_deployments(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ - Get a list of all the project's code deployments. You can use the query params to filter your results. + Get a list of all the function's code deployments. You can use the query params to filter your results. Parameters ---------- function_id : str Function ID. queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands, type, size + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type search : str Search term to filter your list results. Max length: 256 chars. @@ -432,9 +459,9 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e 'content-type': 'multipart/form-data', }, api_params, param_name, on_progress, upload_id) - def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + def create_duplicate_deployment(self, function_id: str, deployment_id: str, build_id: str = None) -> Dict[str, Any]: """ - Get a code deployment by its unique ID. + Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. Parameters ---------- @@ -442,6 +469,8 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] Function ID. deployment_id : str Deployment ID. + build_id : str + Build unique ID. Returns ------- @@ -454,7 +483,7 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] If API request fails """ - api_path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/duplicate' api_params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -463,22 +492,34 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] raise AppwriteException('Missing required parameter: "deployment_id"') api_path = api_path.replace('{functionId}', function_id) - api_path = api_path.replace('{deploymentId}', deployment_id) + api_params['deploymentId'] = deployment_id + api_params['buildId'] = build_id - return self.client.call('get', api_path, { + return self.client.call('post', api_path, { + 'content-type': 'application/json', }, api_params) - def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + def create_template_deployment(self, function_id: str, repository: str, owner: str, root_directory: str, version: str, activate: bool = None) -> Dict[str, Any]: """ - Update the function code deployment ID using the unique function ID. Use this endpoint to switch the code deployment that should be executed by the execution endpoint. + Create a deployment based on a template. + + Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. Parameters ---------- function_id : str Function ID. - deployment_id : str - Deployment ID. + repository : str + Repository name of the template. + owner : str + The name of the owner of the template. + root_directory : str + Path to function code in the template repo. + version : str + Version (tag) for the repo linked to the function template. + activate : bool + Automatically activate the deployment when it is finished building. Returns ------- @@ -491,32 +532,51 @@ def update_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A If API request fails """ - api_path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/template' api_params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') - if deployment_id is None: - raise AppwriteException('Missing required parameter: "deployment_id"') + if repository is None: + raise AppwriteException('Missing required parameter: "repository"') + + if owner is None: + raise AppwriteException('Missing required parameter: "owner"') + + if root_directory is None: + raise AppwriteException('Missing required parameter: "root_directory"') + + if version is None: + raise AppwriteException('Missing required parameter: "version"') api_path = api_path.replace('{functionId}', function_id) - api_path = api_path.replace('{deploymentId}', deployment_id) + api_params['repository'] = repository + api_params['owner'] = owner + api_params['rootDirectory'] = root_directory + api_params['version'] = version + api_params['activate'] = activate - return self.client.call('patch', api_path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, api_params) - def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, reference: str, activate: bool = None) -> Dict[str, Any]: """ - Delete a code deployment by its unique ID. + Create a deployment when a function is connected to VCS. + + This endpoint lets you create deployment from a branch, commit, or a tag. Parameters ---------- function_id : str Function ID. - deployment_id : str - Deployment ID. + type : VCSDeploymentType + Type of reference passed. Allowed values are: branch, commit + reference : str + VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + activate : bool + Automatically activate the deployment when it is finished building. Returns ------- @@ -529,25 +589,30 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A If API request fails """ - api_path = '/functions/{functionId}/deployments/{deploymentId}' + api_path = '/functions/{functionId}/deployments/vcs' api_params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') - if deployment_id is None: - raise AppwriteException('Missing required parameter: "deployment_id"') + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if reference is None: + raise AppwriteException('Missing required parameter: "reference"') api_path = api_path.replace('{functionId}', function_id) - api_path = api_path.replace('{deploymentId}', deployment_id) + api_params['type'] = type + api_params['reference'] = reference + api_params['activate'] = activate - return self.client.call('delete', api_path, { + return self.client.call('post', api_path, { 'content-type': 'application/json', }, api_params) - def create_build(self, function_id: str, deployment_id: str, build_id: str = None) -> Dict[str, Any]: + def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ - Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Get a function deployment by its unique ID. Parameters ---------- @@ -555,8 +620,6 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non Function ID. deployment_id : str Deployment ID. - build_id : str - Build unique ID. Returns ------- @@ -569,7 +632,7 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non If API request fails """ - api_path = '/functions/{functionId}/deployments/{deploymentId}/build' + api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -580,15 +643,13 @@ def create_build(self, function_id: str, deployment_id: str, build_id: str = Non api_path = api_path.replace('{functionId}', function_id) api_path = api_path.replace('{deploymentId}', deployment_id) - api_params['buildId'] = build_id - return self.client.call('post', api_path, { - 'content-type': 'application/json', + return self.client.call('get', api_path, { }, api_params) - def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any]: """ - Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Delete a code deployment by its unique ID. Parameters ---------- @@ -608,7 +669,7 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[ If API request fails """ - api_path = '/functions/{functionId}/deployments/{deploymentId}/build' + api_path = '/functions/{functionId}/deployments/{deploymentId}' api_params = {} if function_id is None: raise AppwriteException('Missing required parameter: "function_id"') @@ -620,13 +681,13 @@ def update_deployment_build(self, function_id: str, deployment_id: str) -> Dict[ api_path = api_path.replace('{deploymentId}', deployment_id) - return self.client.call('patch', api_path, { + return self.client.call('delete', api_path, { 'content-type': 'application/json', }, api_params) - def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes: + def get_deployment_download(self, function_id: str, deployment_id: str, type: DeploymentDownloadType = None) -> bytes: """ - Get a Deployment's contents by its unique ID. This endpoint supports range requests for partial or streaming file download. + Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. Parameters ---------- @@ -634,6 +695,8 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes Function ID. deployment_id : str Deployment ID. + type : DeploymentDownloadType + Deployment file to download. Can be: "source", "output". Returns ------- @@ -657,11 +720,50 @@ def get_deployment_download(self, function_id: str, deployment_id: str) -> bytes api_path = api_path.replace('{functionId}', function_id) api_path = api_path.replace('{deploymentId}', deployment_id) + api_params['type'] = type return self.client.call('get', api_path, { }, api_params) - def list_executions(self, function_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + + Parameters + ---------- + function_id : str + Function ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/functions/{functionId}/deployments/{deploymentId}/status' + api_params = {} + if function_id is None: + raise AppwriteException('Missing required parameter: "function_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{functionId}', function_id) + api_path = api_path.replace('{deploymentId}', deployment_id) + + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_executions(self, function_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all the current user function execution logs. You can use the query params to filter your results. @@ -671,8 +773,6 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s Function ID. queries : List[str] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - search : str - Search term to filter your list results. Max length: 256 chars. Returns ------- @@ -693,7 +793,6 @@ def list_executions(self, function_id: str, queries: List[str] = None, search: s api_path = api_path.replace('{functionId}', function_id) api_params['queries'] = queries - api_params['search'] = search return self.client.call('get', api_path, { }, api_params) @@ -788,7 +887,6 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Delete a function execution by its unique ID. - Parameters ---------- @@ -855,7 +953,7 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, Any]: + def create_variable(self, function_id: str, key: str, value: str, secret: bool = None) -> Dict[str, Any]: """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. @@ -867,6 +965,8 @@ def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, A Variable key. Max length: 255 chars. value : str Variable value. Max length: 8192 chars. + secret : bool + Secret variables can be updated or deleted, but only functions can read them during build and runtime. Returns ------- @@ -894,6 +994,7 @@ def create_variable(self, function_id: str, key: str, value: str) -> Dict[str, A api_params['key'] = key api_params['value'] = value + api_params['secret'] = secret return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -936,7 +1037,7 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None) -> Dict[str, Any]: + def update_variable(self, function_id: str, variable_id: str, key: str, value: str = None, secret: bool = None) -> Dict[str, Any]: """ Update variable by its unique ID. @@ -950,6 +1051,8 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s Variable key. Max length: 255 chars. value : str Variable value. Max length: 8192 chars. + secret : bool + Secret variables can be updated or deleted, but only functions can read them during build and runtime. Returns ------- @@ -978,6 +1081,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s api_params['key'] = key api_params['value'] = value + api_params['secret'] = secret return self.client.call('put', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py new file mode 100644 index 0000000..bcb7597 --- /dev/null +++ b/appwrite/services/sites.py @@ -0,0 +1,1079 @@ +from ..service import Service +from typing import List, Dict, Any +from ..exception import AppwriteException +from ..enums.framework import Framework; +from ..enums.build_runtime import BuildRuntime; +from ..enums.adapter import Adapter; +from ..input_file import InputFile +from ..enums.vcs_deployment_type import VCSDeploymentType; +from ..enums.deployment_download_type import DeploymentDownloadType; + +class Sites(Service): + + def __init__(self, client) -> None: + super(Sites, self).__init__(client) + + def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the project's sites. You can use the query params to filter your results. + + Parameters + ---------- + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites' + api_params = {} + + api_params['queries'] = queries + api_params['search'] = search + + return self.client.call('get', api_path, { + }, api_params) + + def create(self, site_id: str, name: str, framework: Framework, build_runtime: BuildRuntime, enabled: bool = None, logging: bool = None, timeout: float = None, install_command: str = None, build_command: str = None, output_directory: str = None, adapter: Adapter = None, installation_id: str = None, fallback_file: str = None, provider_repository_id: str = None, provider_branch: str = None, provider_silent_mode: bool = None, provider_root_directory: str = None, specification: str = None) -> Dict[str, Any]: + """ + Create a new site. + + Parameters + ---------- + site_id : str + Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Site name. Max length: 128 chars. + framework : Framework + Sites framework. + build_runtime : BuildRuntime + Runtime to use during build step. + enabled : bool + Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + logging : bool + When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + timeout : float + Maximum request time in seconds. + install_command : str + Install Command. + build_command : str + Build Command. + output_directory : str + Output Directory for site. + adapter : Adapter + Framework adapter defining rendering strategy. Allowed values are: static, ssr + installation_id : str + Appwrite Installation ID for VCS (Version Control System) deployment. + fallback_file : str + Fallback file for single page application sites. + provider_repository_id : str + Repository ID of the repo linked to the site. + provider_branch : str + Production branch for the repo linked to the site. + provider_silent_mode : bool + Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + provider_root_directory : str + Path to site code in the linked repo. + specification : str + Framework specification for the site and builds. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + if framework is None: + raise AppwriteException('Missing required parameter: "framework"') + + if build_runtime is None: + raise AppwriteException('Missing required parameter: "build_runtime"') + + + api_params['siteId'] = site_id + api_params['name'] = name + api_params['framework'] = framework + api_params['enabled'] = enabled + api_params['logging'] = logging + api_params['timeout'] = timeout + api_params['installCommand'] = install_command + api_params['buildCommand'] = build_command + api_params['outputDirectory'] = output_directory + api_params['buildRuntime'] = build_runtime + api_params['adapter'] = adapter + api_params['installationId'] = installation_id + api_params['fallbackFile'] = fallback_file + api_params['providerRepositoryId'] = provider_repository_id + api_params['providerBranch'] = provider_branch + api_params['providerSilentMode'] = provider_silent_mode + api_params['providerRootDirectory'] = provider_root_directory + api_params['specification'] = specification + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_frameworks(self) -> Dict[str, Any]: + """ + Get a list of all frameworks that are currently available on the server instance. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/frameworks' + api_params = {} + + return self.client.call('get', api_path, { + }, api_params) + + def list_specifications(self) -> Dict[str, Any]: + """ + List allowed site specifications for this instance. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/specifications' + api_params = {} + + return self.client.call('get', api_path, { + }, api_params) + + def get(self, site_id: str) -> Dict[str, Any]: + """ + Get a site by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + api_path = api_path.replace('{siteId}', site_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def update(self, site_id: str, name: str, framework: Framework, enabled: bool = None, logging: bool = None, timeout: float = None, install_command: str = None, build_command: str = None, output_directory: str = None, build_runtime: BuildRuntime = None, adapter: Adapter = None, fallback_file: 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) -> Dict[str, Any]: + """ + Update site by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + name : str + Site name. Max length: 128 chars. + framework : Framework + Sites framework. + enabled : bool + Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + logging : bool + When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + timeout : float + Maximum request time in seconds. + install_command : str + Install Command. + build_command : str + Build Command. + output_directory : str + Output Directory for site. + build_runtime : BuildRuntime + Runtime to use during build step. + adapter : Adapter + Framework adapter defining rendering strategy. Allowed values are: static, ssr + fallback_file : str + Fallback file for single page application sites. + installation_id : str + Appwrite Installation ID for VCS (Version Control System) deployment. + provider_repository_id : str + Repository ID of the repo linked to the site. + provider_branch : str + Production branch for the repo linked to the site. + provider_silent_mode : bool + Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + provider_root_directory : str + Path to site code in the linked repo. + specification : str + Framework specification for the site and builds. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + if framework is None: + raise AppwriteException('Missing required parameter: "framework"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['name'] = name + api_params['framework'] = framework + api_params['enabled'] = enabled + api_params['logging'] = logging + api_params['timeout'] = timeout + api_params['installCommand'] = install_command + api_params['buildCommand'] = build_command + api_params['outputDirectory'] = output_directory + api_params['buildRuntime'] = build_runtime + api_params['adapter'] = adapter + api_params['fallbackFile'] = fallback_file + api_params['installationId'] = installation_id + api_params['providerRepositoryId'] = provider_repository_id + api_params['providerBranch'] = provider_branch + api_params['providerSilentMode'] = provider_silent_mode + api_params['providerRootDirectory'] = provider_root_directory + api_params['specification'] = specification + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete(self, site_id: str) -> Dict[str, Any]: + """ + Delete a site by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + api_path = api_path.replace('{siteId}', site_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployment' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['deploymentId'] = deployment_id + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_deployments(self, site_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all the site's code deployments. You can use the query params to filter your results. + + Parameters + ---------- + site_id : str + Site ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['queries'] = queries + api_params['search'] = search + + return self.client.call('get', api_path, { + }, api_params) + + def create_deployment(self, site_id: str, code: InputFile, activate: bool, install_command: str = None, build_command: str = None, output_directory: str = None, on_progress = None) -> Dict[str, Any]: + """ + Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + + Parameters + ---------- + site_id : str + Site ID. + code : InputFile + Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + activate : bool + Automatically activate the deployment when it is finished building. + install_command : str + Install Commands. + build_command : str + Build Commands. + output_directory : str + Output Directory. + on_progress : callable, optional + Optional callback for upload progress + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if code is None: + raise AppwriteException('Missing required parameter: "code"') + + if activate is None: + raise AppwriteException('Missing required parameter: "activate"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['installCommand'] = install_command + api_params['buildCommand'] = build_command + api_params['outputDirectory'] = output_directory + api_params['code'] = str(code).lower() if type(code) is bool else code + api_params['activate'] = str(activate).lower() if type(activate) is bool else activate + + param_name = 'code' + + + upload_id = '' + + return self.client.chunked_upload(api_path, { + 'content-type': 'multipart/form-data', + }, api_params, param_name, on_progress, upload_id) + + def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/duplicate' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['deploymentId'] = deployment_id + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_template_deployment(self, site_id: str, repository: str, owner: str, root_directory: str, version: str, activate: bool = None) -> Dict[str, Any]: + """ + Create a deployment based on a template. + + Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + + Parameters + ---------- + site_id : str + Site ID. + repository : str + Repository name of the template. + owner : str + The name of the owner of the template. + root_directory : str + Path to site code in the template repo. + version : str + Version (tag) for the repo linked to the site template. + activate : bool + Automatically activate the deployment when it is finished building. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/template' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if repository is None: + raise AppwriteException('Missing required parameter: "repository"') + + if owner is None: + raise AppwriteException('Missing required parameter: "owner"') + + if root_directory is None: + raise AppwriteException('Missing required parameter: "root_directory"') + + if version is None: + raise AppwriteException('Missing required parameter: "version"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['repository'] = repository + api_params['owner'] = owner + api_params['rootDirectory'] = root_directory + api_params['version'] = version + api_params['activate'] = activate + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference: str, activate: bool = None) -> Dict[str, Any]: + """ + Create a deployment when a site is connected to VCS. + + This endpoint lets you create deployment from a branch, commit, or a tag. + + Parameters + ---------- + site_id : str + Site ID. + type : VCSDeploymentType + Type of reference passed. Allowed values are: branch, commit + reference : str + VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + activate : bool + Automatically activate the deployment when it is finished building. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/vcs' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if reference is None: + raise AppwriteException('Missing required parameter: "reference"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['type'] = type + api_params['reference'] = reference + api_params['activate'] = activate + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Get a site deployment by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/{deploymentId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{deploymentId}', deployment_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def delete_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Delete a site deployment by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/{deploymentId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{deploymentId}', deployment_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_deployment_download(self, site_id: str, deployment_id: str, type: DeploymentDownloadType = None) -> bytes: + """ + Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + type : DeploymentDownloadType + Deployment file to download. Can be: "source", "output". + + Returns + ------- + bytes + Response as bytes + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/{deploymentId}/download' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{deploymentId}', deployment_id) + + api_params['type'] = type + + return self.client.call('get', api_path, { + }, api_params) + + def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str, Any]: + """ + Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + + Parameters + ---------- + site_id : str + Site ID. + deployment_id : str + Deployment ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/deployments/{deploymentId}/status' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if deployment_id is None: + raise AppwriteException('Missing required parameter: "deployment_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{deploymentId}', deployment_id) + + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_logs(self, site_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a list of all site logs. You can use the query params to filter your results. + + Parameters + ---------- + site_id : str + Site ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/logs' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def get_log(self, site_id: str, log_id: str) -> Dict[str, Any]: + """ + Get a site request log by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + log_id : str + Log ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/logs/{logId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if log_id is None: + raise AppwriteException('Missing required parameter: "log_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{logId}', log_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def delete_log(self, site_id: str, log_id: str) -> Dict[str, Any]: + """ + Delete a site log by its unique ID. + + Parameters + ---------- + site_id : str + Site ID. + log_id : str + Log ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/logs/{logId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if log_id is None: + raise AppwriteException('Missing required parameter: "log_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{logId}', log_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_variables(self, site_id: str) -> Dict[str, Any]: + """ + Get a list of all variables of a specific site. + + Parameters + ---------- + site_id : str + Site unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/variables' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + api_path = api_path.replace('{siteId}', site_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def create_variable(self, site_id: str, key: str, value: str, secret: bool = None) -> Dict[str, Any]: + """ + Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + + Parameters + ---------- + site_id : str + Site unique ID. + key : str + Variable key. Max length: 255 chars. + value : str + Variable value. Max length: 8192 chars. + secret : bool + Secret variables can be updated or deleted, but only sites can read them during build and runtime. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/variables' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if value is None: + raise AppwriteException('Missing required parameter: "value"') + + api_path = api_path.replace('{siteId}', site_id) + + api_params['key'] = key + api_params['value'] = value + api_params['secret'] = secret + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: + """ + Get a variable by its unique ID. + + Parameters + ---------- + site_id : str + Site unique ID. + variable_id : str + Variable unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/variables/{variableId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{variableId}', variable_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def update_variable(self, site_id: str, variable_id: str, key: str, value: str = None, secret: bool = None) -> Dict[str, Any]: + """ + Update variable by its unique ID. + + Parameters + ---------- + site_id : str + Site unique ID. + variable_id : str + Variable unique ID. + key : str + Variable key. Max length: 255 chars. + value : str + Variable value. Max length: 8192 chars. + secret : bool + Secret variables can be updated or deleted, but only sites can read them during build and runtime. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/variables/{variableId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{variableId}', variable_id) + + api_params['key'] = key + api_params['value'] = value + api_params['secret'] = secret + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: + """ + Delete a variable by its unique ID. + + Parameters + ---------- + site_id : str + Site unique ID. + variable_id : str + Variable unique ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/sites/{siteId}/variables/{variableId}' + api_params = {} + if site_id is None: + raise AppwriteException('Missing required parameter: "site_id"') + + if variable_id is None: + raise AppwriteException('Missing required parameter: "variable_id"') + + api_path = api_path.replace('{siteId}', site_id) + api_path = api_path.replace('{variableId}', variable_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 610e11e..22198eb 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -447,7 +447,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def get_file_download(self, bucket_id: str, file_id: str) -> bytes: + def get_file_download(self, bucket_id: str, file_id: str, token: str = None) -> bytes: """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. @@ -457,6 +457,8 @@ def get_file_download(self, bucket_id: str, file_id: str) -> bytes: Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). file_id : str File ID. + token : str + File token for accessing this file. Returns ------- @@ -480,11 +482,12 @@ def get_file_download(self, bucket_id: str, file_id: str) -> bytes: api_path = api_path.replace('{bucketId}', bucket_id) api_path = api_path.replace('{fileId}', file_id) + api_params['token'] = token return self.client.call('get', api_path, { }, 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) -> bytes: + 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, token: str = None) -> bytes: """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. @@ -501,7 +504,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he gravity : ImageGravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right quality : float - Preview image quality. Pass an integer between 0 to 100. Defaults to 100. + Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. border_width : float Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. border_color : str @@ -516,6 +519,8 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. output : ImageFormat Output format type (jpeg, jpg, png, gif and webp). + token : str + File token for accessing this file. Returns ------- @@ -550,11 +555,12 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he api_params['rotation'] = rotation api_params['background'] = background api_params['output'] = output + api_params['token'] = token return self.client.call('get', api_path, { }, api_params) - def get_file_view(self, bucket_id: str, file_id: str) -> bytes: + def get_file_view(self, bucket_id: str, file_id: str, token: str = None) -> bytes: """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. @@ -564,6 +570,8 @@ def get_file_view(self, bucket_id: str, file_id: str) -> bytes: Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). file_id : str File ID. + token : str + File token for accessing this file. Returns ------- @@ -587,6 +595,7 @@ def get_file_view(self, bucket_id: str, file_id: str) -> bytes: api_path = api_path.replace('{bucketId}', bucket_id) api_path = api_path.replace('{fileId}', file_id) + api_params['token'] = token return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 778cd07..808dc2a 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -189,7 +189,7 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str team_id : str Team ID. queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles search : str Search term to filter your list results. Max length: 256 chars. diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py new file mode 100644 index 0000000..01f1177 --- /dev/null +++ b/appwrite/services/tokens.py @@ -0,0 +1,187 @@ +from ..service import Service +from typing import List, Dict, Any +from ..exception import AppwriteException + +class Tokens(Service): + + def __init__(self, client) -> None: + super(Tokens, self).__init__(client) + + def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File unique ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tokens/buckets/{bucketId}/files/{fileId}' + api_params = {} + if bucket_id is None: + raise AppwriteException('Missing required parameter: "bucket_id"') + + if file_id is None: + raise AppwriteException('Missing required parameter: "file_id"') + + api_path = api_path.replace('{bucketId}', bucket_id) + api_path = api_path.replace('{fileId}', file_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> Dict[str, Any]: + """ + Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. + + Parameters + ---------- + bucket_id : str + Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + file_id : str + File unique ID. + expire : str + Token expiry date + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tokens/buckets/{bucketId}/files/{fileId}' + api_params = {} + if bucket_id is None: + raise AppwriteException('Missing required parameter: "bucket_id"') + + if file_id is None: + raise AppwriteException('Missing required parameter: "file_id"') + + api_path = api_path.replace('{bucketId}', bucket_id) + api_path = api_path.replace('{fileId}', file_id) + + api_params['expire'] = expire + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get(self, token_id: str) -> Dict[str, Any]: + """ + Get a token by its unique ID. + + Parameters + ---------- + token_id : str + Token ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tokens/{tokenId}' + api_params = {} + if token_id is None: + raise AppwriteException('Missing required parameter: "token_id"') + + api_path = api_path.replace('{tokenId}', token_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def update(self, token_id: str, expire: str = None) -> Dict[str, Any]: + """ + Update a token by its unique ID. Use this endpoint to update a token's expiry date. + + Parameters + ---------- + token_id : str + Token unique ID. + expire : str + File token expiry date + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tokens/{tokenId}' + api_params = {} + if token_id is None: + raise AppwriteException('Missing required parameter: "token_id"') + + api_path = api_path.replace('{tokenId}', token_id) + + api_params['expire'] = expire + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete(self, token_id: str) -> Dict[str, Any]: + """ + Delete a token by its unique ID. + + Parameters + ---------- + token_id : str + Token ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tokens/{tokenId}' + api_params = {} + if token_id is None: + raise AppwriteException('Missing required parameter: "token_id"') + + api_path = api_path.replace('{tokenId}', token_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 532c69f..703a6bf 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -741,7 +741,7 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def list_memberships(self, user_id: str) -> Dict[str, Any]: + def list_memberships(self, user_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get the user membership list by its unique ID. @@ -749,6 +749,10 @@ def list_memberships(self, user_id: str) -> Dict[str, Any]: ---------- user_id : str User ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles + search : str + Search term to filter your list results. Max length: 256 chars. Returns ------- @@ -768,6 +772,8 @@ def list_memberships(self, user_id: str) -> Dict[str, Any]: api_path = api_path.replace('{userId}', user_id) + api_params['queries'] = queries + api_params['search'] = search return self.client.call('get', api_path, { }, api_params) diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index c7ae77f..ff11b8b 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -13,5 +13,5 @@ result = avatars.get_browser( code = Browser.AVANT_BROWSER, width = 0, # optional height = 0, # optional - quality = 0 # optional + quality = -1 # optional ) diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 160636d..286f4d3 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -13,5 +13,5 @@ result = avatars.get_credit_card( code = CreditCard.AMERICAN_EXPRESS, width = 0, # optional height = 0, # optional - quality = 0 # optional + quality = -1 # optional ) diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 844dbb6..6365a78 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -13,5 +13,5 @@ result = avatars.get_flag( code = Flag.AFGHANISTAN, width = 0, # optional height = 0, # optional - quality = 0 # optional + quality = -1 # optional ) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1eaf024..1a8500b 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,8 +3,9 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token databases = Databases(client) diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 1178a0f..7c6ef24 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -3,8 +3,7 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key databases = Databases(client) diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index fe78b5e..f7bb455 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -15,5 +15,6 @@ result = databases.create_index( key = '', type = IndexType.KEY, attributes = [], - orders = [] # optional + orders = [], # optional + lengths = [] # optional ) diff --git a/docs/examples/functions/create-build.md b/docs/examples/functions/create-duplicate-deployment.md similarity index 90% rename from docs/examples/functions/create-build.md rename to docs/examples/functions/create-duplicate-deployment.md index 3d784b0..79315e4 100644 --- a/docs/examples/functions/create-build.md +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -8,7 +8,7 @@ client.set_key('<YOUR_API_KEY>') # Your secret API key functions = Functions(client) -result = functions.create_build( +result = functions.create_duplicate_deployment( function_id = '<FUNCTION_ID>', deployment_id = '<DEPLOYMENT_ID>', build_id = '<BUILD_ID>' # optional diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md new file mode 100644 index 0000000..6083cc1 --- /dev/null +++ b/docs/examples/functions/create-template-deployment.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_template_deployment( + function_id = '<FUNCTION_ID>', + repository = '<REPOSITORY>', + owner = '<OWNER>', + root_directory = '<ROOT_DIRECTORY>', + version = '<VERSION>', + activate = False # optional +) diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 84c286f..2089830 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -11,5 +11,6 @@ functions = Functions(client) result = functions.create_variable( function_id = '<FUNCTION_ID>', key = '<KEY>', - value = '<VALUE>' + value = '<VALUE>', + secret = False # optional ) diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000..4004bae --- /dev/null +++ b/docs/examples/functions/create-vcs-deployment.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions +from appwrite.enums import VCSDeploymentType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_vcs_deployment( + function_id = '<FUNCTION_ID>', + type = VCSDeploymentType.BRANCH, + reference = '<REFERENCE>', + activate = False # optional +) diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 68d6e99..8758e27 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -27,9 +27,5 @@ result = functions.create( provider_branch = '<PROVIDER_BRANCH>', # optional provider_silent_mode = False, # optional provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional - template_repository = '<TEMPLATE_REPOSITORY>', # optional - template_owner = '<TEMPLATE_OWNER>', # optional - template_root_directory = '<TEMPLATE_ROOT_DIRECTORY>', # optional - template_version = '<TEMPLATE_VERSION>', # optional specification = '' # optional ) diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index 8cc16fa..1b0673c 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -10,5 +10,6 @@ functions = Functions(client) result = functions.get_deployment_download( function_id = '<FUNCTION_ID>', - deployment_id = '<DEPLOYMENT_ID>' + deployment_id = '<DEPLOYMENT_ID>', + type = DeploymentDownloadType.SOURCE # optional ) diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index e83f727..300fc0e 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -10,6 +10,5 @@ functions = Functions(client) result = functions.list_executions( function_id = '<FUNCTION_ID>', - queries = [], # optional - search = '<SEARCH>' # optional + queries = [] # optional ) diff --git a/docs/examples/functions/update-deployment-build.md b/docs/examples/functions/update-deployment-status.md similarity index 90% rename from docs/examples/functions/update-deployment-build.md rename to docs/examples/functions/update-deployment-status.md index ef2b8a6..6c6a8bf 100644 --- a/docs/examples/functions/update-deployment-build.md +++ b/docs/examples/functions/update-deployment-status.md @@ -8,7 +8,7 @@ client.set_key('<YOUR_API_KEY>') # Your secret API key functions = Functions(client) -result = functions.update_deployment_build( +result = functions.update_deployment_status( function_id = '<FUNCTION_ID>', deployment_id = '<DEPLOYMENT_ID>' ) diff --git a/docs/examples/functions/update-deployment.md b/docs/examples/functions/update-function-deployment.md similarity index 89% rename from docs/examples/functions/update-deployment.md rename to docs/examples/functions/update-function-deployment.md index 6b96434..da14309 100644 --- a/docs/examples/functions/update-deployment.md +++ b/docs/examples/functions/update-function-deployment.md @@ -8,7 +8,7 @@ client.set_key('<YOUR_API_KEY>') # Your secret API key functions = Functions(client) -result = functions.update_deployment( +result = functions.update_function_deployment( function_id = '<FUNCTION_ID>', deployment_id = '<DEPLOYMENT_ID>' ) diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index e333ec1..f8bcc03 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -12,5 +12,6 @@ result = functions.update_variable( function_id = '<FUNCTION_ID>', variable_id = '<VARIABLE_ID>', key = '<KEY>', - value = '<VALUE>' # optional + value = '<VALUE>', # optional + secret = False # optional ) diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md new file mode 100644 index 0000000..de6472c --- /dev/null +++ b/docs/examples/sites/create-deployment.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.input_file import InputFile + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_deployment( + site_id = '<SITE_ID>', + code = InputFile.from_path('file.png'), + activate = False, + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>' # optional +) diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000..d79ab9d --- /dev/null +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_duplicate_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md new file mode 100644 index 0000000..ac05f9e --- /dev/null +++ b/docs/examples/sites/create-template-deployment.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_template_deployment( + site_id = '<SITE_ID>', + repository = '<REPOSITORY>', + owner = '<OWNER>', + root_directory = '<ROOT_DIRECTORY>', + version = '<VERSION>', + activate = False # optional +) diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md new file mode 100644 index 0000000..739beff --- /dev/null +++ b/docs/examples/sites/create-variable.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_variable( + site_id = '<SITE_ID>', + key = '<KEY>', + value = '<VALUE>', + secret = False # optional +) diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000..089e6c8 --- /dev/null +++ b/docs/examples/sites/create-vcs-deployment.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import VCSDeploymentType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_vcs_deployment( + site_id = '<SITE_ID>', + type = VCSDeploymentType.BRANCH, + reference = '<REFERENCE>', + activate = False # optional +) diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md new file mode 100644 index 0000000..4950cd2 --- /dev/null +++ b/docs/examples/sites/create.md @@ -0,0 +1,32 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create( + site_id = '<SITE_ID>', + name = '<NAME>', + framework = .ANALOG, + build_runtime = .NODE_14_5, + enabled = False, # optional + logging = False, # optional + timeout = 1, # optional + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>', # optional + adapter = .STATIC, # optional + installation_id = '<INSTALLATION_ID>', # optional + fallback_file = '<FALLBACK_FILE>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md new file mode 100644 index 0000000..029730a --- /dev/null +++ b/docs/examples/sites/delete-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md new file mode 100644 index 0000000..0b516e6 --- /dev/null +++ b/docs/examples/sites/delete-log.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_log( + site_id = '<SITE_ID>', + log_id = '<LOG_ID>' +) diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md new file mode 100644 index 0000000..c078813 --- /dev/null +++ b/docs/examples/sites/delete-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md new file mode 100644 index 0000000..60670e6 --- /dev/null +++ b/docs/examples/sites/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md new file mode 100644 index 0000000..d6af564 --- /dev/null +++ b/docs/examples/sites/get-deployment-download.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_deployment_download( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>', + type = DeploymentDownloadType.SOURCE # optional +) diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md new file mode 100644 index 0000000..c4ee1de --- /dev/null +++ b/docs/examples/sites/get-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md new file mode 100644 index 0000000..ae5d8ac --- /dev/null +++ b/docs/examples/sites/get-log.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_log( + site_id = '<SITE_ID>', + log_id = '<LOG_ID>' +) diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md new file mode 100644 index 0000000..7f5f0f6 --- /dev/null +++ b/docs/examples/sites/get-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md new file mode 100644 index 0000000..f9532a0 --- /dev/null +++ b/docs/examples/sites/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md new file mode 100644 index 0000000..15ec24d --- /dev/null +++ b/docs/examples/sites/list-deployments.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_deployments( + site_id = '<SITE_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md new file mode 100644 index 0000000..6e37646 --- /dev/null +++ b/docs/examples/sites/list-frameworks.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_frameworks() diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md new file mode 100644 index 0000000..d3a9a19 --- /dev/null +++ b/docs/examples/sites/list-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_logs( + site_id = '<SITE_ID>', + queries = [] # optional +) diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md new file mode 100644 index 0000000..93b713c --- /dev/null +++ b/docs/examples/sites/list-specifications.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_specifications() diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md new file mode 100644 index 0000000..5ff78e6 --- /dev/null +++ b/docs/examples/sites/list-variables.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_variables( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md new file mode 100644 index 0000000..1b344e1 --- /dev/null +++ b/docs/examples/sites/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md new file mode 100644 index 0000000..492ee4f --- /dev/null +++ b/docs/examples/sites/update-deployment-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_deployment_status( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md new file mode 100644 index 0000000..69014bb --- /dev/null +++ b/docs/examples/sites/update-site-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_site_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md new file mode 100644 index 0000000..973f7f2 --- /dev/null +++ b/docs/examples/sites/update-variable.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>', + key = '<KEY>', + value = '<VALUE>', # optional + secret = False # optional +) diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md new file mode 100644 index 0000000..7d2d286 --- /dev/null +++ b/docs/examples/sites/update.md @@ -0,0 +1,31 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update( + site_id = '<SITE_ID>', + name = '<NAME>', + framework = .ANALOG, + enabled = False, # optional + logging = False, # optional + timeout = 1, # optional + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>', # optional + build_runtime = .NODE_14_5, # optional + adapter = .STATIC, # optional + fallback_file = '<FALLBACK_FILE>', # optional + installation_id = '<INSTALLATION_ID>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index d21db63..411abf8 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -10,5 +10,6 @@ storage = Storage(client) result = storage.get_file_download( bucket_id = '<BUCKET_ID>', - file_id = '<FILE_ID>' + file_id = '<FILE_ID>', + token = '<TOKEN>' # optional ) diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 20939b2..47e3f23 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -14,12 +14,13 @@ result = storage.get_file_preview( width = 0, # optional height = 0, # optional gravity = ImageGravity.CENTER, # optional - quality = 0, # optional + quality = -1, # optional border_width = 0, # optional border_color = '', # optional border_radius = 0, # optional opacity = 0, # optional rotation = -360, # optional background = '', # optional - output = ImageFormat.JPG # optional + output = ImageFormat.JPG, # optional + token = '<TOKEN>' # optional ) diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index bf70d13..85cbad7 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -10,5 +10,6 @@ storage = Storage(client) result = storage.get_file_view( bucket_id = '<BUCKET_ID>', - file_id = '<FILE_ID>' + file_id = '<FILE_ID>', + token = '<TOKEN>' # optional ) diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md new file mode 100644 index 0000000..f835a0e --- /dev/null +++ b/docs/examples/tokens/create-file-token.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.create_file_token( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + expire = '' # optional +) diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md new file mode 100644 index 0000000..4761932 --- /dev/null +++ b/docs/examples/tokens/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.delete( + token_id = '<TOKEN_ID>' +) diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md new file mode 100644 index 0000000..0d6abb8 --- /dev/null +++ b/docs/examples/tokens/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.get( + token_id = '<TOKEN_ID>' +) diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md new file mode 100644 index 0000000..2694650 --- /dev/null +++ b/docs/examples/tokens/list.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.list( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + queries = [] # optional +) diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md new file mode 100644 index 0000000..18b0444 --- /dev/null +++ b/docs/examples/tokens/update.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.update( + token_id = '<TOKEN_ID>', + expire = '' # optional +) diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 9e3b005..c0d2f2a 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -9,5 +9,7 @@ client.set_key('<YOUR_API_KEY>') # Your secret API key users = Users(client) result = users.list_memberships( - user_id = '<USER_ID>' + user_id = '<USER_ID>', + queries = [], # optional + search = '<SEARCH>' # optional ) diff --git a/setup.py b/setup.py index 7c9c69d..ee37257 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '10.1.0-rc.1', + version = '10.2.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/10.1.0-rc.1.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/10.2.0.tar.gz', install_requires=[ 'requests', ], From 580d8c2f8e10cd454c0c98e0dcebb59ca8c7e798 Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Sun, 18 May 2025 07:37:01 +0000 Subject: [PATCH 18/24] chore: bump to next major versions --- appwrite/client.py | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index bda3b80..b7ab483 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/10.2.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/11.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '10.2.0', + 'x-sdk-version': '11.0.0', 'X-Appwrite-Response-Format' : '1.7.0', } diff --git a/setup.py b/setup.py index ee37257..5c6270f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '10.2.0', + version = '11.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/10.2.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/11.0.0.tar.gz', install_requires=[ 'requests', ], From fdc15888c96f3b0dbe804cb5a7260e0c2093afe3 Mon Sep 17 00:00:00 2001 From: Jake Barnby <jakeb994@gmail.com> Date: Fri, 18 Jul 2025 12:50:24 +1200 Subject: [PATCH 19/24] Add inc/dec --- README.md | 2 +- appwrite/client.py | 4 +- appwrite/enums/build_runtime.py | 2 + appwrite/enums/image_format.py | 1 + appwrite/enums/runtime.py | 2 + appwrite/services/databases.py | 181 +++++++++++++++++- appwrite/services/tokens.py | 2 +- appwrite/services/users.py | 2 +- docs/examples/databases/create-document.md | 1 + .../databases/decrement-document-attribute.md | 18 ++ .../databases/increment-document-attribute.md | 18 ++ docs/examples/databases/upsert-document.md | 17 ++ docs/examples/databases/upsert-documents.md | 2 +- setup.py | 4 +- 14 files changed, 246 insertions(+), 10 deletions(-) create mode 100644 docs/examples/databases/decrement-document-attribute.md create mode 100644 docs/examples/databases/increment-document-attribute.md create mode 100644 docs/examples/databases/upsert-document.md diff --git a/README.md b/README.md index 2efa745..a68a5ae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite/client.py b/appwrite/client.py index b7ab483..ed4d4b5 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/11.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/11.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '11.0.0', + 'x-sdk-version': '11.1.0', 'X-Appwrite-Response-Format' : '1.7.0', } diff --git a/appwrite/enums/build_runtime.py b/appwrite/enums/build_runtime.py index 9ba151b..aded697 100644 --- a/appwrite/enums/build_runtime.py +++ b/appwrite/enums/build_runtime.py @@ -38,6 +38,7 @@ class BuildRuntime(Enum): DART_3_1 = "dart-3.1" DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" + DART_3_8 = "dart-3.8" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -64,3 +65,4 @@ class BuildRuntime(Enum): FLUTTER_3_24 = "flutter-3.24" FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" + FLUTTER_3_32 = "flutter-3.32" diff --git a/appwrite/enums/image_format.py b/appwrite/enums/image_format.py index 33c6c99..332f646 100644 --- a/appwrite/enums/image_format.py +++ b/appwrite/enums/image_format.py @@ -7,3 +7,4 @@ class ImageFormat(Enum): WEBP = "webp" HEIC = "heic" AVIF = "avif" + GIF = "gif" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index df2cb34..b0e307a 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -38,6 +38,7 @@ class Runtime(Enum): DART_3_1 = "dart-3.1" DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" + DART_3_8 = "dart-3.8" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -64,3 +65,4 @@ class Runtime(Enum): FLUTTER_3_24 = "flutter-3.24" FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" + FLUTTER_3_32 = "flutter-3.32" diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index b798f7c..b7e1843 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1812,6 +1812,8 @@ def create_document(self, database_id: str, collection_id: str, document_id: str def create_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. Parameters @@ -1854,10 +1856,11 @@ def create_documents(self, database_id: str, collection_id: str, documents: List 'content-type': 'application/json', }, api_params) - def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict] = None) -> Dict[str, Any]: + def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ - Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. Parameters ---------- @@ -1887,6 +1890,9 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List if collection_id is None: raise AppwriteException('Missing required parameter: "collection_id"') + if documents is None: + raise AppwriteException('Missing required parameter: "documents"') + api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) @@ -1898,6 +1904,8 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List def update_documents(self, database_id: str, collection_id: str, data: dict = None, queries: List[str] = None) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. Parameters @@ -1942,6 +1950,8 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No def delete_documents(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Bulk delete documents using queries, if no queries are passed then all documents are deleted. Parameters @@ -2027,6 +2037,61 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q return self.client.call('get', api_path, { }, api_params) + def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: + """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + + Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + data : dict + Document data as JSON object. Include all required attributes of the document to be created or updated. + permissions : List[str] + An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if data is None: + raise AppwriteException('Missing required parameter: "data"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + + api_params['data'] = data + api_params['permissions'] = permissions + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. @@ -2121,6 +2186,118 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) + def decrement_document_attribute(self, database_id: str, collection_id: str, document_id: str, attribute: str, value: float = None, min: float = None) -> Dict[str, Any]: + """ + Decrement a specific attribute of a document by a given value. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + attribute : str + Attribute key. + value : float + Value to decrement the attribute by. The value must be a number. + min : float + Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if attribute is None: + raise AppwriteException('Missing required parameter: "attribute"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + api_path = api_path.replace('{attribute}', attribute) + + api_params['value'] = value + api_params['min'] = min + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def increment_document_attribute(self, database_id: str, collection_id: str, document_id: str, attribute: str, value: float = None, max: float = None) -> Dict[str, Any]: + """ + Increment a specific attribute of a document by a given value. + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + attribute : str + Attribute key. + value : float + Value to increment the attribute by. The value must be a number. + max : float + Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if attribute is None: + raise AppwriteException('Missing required parameter: "attribute"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + api_path = api_path.replace('{attribute}', attribute) + + api_params['value'] = value + api_params['max'] = max + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ List indexes in the collection. diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 01f1177..7ec7f4f 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -49,7 +49,7 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> Dict[str, Any]: """ - Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. + Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. Parameters ---------- diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 703a6bf..694657f 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -1345,7 +1345,7 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any user_id : str User ID. queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType Returns ------- diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1a8500b..3d6cba1 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,6 +3,7 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_admin('') # client.set_session('') # The user session to authenticate with client.set_key('<YOUR_API_KEY>') # Your secret API key client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..397bdd4 --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.decrement_document_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + attribute = '', + value = None, # optional + min = None # optional +) diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..d5700e0 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.increment_document_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + attribute = '', + value = None, # optional + max = None # optional +) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md new file mode 100644 index 0000000..c491ea4 --- /dev/null +++ b/docs/examples/databases/upsert-document.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.upsert_document( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + data = {}, + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 9972064..5136d5f 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -11,5 +11,5 @@ databases = Databases(client) result = databases.upsert_documents( database_id = '<DATABASE_ID>', collection_id = '<COLLECTION_ID>', - documents = [] # optional + documents = [] ) diff --git a/setup.py b/setup.py index 5c6270f..18c78cc 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '11.0.0', + version = '11.1.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/11.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/11.1.0.tar.gz', install_requires=[ 'requests', ], From f3b858e0e5430c1df8b512ceb0c6f6671550a44f Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Tue, 22 Jul 2025 16:16:48 +0000 Subject: [PATCH 20/24] chore: regenerate --- README.md | 4 +- appwrite/client.py | 6 +- appwrite/services/account.py | 35 + appwrite/services/avatars.py | 7 + appwrite/services/databases.py | 257 +- appwrite/services/functions.py | 24 + appwrite/services/graphql.py | 2 + appwrite/services/health.py | 14 + appwrite/services/messaging.py | 46 + appwrite/services/sites.py | 23 + appwrite/services/storage.py | 13 + appwrite/services/tables.py | 2331 +++++++++++++++++ appwrite/services/teams.py | 13 + appwrite/services/tokens.py | 5 + appwrite/services/users.py | 42 + docs/examples/databases/create-document.md | 1 - docs/examples/databases/create-documents.md | 1 + docs/examples/databases/upsert-document.md | 7 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 18 + .../examples/tables/create-datetime-column.md | 18 + docs/examples/tables/create-email-column.md | 18 + docs/examples/tables/create-enum-column.md | 19 + docs/examples/tables/create-float-column.md | 20 + docs/examples/tables/create-index.md | 20 + docs/examples/tables/create-integer-column.md | 20 + docs/examples/tables/create-ip-column.md | 18 + .../tables/create-relationship-column.md | 21 + docs/examples/tables/create-row.md | 18 + docs/examples/tables/create-rows.md | 15 + docs/examples/tables/create-string-column.md | 20 + docs/examples/tables/create-url-column.md | 18 + docs/examples/tables/create.md | 18 + docs/examples/tables/decrement-row-column.md | 18 + docs/examples/tables/delete-column.md | 15 + docs/examples/tables/delete-index.md | 15 + docs/examples/tables/delete-row.md | 15 + docs/examples/tables/delete-rows.md | 15 + docs/examples/tables/delete.md | 14 + docs/examples/tables/get-column.md | 15 + docs/examples/tables/get-index.md | 15 + docs/examples/tables/get-row.md | 16 + docs/examples/tables/get.md | 14 + docs/examples/tables/increment-row-column.md | 18 + docs/examples/tables/list-columns.md | 15 + docs/examples/tables/list-indexes.md | 15 + docs/examples/tables/list-rows.md | 15 + docs/examples/tables/list.md | 15 + docs/examples/tables/update-boolean-column.md | 18 + .../examples/tables/update-datetime-column.md | 18 + docs/examples/tables/update-email-column.md | 18 + docs/examples/tables/update-enum-column.md | 19 + docs/examples/tables/update-float-column.md | 20 + docs/examples/tables/update-integer-column.md | 20 + docs/examples/tables/update-ip-column.md | 18 + .../tables/update-relationship-column.md | 17 + docs/examples/tables/update-row.md | 17 + docs/examples/tables/update-rows.md | 16 + docs/examples/tables/update-string-column.md | 19 + docs/examples/tables/update-url-column.md | 18 + docs/examples/tables/update.md | 18 + docs/examples/tables/upsert-row.md | 16 + docs/examples/tables/upsert-rows.md | 14 + setup.py | 4 +- 64 files changed, 3515 insertions(+), 82 deletions(-) create mode 100644 appwrite/services/tables.py create mode 100644 docs/examples/tables/create-boolean-column.md create mode 100644 docs/examples/tables/create-datetime-column.md create mode 100644 docs/examples/tables/create-email-column.md create mode 100644 docs/examples/tables/create-enum-column.md create mode 100644 docs/examples/tables/create-float-column.md create mode 100644 docs/examples/tables/create-index.md create mode 100644 docs/examples/tables/create-integer-column.md create mode 100644 docs/examples/tables/create-ip-column.md create mode 100644 docs/examples/tables/create-relationship-column.md create mode 100644 docs/examples/tables/create-row.md create mode 100644 docs/examples/tables/create-rows.md create mode 100644 docs/examples/tables/create-string-column.md create mode 100644 docs/examples/tables/create-url-column.md create mode 100644 docs/examples/tables/create.md create mode 100644 docs/examples/tables/decrement-row-column.md create mode 100644 docs/examples/tables/delete-column.md create mode 100644 docs/examples/tables/delete-index.md create mode 100644 docs/examples/tables/delete-row.md create mode 100644 docs/examples/tables/delete-rows.md create mode 100644 docs/examples/tables/delete.md create mode 100644 docs/examples/tables/get-column.md create mode 100644 docs/examples/tables/get-index.md create mode 100644 docs/examples/tables/get-row.md create mode 100644 docs/examples/tables/get.md create mode 100644 docs/examples/tables/increment-row-column.md create mode 100644 docs/examples/tables/list-columns.md create mode 100644 docs/examples/tables/list-indexes.md create mode 100644 docs/examples/tables/list-rows.md create mode 100644 docs/examples/tables/list.md create mode 100644 docs/examples/tables/update-boolean-column.md create mode 100644 docs/examples/tables/update-datetime-column.md create mode 100644 docs/examples/tables/update-email-column.md create mode 100644 docs/examples/tables/update-enum-column.md create mode 100644 docs/examples/tables/update-float-column.md create mode 100644 docs/examples/tables/update-integer-column.md create mode 100644 docs/examples/tables/update-ip-column.md create mode 100644 docs/examples/tables/update-relationship-column.md create mode 100644 docs/examples/tables/update-row.md create mode 100644 docs/examples/tables/update-rows.md create mode 100644 docs/examples/tables/update-string-column.md create mode 100644 docs/examples/tables/update-url-column.md create mode 100644 docs/examples/tables/update.md create mode 100644 docs/examples/tables/upsert-row.md create mode 100644 docs/examples/tables/upsert-rows.md diff --git a/README.md b/README.md index a68a5ae..a2dea19 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** +**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite/client.py b/appwrite/client.py index ed4d4b5..93897d8 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,12 +14,12 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/11.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/12.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '11.1.0', - 'X-Appwrite-Response-Format' : '1.7.0', + 'x-sdk-version': '12.0.0', + 'X-Appwrite-Response-Format' : '1.8.0', } def set_self_signed(self, status=True): diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 9dd3c5e..8b67abe 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -35,6 +35,7 @@ def create(self, user_id: str, email: str, password: str, name: str = None) -> D """ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + Parameters ---------- user_id : str @@ -84,6 +85,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + Parameters ---------- email : str @@ -122,6 +124,7 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. + Parameters ---------- queries : List[str] @@ -150,6 +153,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -204,6 +208,7 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. + Parameters ---------- queries : List[str] @@ -232,6 +237,7 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on an account. + Parameters ---------- mfa : bool @@ -264,6 +270,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -296,6 +303,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st """ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -334,6 +342,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. + Parameters ---------- type : AuthenticatorType @@ -366,6 +375,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: """ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + Parameters ---------- factor : AuthenticationFactor @@ -398,6 +408,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: """ Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Parameters ---------- challenge_id : str @@ -522,6 +533,7 @@ def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. + Parameters ---------- name : str @@ -554,6 +566,7 @@ def update_password(self, password: str, old_password: str = None) -> Dict[str, """ Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + Parameters ---------- password : str @@ -589,6 +602,7 @@ def update_phone(self, phone: str, password: str) -> Dict[str, Any]: """ Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + Parameters ---------- phone : str @@ -648,6 +662,7 @@ def update_prefs(self, prefs: dict) -> Dict[str, Any]: """ Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- prefs : dict @@ -680,6 +695,7 @@ def create_recovery(self, email: str, url: str) -> Dict[str, Any]: """ Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + Parameters ---------- email : str @@ -720,6 +736,7 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- user_id : str @@ -831,6 +848,7 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- email : str @@ -869,6 +887,9 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + .. deprecated:: + This API has been deprecated. + Parameters ---------- user_id : str @@ -907,6 +928,9 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + .. deprecated:: + This API has been deprecated. + Parameters ---------- user_id : str @@ -945,6 +969,7 @@ def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -983,6 +1008,7 @@ def get_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + Parameters ---------- session_id : str @@ -1014,6 +1040,7 @@ def update_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + Parameters ---------- session_id : str @@ -1046,6 +1073,7 @@ def delete_session(self, session_id: str) -> Dict[str, Any]: """ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + Parameters ---------- session_id : str @@ -1102,6 +1130,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> D A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1146,6 +1175,7 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1194,6 +1224,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- provider : OAuthProvider @@ -1236,6 +1267,7 @@ def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1277,6 +1309,7 @@ def create_verification(self, url: str) -> Dict[str, Any]: Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- url : str @@ -1309,6 +1342,7 @@ def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str @@ -1369,6 +1403,7 @@ def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any] """ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 6ee1d4f..2bd32f7 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -16,6 +16,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Browser @@ -59,6 +60,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : CreditCard @@ -101,6 +103,7 @@ def get_favicon(self, url: str) -> bytes: This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -135,6 +138,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Flag @@ -179,6 +183,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -221,6 +226,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- name : str @@ -259,6 +265,7 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + Parameters ---------- text : str diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index b7e1843..20ddd16 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Create a new Database. + Parameters ---------- database_id : str @@ -87,6 +89,7 @@ def get(self, database_id: str) -> Dict[str, Any]: """ Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + Parameters ---------- database_id : str @@ -118,6 +121,7 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Update a database by its unique ID. + Parameters ---------- database_id : str @@ -159,6 +163,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: """ Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + Parameters ---------- database_id : str @@ -191,6 +196,9 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.list` instead. + Parameters ---------- database_id : str @@ -228,6 +236,9 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create` instead. + Parameters ---------- database_id : str @@ -281,6 +292,9 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.get` instead. + Parameters ---------- database_id : str @@ -318,6 +332,9 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per """ Update a collection by its unique ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update` instead. + Parameters ---------- database_id : str @@ -371,6 +388,9 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.delete` instead. + Parameters ---------- database_id : str @@ -409,12 +429,15 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st """ List attributes in the collection. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.list_columns` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. queries : List[str] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error @@ -450,12 +473,15 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st Create a boolean attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_boolean_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -506,12 +532,15 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Update a boolean attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_boolean_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). key : str Attribute Key. required : bool @@ -562,12 +591,15 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Create a date time attribute according to the ISO 8601 standard. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_datetime_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). key : str Attribute Key. required : bool @@ -618,12 +650,15 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Update a date time attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_datetime_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool @@ -675,12 +710,15 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, Create an email attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_email_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool @@ -732,12 +770,15 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, Update an email attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_email_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool @@ -745,7 +786,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -786,19 +827,22 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: """ - Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_enum_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. elements : List[str] - Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + Array of enum values. required : bool Is attribute required? default : str @@ -852,22 +896,25 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, Update an enum attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_enum_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. elements : List[str] - Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. + Updated list of enum values. required : bool Is attribute required? default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -915,22 +962,25 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, Create a float attribute. Optionally, minimum and maximum values can be provided. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_float_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? min : float - Minimum value to enforce on new documents + Minimum value. max : float - Maximum value to enforce on new documents + Maximum value. default : float - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when required. array : bool Is attribute an array? @@ -978,24 +1028,27 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, Update a float attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_float_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? default : float - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when required. min : float - Minimum value to enforce on new documents + Minimum value. max : float - Maximum value to enforce on new documents + Maximum value. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1041,22 +1094,25 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st Create an integer attribute. Optionally, minimum and maximum values can be provided. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_integer_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? min : float - Minimum value to enforce on new documents + Minimum value max : float - Maximum value to enforce on new documents + Maximum value default : float - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when attribute is required. array : bool Is attribute an array? @@ -1104,24 +1160,27 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st Update an integer attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_integer_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? default : float - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when attribute is required. min : float - Minimum value to enforce on new documents + Minimum value max : float - Maximum value to enforce on new documents + Maximum value new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1167,18 +1226,21 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re Create IP address attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_ip_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? default : str - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when attribute is required. array : bool Is attribute an array? @@ -1224,20 +1286,23 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re Update an ip attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_ip_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool Is attribute required? default : str - Default value for attribute when not provided. Cannot be set when attribute is required. + Default value. Cannot be set when attribute is required. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1281,14 +1346,17 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_relationship_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. related_collection_id : str - Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Related Collection ID. type : RelationshipType Relation type two_way : bool @@ -1344,12 +1412,15 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str Create a string attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_string_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. size : float @@ -1410,12 +1481,15 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str Update a string attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_string_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -1425,7 +1499,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str size : float Maximum size of the string attribute. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1470,12 +1544,15 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r Create a URL attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_url_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool @@ -1527,12 +1604,15 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r Update an url attribute. Changing the `default` value will not update already existing documents. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_url_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. required : bool @@ -1540,7 +1620,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1583,12 +1663,15 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ """ Get attribute by ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.get_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. @@ -1626,12 +1709,15 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Di """ Deletes an attribute. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.delete_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. @@ -1671,18 +1757,21 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_relationship_column` instead. + Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. key : str Attribute Key. on_delete : RelationMutate Constraints option new_key : str - New attribute key. + New Attribute Key. Returns ------- @@ -1721,6 +1810,9 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.list_rows` instead. + Parameters ---------- database_id : str @@ -1761,6 +1853,9 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_row` instead. + Parameters ---------- database_id : str @@ -1816,6 +1911,9 @@ def create_documents(self, database_id: str, collection_id: str, documents: List Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_row` instead. + Parameters ---------- database_id : str @@ -1856,11 +1954,15 @@ def create_documents(self, database_id: str, collection_id: str, documents: List 'content-type': 'application/json', }, api_params) - def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: + def upsert_documents(self, database_id: str, collection_id: str) -> Dict[str, Any]: """ **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.upsert_rows` instead. Parameters ---------- @@ -1868,8 +1970,6 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List Database ID. collection_id : str Collection ID. - documents : List[dict] - Array of document data as JSON objects. May contain partial documents. Returns ------- @@ -1890,13 +1990,9 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List if collection_id is None: raise AppwriteException('Missing required parameter: "collection_id"') - if documents is None: - raise AppwriteException('Missing required parameter: "documents"') - api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) - api_params['documents'] = documents return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -1908,6 +2004,9 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_rows` instead. + Parameters ---------- database_id : str @@ -1954,6 +2053,9 @@ def delete_documents(self, database_id: str, collection_id: str, queries: List[s Bulk delete documents using queries, if no queries are passed then all documents are deleted. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.delete_rows` instead. + Parameters ---------- database_id : str @@ -1995,6 +2097,9 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.get_row` instead. + Parameters ---------- database_id : str @@ -2037,12 +2142,15 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q return self.client.call('get', api_path, { }, api_params) - def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: + def upsert_document(self, database_id: str, collection_id: str, document_id: str) -> Dict[str, Any]: """ **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.upsert_row` instead. + Parameters ---------- database_id : str @@ -2051,10 +2159,6 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str Collection ID. document_id : str Document ID. - data : dict - Document data as JSON object. Include all required attributes of the document to be created or updated. - permissions : List[str] - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). Returns ------- @@ -2078,15 +2182,10 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str if document_id is None: raise AppwriteException('Missing required parameter: "document_id"') - if data is None: - raise AppwriteException('Missing required parameter: "data"') - api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{documentId}', document_id) - api_params['data'] = data - api_params['permissions'] = permissions return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2096,6 +2195,9 @@ def update_document(self, database_id: str, collection_id: str, document_id: str """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.update_row` instead. + Parameters ---------- database_id : str @@ -2146,6 +2248,9 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str """ Delete a document by its unique ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.delete_row` instead. + Parameters ---------- database_id : str @@ -2190,6 +2295,9 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc """ Decrement a specific attribute of a document by a given value. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.decrement_row_column` instead. + Parameters ---------- database_id : str @@ -2201,7 +2309,7 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc attribute : str Attribute key. value : float - Value to decrement the attribute by. The value must be a number. + Value to increment the attribute by. The value must be a number. min : float Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. @@ -2246,6 +2354,9 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc """ Increment a specific attribute of a document by a given value. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.increment_row_column` instead. + Parameters ---------- database_id : str @@ -2302,6 +2413,9 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] """ List indexes in the collection. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.list_indexes` instead. + Parameters ---------- database_id : str @@ -2343,6 +2457,9 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.create_index` instead. + Parameters ---------- database_id : str @@ -2405,6 +2522,9 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, """ Get index by ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.get_index` instead. + Parameters ---------- database_id : str @@ -2448,6 +2568,9 @@ def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[s """ Delete an index. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tables.delete_index` instead. + Parameters ---------- database_id : str diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 9dce425..3dd2459 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -16,6 +16,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -47,6 +48,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + Parameters ---------- function_id : str @@ -178,6 +180,7 @@ def get(self, function_id: str) -> Dict[str, Any]: """ Get a function by its unique ID. + Parameters ---------- function_id : str @@ -209,6 +212,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: """ Update function by its unique ID. + Parameters ---------- function_id : str @@ -295,6 +299,7 @@ def delete(self, function_id: str) -> Dict[str, Any]: """ Delete a function by its unique ID. + Parameters ---------- function_id : str @@ -327,6 +332,7 @@ def update_function_deployment(self, function_id: str, deployment_id: str) -> Di """ Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + Parameters ---------- function_id : str @@ -365,6 +371,7 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: """ Get a list of all the function's code deployments. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -406,6 +413,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e Use the "command" param to set the entrypoint used to execute your code. + Parameters ---------- function_id : str @@ -463,6 +471,7 @@ def create_duplicate_deployment(self, function_id: str, deployment_id: str, buil """ Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- function_id : str @@ -506,6 +515,7 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + Parameters ---------- function_id : str @@ -567,6 +577,7 @@ def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, refer This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- function_id : str @@ -614,6 +625,7 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] """ Get a function deployment by its unique ID. + Parameters ---------- function_id : str @@ -651,6 +663,7 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A """ Delete a code deployment by its unique ID. + Parameters ---------- function_id : str @@ -689,6 +702,7 @@ def get_deployment_download(self, function_id: str, deployment_id: str, type: De """ Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- function_id : str @@ -729,6 +743,7 @@ def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict """ Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- function_id : str @@ -767,6 +782,7 @@ def list_executions(self, function_id: str, queries: List[str] = None) -> Dict[s """ Get a list of all the current user function execution logs. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -801,6 +817,7 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No """ Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + Parameters ---------- function_id : str @@ -851,6 +868,7 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Get a function execution log by its unique ID. + Parameters ---------- function_id : str @@ -888,6 +906,7 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any """ Delete a function execution by its unique ID. + Parameters ---------- function_id : str @@ -926,6 +945,7 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific function. + Parameters ---------- function_id : str @@ -957,6 +977,7 @@ def create_variable(self, function_id: str, key: str, value: str, secret: bool = """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + Parameters ---------- function_id : str @@ -1004,6 +1025,7 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- function_id : str @@ -1041,6 +1063,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s """ Update variable by its unique ID. + Parameters ---------- function_id : str @@ -1091,6 +1114,7 @@ def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- function_id : str diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 22ca3aa..69ad4e0 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -11,6 +11,7 @@ def query(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict @@ -44,6 +45,7 @@ def mutation(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict diff --git a/appwrite/services/health.py b/appwrite/services/health.py index dd1d183..665fd1e 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -75,6 +75,7 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: """ Get the SSL certificate for a domain + Parameters ---------- domain : str @@ -145,6 +146,7 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -173,6 +175,7 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -201,6 +204,7 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict """ Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- name : str @@ -232,6 +236,7 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -261,6 +266,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] Returns the amount of failed jobs in a given queue. + Parameters ---------- name : Name @@ -295,6 +301,7 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -323,6 +330,7 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -351,6 +359,7 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -379,6 +388,7 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -407,6 +417,7 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -435,6 +446,7 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + Parameters ---------- threshold : float @@ -463,6 +475,7 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -491,6 +504,7 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 639a820..153a1f7 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -13,6 +13,7 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s """ Get a list of all messages from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -44,6 +45,7 @@ def create_email(self, message_id: str, subject: str, content: str, topics: List """ Create a new email message. + Parameters ---------- message_id : str @@ -116,6 +118,7 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -181,6 +184,7 @@ def create_push(self, message_id: str, title: str = None, body: str = None, topi """ Create a new push notification. + Parameters ---------- message_id : str @@ -268,6 +272,7 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -354,6 +359,7 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us """ Create a new SMS message. + Parameters ---------- message_id : str @@ -408,6 +414,7 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -459,6 +466,7 @@ def get_message(self, message_id: str) -> Dict[str, Any]: Get a message by its unique ID. + Parameters ---------- message_id : str @@ -490,6 +498,7 @@ def delete(self, message_id: str) -> Dict[str, Any]: """ Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + Parameters ---------- message_id : str @@ -522,6 +531,7 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ """ Get the message activity logs listed by its unique ID. + Parameters ---------- message_id : str @@ -556,6 +566,7 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, """ Get a list of the targets associated with a message. + Parameters ---------- message_id : str @@ -590,6 +601,7 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ """ Get a list of all providers from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -621,6 +633,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None """ Create a new Apple Push Notification service provider. + Parameters ---------- provider_id : str @@ -677,6 +690,7 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Apple Push Notification service provider by its unique ID. + Parameters ---------- provider_id : str @@ -730,6 +744,7 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: """ Create a new Firebase Cloud Messaging provider. + Parameters ---------- provider_id : str @@ -774,6 +789,7 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Firebase Cloud Messaging provider by its unique ID. + Parameters ---------- provider_id : str @@ -815,6 +831,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No """ Create a new Mailgun provider. + Parameters ---------- provider_id : str @@ -877,6 +894,7 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s """ Update a Mailgun provider by its unique ID. + Parameters ---------- provider_id : str @@ -936,6 +954,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = """ Create a new MSG91 provider. + Parameters ---------- provider_id : str @@ -986,6 +1005,7 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo """ Update a MSG91 provider by its unique ID. + Parameters ---------- provider_id : str @@ -1033,6 +1053,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N """ Create a new Sendgrid provider. + Parameters ---------- provider_id : str @@ -1089,6 +1110,7 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: """ Update a Sendgrid provider by its unique ID. + Parameters ---------- provider_id : str @@ -1142,6 +1164,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo """ Create a new SMTP provider. + Parameters ---------- provider_id : str @@ -1219,6 +1242,7 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N """ Update a SMTP provider by its unique ID. + Parameters ---------- provider_id : str @@ -1290,6 +1314,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non """ Create a new Telesign provider. + Parameters ---------- provider_id : str @@ -1340,6 +1365,7 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: """ Update a Telesign provider by its unique ID. + Parameters ---------- provider_id : str @@ -1387,6 +1413,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No """ Create a new Textmagic provider. + Parameters ---------- provider_id : str @@ -1437,6 +1464,7 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: """ Update a Textmagic provider by its unique ID. + Parameters ---------- provider_id : str @@ -1484,6 +1512,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Twilio provider. + Parameters ---------- provider_id : str @@ -1534,6 +1563,7 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Twilio provider by its unique ID. + Parameters ---------- provider_id : str @@ -1581,6 +1611,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Vonage provider. + Parameters ---------- provider_id : str @@ -1631,6 +1662,7 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Vonage provider by its unique ID. + Parameters ---------- provider_id : str @@ -1679,6 +1711,7 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: Get a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1710,6 +1743,7 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1742,6 +1776,7 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic """ Get the provider activity logs listed by its unique ID. + Parameters ---------- provider_id : str @@ -1776,6 +1811,7 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> """ Get the subscriber activity logs listed by its unique ID. + Parameters ---------- subscriber_id : str @@ -1810,6 +1846,7 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str """ Get a list of all topics from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -1841,6 +1878,7 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> """ Create a new topic. + Parameters ---------- topic_id : str @@ -1883,6 +1921,7 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: Get a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1915,6 +1954,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N Update a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1953,6 +1993,7 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1985,6 +2026,7 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, """ Get the topic activity logs listed by its unique ID. + Parameters ---------- topic_id : str @@ -2019,6 +2061,7 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str """ Get a list of all subscribers from the current Appwrite project. + Parameters ---------- topic_id : str @@ -2056,6 +2099,7 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) - """ Create a new subscriber. + Parameters ---------- topic_id : str @@ -2101,6 +2145,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: Get a subscriber by its unique ID. + Parameters ---------- topic_id : str @@ -2138,6 +2183,7 @@ def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any] """ Delete a subscriber by its unique ID. + Parameters ---------- topic_id : str diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index bcb7597..857cabe 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -17,6 +17,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's sites. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -48,6 +49,7 @@ def create(self, site_id: str, name: str, framework: Framework, build_runtime: B """ Create a new site. + Parameters ---------- site_id : str @@ -182,6 +184,7 @@ def get(self, site_id: str) -> Dict[str, Any]: """ Get a site by its unique ID. + Parameters ---------- site_id : str @@ -213,6 +216,7 @@ def update(self, site_id: str, name: str, framework: Framework, enabled: bool = """ Update site by its unique ID. + Parameters ---------- site_id : str @@ -302,6 +306,7 @@ def delete(self, site_id: str) -> Dict[str, Any]: """ Delete a site by its unique ID. + Parameters ---------- site_id : str @@ -334,6 +339,7 @@ def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, """ Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + Parameters ---------- site_id : str @@ -372,6 +378,7 @@ def list_deployments(self, site_id: str, queries: List[str] = None, search: str """ Get a list of all the site's code deployments. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -409,6 +416,7 @@ def create_deployment(self, site_id: str, code: InputFile, activate: bool, insta """ Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + Parameters ---------- site_id : str @@ -469,6 +477,7 @@ def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[ """ Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- site_id : str @@ -509,6 +518,7 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + Parameters ---------- site_id : str @@ -570,6 +580,7 @@ def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- site_id : str @@ -617,6 +628,7 @@ def get_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -654,6 +666,7 @@ def delete_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Delete a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -692,6 +705,7 @@ def get_deployment_download(self, site_id: str, deployment_id: str, type: Deploy """ Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- site_id : str @@ -732,6 +746,7 @@ def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str """ Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- site_id : str @@ -770,6 +785,7 @@ def list_logs(self, site_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all site logs. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -804,6 +820,7 @@ def get_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Get a site request log by its unique ID. + Parameters ---------- site_id : str @@ -841,6 +858,7 @@ def delete_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Delete a site log by its unique ID. + Parameters ---------- site_id : str @@ -879,6 +897,7 @@ def list_variables(self, site_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific site. + Parameters ---------- site_id : str @@ -910,6 +929,7 @@ def create_variable(self, site_id: str, key: str, value: str, secret: bool = Non """ Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + Parameters ---------- site_id : str @@ -957,6 +977,7 @@ def get_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- site_id : str @@ -994,6 +1015,7 @@ def update_variable(self, site_id: str, variable_id: str, key: str, value: str = """ Update variable by its unique ID. + Parameters ---------- site_id : str @@ -1044,6 +1066,7 @@ def delete_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- site_id : str diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 22198eb..e970187 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -15,6 +15,7 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st """ Get a list of all the storage buckets. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Create a new storage bucket. + Parameters ---------- bucket_id : str @@ -108,6 +110,7 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + Parameters ---------- bucket_id : str @@ -139,6 +142,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Update a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -201,6 +205,7 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Delete a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -233,6 +238,7 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No """ Get a list of all the user files. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -277,6 +283,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + Parameters ---------- bucket_id : str @@ -332,6 +339,7 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + Parameters ---------- bucket_id : str @@ -369,6 +377,7 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission """ Update a file by its unique ID. Only users with write permissions have access to update this resource. + Parameters ---------- bucket_id : str @@ -413,6 +422,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- bucket_id : str @@ -451,6 +461,7 @@ def get_file_download(self, bucket_id: str, file_id: str, token: str = None) -> """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- bucket_id : str @@ -491,6 +502,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + Parameters ---------- bucket_id : str @@ -564,6 +576,7 @@ def get_file_view(self, bucket_id: str, file_id: str, token: str = None) -> byte """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + Parameters ---------- bucket_id : str diff --git a/appwrite/services/tables.py b/appwrite/services/tables.py new file mode 100644 index 0000000..f54cd5b --- /dev/null +++ b/appwrite/services/tables.py @@ -0,0 +1,2331 @@ +from ..service import Service +from typing import List, Dict, Any +from ..exception import AppwriteException +from ..enums.relationship_type import RelationshipType; +from ..enums.relation_mutate import RelationMutate; +from ..enums.index_type import IndexType; + +class Tables(Service): + + def __init__(self, client) -> None: + super(Tables, self).__init__(client) + + def list(self, database_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: + """ + Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + + + Parameters + ---------- + database_id : str + Database ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity + search : str + Search term to filter your list results. Max length: 256 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + api_path = api_path.replace('{databaseId}', database_id) + + api_params['queries'] = queries + api_params['search'] = search + + return self.client.call('get', api_path, { + }, api_params) + + def create(self, database_id: str, table_id: str, name: str, permissions: List[str] = None, row_security: bool = None, enabled: bool = None) -> Dict[str, Any]: + """ + Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Table name. Max length: 128 chars. + permissions : List[str] + An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + row_security : bool + Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + api_path = api_path.replace('{databaseId}', database_id) + + api_params['tableId'] = table_id + api_params['name'] = name + api_params['permissions'] = permissions + api_params['rowSecurity'] = row_security + api_params['enabled'] = enabled + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get(self, database_id: str, table_id: str) -> Dict[str, Any]: + """ + Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def update(self, database_id: str, table_id: str, name: str, permissions: List[str] = None, row_security: bool = None, enabled: bool = None) -> Dict[str, Any]: + """ + Update a table by its unique ID. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + name : str + Table name. Max length: 128 chars. + permissions : List[str] + An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + row_security : bool + Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + enabled : bool + Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['name'] = name + api_params['permissions'] = permissions + api_params['rowSecurity'] = row_security + api_params['enabled'] = enabled + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete(self, database_id: str, table_id: str) -> Dict[str, Any]: + """ + Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_columns(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List attributes in the collection. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_boolean_column(self, database_id: str, table_id: str, key: str, required: bool, default: bool = None, array: bool = None) -> Dict[str, Any]: + """ + Create a boolean column. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Column Key. + required : bool + Is column required? + default : bool + Default value for column when not provided. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/boolean' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_boolean_column(self, database_id: str, table_id: str, key: str, required: bool, default: bool, new_key: str = None) -> Dict[str, Any]: + """ + Update a boolean column. Changing the `default` value will not update already existing rows. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Column Key. + required : bool + Is column required? + default : bool + Default value for column when not provided. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/boolean/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_datetime_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create a date time column according to the ISO 8601 standard. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/datetime' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_datetime_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update a date time column. Changing the `default` value will not update already existing rows. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/datetime/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_email_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create an email column. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/email' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_email_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an email column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/email/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_enum_column(self, database_id: str, table_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + elements : List[str] + Array of enum values. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/enum' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if elements is None: + raise AppwriteException('Missing required parameter: "elements"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['elements'] = elements + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_enum_column(self, database_id: str, table_id: str, key: str, elements: List[str], required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an enum column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + elements : List[str] + Updated list of enum values. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/enum/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if elements is None: + raise AppwriteException('Missing required parameter: "elements"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['elements'] = elements + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_float_column(self, database_id: str, table_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None) -> Dict[str, Any]: + """ + Create a float column. Optionally, minimum and maximum values can be provided. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + min : float + Minimum value + max : float + Maximum value + default : float + Default value. Cannot be set when required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/float' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_float_column(self, database_id: str, table_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None) -> Dict[str, Any]: + """ + Update a float column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : float + Default value. Cannot be set when required. + min : float + Minimum value + max : float + Maximum value + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/float/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_integer_column(self, database_id: str, table_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None) -> Dict[str, Any]: + """ + Create an integer column. Optionally, minimum and maximum values can be provided. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + min : float + Minimum value + max : float + Maximum value + default : float + Default value. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/integer' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_integer_column(self, database_id: str, table_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None) -> Dict[str, Any]: + """ + Update an integer column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : float + Default value. Cannot be set when column is required. + min : float + Minimum value + max : float + Maximum value + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/integer/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['min'] = min + api_params['max'] = max + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_ip_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create IP address column. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/ip' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_ip_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an ip column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/ip/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_relationship_column(self, database_id: str, table_id: str, related_table_id: str, type: RelationshipType, two_way: bool = None, key: str = None, two_way_key: str = None, on_delete: RelationMutate = None) -> Dict[str, Any]: + """ + Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + related_table_id : str + Related Table ID. + type : RelationshipType + Relation type + two_way : bool + Is Two Way? + key : str + Column Key. + two_way_key : str + Two Way Column Key. + on_delete : RelationMutate + Constraints option + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/relationship' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if related_table_id is None: + raise AppwriteException('Missing required parameter: "related_table_id"') + + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['relatedTableId'] = related_table_id + api_params['type'] = type + api_params['twoWay'] = two_way + api_params['key'] = key + api_params['twoWayKey'] = two_way_key + api_params['onDelete'] = on_delete + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_string_column(self, database_id: str, table_id: str, key: str, size: float, required: bool, default: str = None, array: bool = None, encrypt: bool = None) -> Dict[str, Any]: + """ + Create a string column. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Column Key. + size : float + Attribute size for text attributes, in number of characters. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + array : bool + Is column an array? + encrypt : bool + Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/string' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if size is None: + raise AppwriteException('Missing required parameter: "size"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['size'] = size + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + api_params['encrypt'] = encrypt + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_string_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, size: float = None, new_key: str = None) -> Dict[str, Any]: + """ + Update a string column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + size : float + Maximum size of the string column. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/string/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['size'] = size + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_url_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: + """ + Create a URL column. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + array : bool + Is column an array? + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/url' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['required'] = required + api_params['default'] = default + api_params['array'] = array + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_url_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: + """ + Update an url column. Changing the `default` value will not update already existing rows. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + required : bool + Is column required? + default : str + Default value for column when not provided. Cannot be set when column is required. + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/url/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if required is None: + raise AppwriteException('Missing required parameter: "required"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['required'] = required + api_params['default'] = default + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_column(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: + """ + Get column by ID. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + + return self.client.call('get', api_path, { + }, api_params) + + def delete_column(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: + """ + Deletes a column. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_relationship_column(self, database_id: str, table_id: str, key: str, on_delete: RelationMutate = None, new_key: str = None) -> Dict[str, Any]: + """ + Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + key : str + Column Key. + on_delete : RelationMutate + Constraints option + new_key : str + New Column Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + api_params['onDelete'] = on_delete + api_params['newKey'] = new_key + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_indexes(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + List indexes in the collection. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/indexes' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_index(self, database_id: str, table_id: str, key: str, type: IndexType, columns: List[str], orders: List[str] = None, lengths: List[float] = None) -> Dict[str, Any]: + """ + Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + Attributes can be `key`, `fulltext`, and `unique`. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Index Key. + type : IndexType + Index type. + columns : List[str] + Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + orders : List[str] + Array of index orders. Maximum of 100 orders are allowed. + lengths : List[float] + Length of index. Maximum of 100 + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/indexes' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if columns is None: + raise AppwriteException('Missing required parameter: "columns"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['key'] = key + api_params['type'] = type + api_params['columns'] = columns + api_params['orders'] = orders + api_params['lengths'] = lengths + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_index(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: + """ + Get index by ID. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Index Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/indexes/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + + return self.client.call('get', api_path, { + }, api_params) + + def delete_index(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: + """ + Delete an index. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + key : str + Index Key. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/indexes/{key}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if key is None: + raise AppwriteException('Missing required parameter: "key"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{key}', key) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_rows(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a list of all the user's rows in a given table. You can use the query params to filter your results. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_row(self, database_id: str, table_id: str, row_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: + """ + Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + row_id : str + Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + data : dict + Row data as JSON object. + permissions : List[str] + An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + if data is None: + raise AppwriteException('Missing required parameter: "data"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['rowId'] = row_id + api_params['data'] = data + api_params['permissions'] = permissions + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_rows(self, database_id: str, table_id: str, rows: List[dict]) -> Dict[str, Any]: + """ + Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. + rows : List[dict] + Array of documents data as JSON objects. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if rows is None: + raise AppwriteException('Missing required parameter: "rows"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['rows'] = rows + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def upsert_rows(self, database_id: str, table_id: str) -> Dict[str, Any]: + """ + Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_rows(self, database_id: str, table_id: str, data: dict = None, queries: List[str] = None) -> Dict[str, Any]: + """ + Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + data : dict + Row data as JSON object. Include only column and value pairs to be updated. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['data'] = data + api_params['queries'] = queries + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_rows(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Bulk delete rows using queries, if no queries are passed then all rows are deleted. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + + api_params['queries'] = queries + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_row(self, database_id: str, table_id: str, row_id: str, queries: List[str] = None) -> Dict[str, Any]: + """ + Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + row_id : str + Row ID. + queries : List[str] + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def upsert_row(self, database_id: str, table_id: str, row_id: str) -> Dict[str, Any]: + """ + Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + row_id : str + Row ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def update_row(self, database_id: str, table_id: str, row_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: + """ + Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + row_id : str + Row ID. + data : dict + Row data as JSON object. Include only columns and value pairs to be updated. + permissions : List[str] + An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + + api_params['data'] = data + api_params['permissions'] = permissions + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_row(self, database_id: str, table_id: str, row_id: str) -> Dict[str, Any]: + """ + Delete a row by its unique ID. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). + row_id : str + Row ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def decrement_row_column(self, database_id: str, table_id: str, row_id: str, column: str, value: float = None, min: float = None) -> Dict[str, Any]: + """ + Decrement a specific column of a row by a given value. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + row_id : str + Row ID. + column : str + Column key. + value : float + Value to increment the column by. The value must be a number. + min : float + Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + if column is None: + raise AppwriteException('Missing required parameter: "column"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + api_path = api_path.replace('{column}', column) + + api_params['value'] = value + api_params['min'] = min + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def increment_row_column(self, database_id: str, table_id: str, row_id: str, column: str, value: float = None, max: float = None) -> Dict[str, Any]: + """ + Increment a specific column of a row by a given value. + + + Parameters + ---------- + database_id : str + Database ID. + table_id : str + Table ID. + row_id : str + Row ID. + column : str + Column key. + value : float + Value to increment the column by. The value must be a number. + max : float + Maximum value for the column. If the current value is greater than this value, an error will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if table_id is None: + raise AppwriteException('Missing required parameter: "table_id"') + + if row_id is None: + raise AppwriteException('Missing required parameter: "row_id"') + + if column is None: + raise AppwriteException('Missing required parameter: "column"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{tableId}', table_id) + api_path = api_path.replace('{rowId}', row_id) + api_path = api_path.replace('{column}', column) + + api_params['value'] = value + api_params['max'] = max + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 808dc2a..50e0297 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -11,6 +11,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + Parameters ---------- queries : List[str] @@ -42,6 +43,7 @@ def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, """ Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + Parameters ---------- team_id : str @@ -83,6 +85,7 @@ def get(self, team_id: str) -> Dict[str, Any]: """ Get a team by its ID. All team members have read access for this resource. + Parameters ---------- team_id : str @@ -114,6 +117,7 @@ def update_name(self, team_id: str, name: str) -> Dict[str, Any]: """ Update the team's name by its unique ID. + Parameters ---------- team_id : str @@ -152,6 +156,7 @@ def delete(self, team_id: str) -> Dict[str, Any]: """ Delete a team using its ID. Only team members with the owner role can delete the team. + Parameters ---------- team_id : str @@ -184,6 +189,7 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -228,6 +234,7 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + Parameters ---------- team_id : str @@ -281,6 +288,7 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -319,6 +327,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + Parameters ---------- team_id : str @@ -363,6 +372,7 @@ def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + Parameters ---------- team_id : str @@ -404,6 +414,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st If the request is successful, a session for the user is automatically created. + Parameters ---------- team_id : str @@ -454,6 +465,7 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: """ Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + Parameters ---------- team_id : str @@ -485,6 +497,7 @@ def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: """ Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + Parameters ---------- team_id : str diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 7ec7f4f..93ba739 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -11,6 +11,7 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ """ List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -51,6 +52,7 @@ def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> """ Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + Parameters ---------- bucket_id : str @@ -92,6 +94,7 @@ def get(self, token_id: str) -> Dict[str, Any]: """ Get a token by its unique ID. + Parameters ---------- token_id : str @@ -123,6 +126,7 @@ def update(self, token_id: str, expire: str = None) -> Dict[str, Any]: """ Update a token by its unique ID. Use this endpoint to update a token's expiry date. + Parameters ---------- token_id : str @@ -158,6 +162,7 @@ def delete(self, token_id: str) -> Dict[str, Any]: """ Delete a token by its unique ID. + Parameters ---------- token_id : str diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 694657f..1af4e41 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -45,6 +46,7 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s """ Create a new user. + Parameters ---------- user_id : str @@ -89,6 +91,7 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -136,6 +139,7 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -183,6 +187,7 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict """ Get identities for all users. + Parameters ---------- queries : List[str] @@ -214,6 +219,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -246,6 +252,7 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N """ Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -293,6 +300,7 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -340,6 +348,7 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s """ Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -417,6 +426,7 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p """ Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -482,6 +492,7 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers """ Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -532,6 +543,7 @@ def get(self, user_id: str) -> Dict[str, Any]: """ Get a user by its unique ID. + Parameters ---------- user_id : str @@ -563,6 +575,7 @@ def delete(self, user_id: str) -> Dict[str, Any]: """ Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + Parameters ---------- user_id : str @@ -595,6 +608,7 @@ def update_email(self, user_id: str, email: str) -> Dict[str, Any]: """ Update the user email by its unique ID. + Parameters ---------- user_id : str @@ -633,6 +647,7 @@ def create_jwt(self, user_id: str, session_id: str = None, duration: float = Non """ Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + Parameters ---------- user_id : str @@ -673,6 +688,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + Parameters ---------- user_id : str @@ -711,6 +727,7 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. + Parameters ---------- user_id : str @@ -745,6 +762,7 @@ def list_memberships(self, user_id: str, queries: List[str] = None, search: str """ Get the user membership list by its unique ID. + Parameters ---------- user_id : str @@ -782,6 +800,7 @@ def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. + Parameters ---------- user_id : str @@ -820,6 +839,7 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic """ Delete an authenticator app. + Parameters ---------- user_id : str @@ -858,6 +878,7 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. + Parameters ---------- user_id : str @@ -889,6 +910,7 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -920,6 +942,7 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -952,6 +975,7 @@ def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + Parameters ---------- user_id : str @@ -984,6 +1008,7 @@ def update_name(self, user_id: str, name: str) -> Dict[str, Any]: """ Update the user name by its unique ID. + Parameters ---------- user_id : str @@ -1022,6 +1047,7 @@ def update_password(self, user_id: str, password: str) -> Dict[str, Any]: """ Update the user password by its unique ID. + Parameters ---------- user_id : str @@ -1060,6 +1086,7 @@ def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: """ Update the user phone by its unique ID. + Parameters ---------- user_id : str @@ -1098,6 +1125,7 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: """ Get the user preferences by its unique ID. + Parameters ---------- user_id : str @@ -1129,6 +1157,7 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: """ Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- user_id : str @@ -1167,6 +1196,7 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. + Parameters ---------- user_id : str @@ -1200,6 +1230,7 @@ def create_session(self, user_id: str) -> Dict[str, Any]: If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + Parameters ---------- user_id : str @@ -1232,6 +1263,7 @@ def delete_sessions(self, user_id: str) -> Dict[str, Any]: """ Delete all user's sessions by using the user's unique ID. + Parameters ---------- user_id : str @@ -1264,6 +1296,7 @@ def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: """ Delete a user sessions by its unique ID. + Parameters ---------- user_id : str @@ -1302,6 +1335,7 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: """ Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + Parameters ---------- user_id : str @@ -1340,6 +1374,7 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any """ List the messaging targets that are associated with a user. + Parameters ---------- user_id : str @@ -1374,6 +1409,7 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr """ Create a messaging target. + Parameters ---------- user_id : str @@ -1430,6 +1466,7 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Get a user's push notification target by ID. + Parameters ---------- user_id : str @@ -1467,6 +1504,7 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr """ Update a messaging target. + Parameters ---------- user_id : str @@ -1514,6 +1552,7 @@ def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. + Parameters ---------- user_id : str @@ -1553,6 +1592,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + Parameters ---------- user_id : str @@ -1591,6 +1631,7 @@ def update_email_verification(self, user_id: str, email_verification: bool) -> D """ Update the user email verification status by its unique ID. + Parameters ---------- user_id : str @@ -1629,6 +1670,7 @@ def update_phone_verification(self, user_id: str, phone_verification: bool) -> D """ Update the user phone verification status by its unique ID. + Parameters ---------- user_id : str diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 3d6cba1..1a8500b 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,7 +3,6 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_admin('') # client.set_session('') # The user session to authenticate with client.set_key('<YOUR_API_KEY>') # Your secret API key client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 7c6ef24..27ad6e8 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -3,6 +3,7 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_admin('') # client.set_key('<YOUR_API_KEY>') # Your secret API key databases = Databases(client) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index c491ea4..8711e44 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -3,15 +3,14 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token databases = Databases(client) result = databases.upsert_document( database_id = '<DATABASE_ID>', collection_id = '<COLLECTION_ID>', - document_id = '<DOCUMENT_ID>', - data = {}, - permissions = ["read("any")"] # optional + document_id = '<DOCUMENT_ID>' ) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 5136d5f..79888c8 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -3,13 +3,12 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_admin('') # client.set_key('<YOUR_API_KEY>') # Your secret API key databases = Databases(client) result = databases.upsert_documents( database_id = '<DATABASE_ID>', - collection_id = '<COLLECTION_ID>', - documents = [] + collection_id = '<COLLECTION_ID>' ) diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md new file mode 100644 index 0000000..cfbaa3b --- /dev/null +++ b/docs/examples/tables/create-boolean-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_boolean_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = False, # optional + array = False # optional +) diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md new file mode 100644 index 0000000..a9f76b5 --- /dev/null +++ b/docs/examples/tables/create-datetime-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_datetime_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md new file mode 100644 index 0000000..73ac0fa --- /dev/null +++ b/docs/examples/tables/create-email-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_email_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = 'email@example.com', # optional + array = False # optional +) diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md new file mode 100644 index 0000000..2013c39 --- /dev/null +++ b/docs/examples/tables/create-enum-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_enum_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + elements = [], + required = False, + default = '<DEFAULT>', # optional + array = False # optional +) diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md new file mode 100644 index 0000000..a56a196 --- /dev/null +++ b/docs/examples/tables/create-float-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_float_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/tables/create-index.md b/docs/examples/tables/create-index.md new file mode 100644 index 0000000..69086af --- /dev/null +++ b/docs/examples/tables/create-index.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables +from appwrite.enums import IndexType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_index( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + type = IndexType.KEY, + columns = [], + orders = [], # optional + lengths = [] # optional +) diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md new file mode 100644 index 0000000..d52b14b --- /dev/null +++ b/docs/examples/tables/create-integer-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_integer_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md new file mode 100644 index 0000000..b5c7ef5 --- /dev/null +++ b/docs/examples/tables/create-ip-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_ip_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md new file mode 100644 index 0000000..187271f --- /dev/null +++ b/docs/examples/tables/create-relationship-column.md @@ -0,0 +1,21 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables +from appwrite.enums import RelationshipType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_relationship_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + related_table_id = '<RELATED_TABLE_ID>', + type = RelationshipType.ONETOONE, + two_way = False, # optional + key = '', # optional + two_way_key = '', # optional + on_delete = RelationMutate.CASCADE # optional +) diff --git a/docs/examples/tables/create-row.md b/docs/examples/tables/create-row.md new file mode 100644 index 0000000..8850a97 --- /dev/null +++ b/docs/examples/tables/create-row.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +tables = Tables(client) + +result = tables.create_row( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>', + data = {}, + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md new file mode 100644 index 0000000..3fae165 --- /dev/null +++ b/docs/examples/tables/create-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_admin('') # +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_rows( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + rows = [] +) diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md new file mode 100644 index 0000000..1308fea --- /dev/null +++ b/docs/examples/tables/create-string-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_string_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + size = 1, + required = False, + default = '<DEFAULT>', # optional + array = False, # optional + encrypt = False # optional +) diff --git a/docs/examples/tables/create-url-column.md b/docs/examples/tables/create-url-column.md new file mode 100644 index 0000000..f15c3e0 --- /dev/null +++ b/docs/examples/tables/create-url-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create_url_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = 'https://example.com', # optional + array = False # optional +) diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md new file mode 100644 index 0000000..3a02843 --- /dev/null +++ b/docs/examples/tables/create.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.create( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + row_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md new file mode 100644 index 0000000..bf027d6 --- /dev/null +++ b/docs/examples/tables/decrement-row-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.decrement_row_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>', + column = '', + value = None, # optional + min = None # optional +) diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md new file mode 100644 index 0000000..cf2dd6d --- /dev/null +++ b/docs/examples/tables/delete-column.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.delete_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '' +) diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md new file mode 100644 index 0000000..5f78d1c --- /dev/null +++ b/docs/examples/tables/delete-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.delete_index( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '' +) diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md new file mode 100644 index 0000000..40a8b09 --- /dev/null +++ b/docs/examples/tables/delete-row.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +tables = Tables(client) + +result = tables.delete_row( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>' +) diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md new file mode 100644 index 0000000..236aea1 --- /dev/null +++ b/docs/examples/tables/delete-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.delete_rows( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + queries = [] # optional +) diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md new file mode 100644 index 0000000..de48bfc --- /dev/null +++ b/docs/examples/tables/delete.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.delete( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>' +) diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md new file mode 100644 index 0000000..4bd4617 --- /dev/null +++ b/docs/examples/tables/get-column.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.get_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '' +) diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md new file mode 100644 index 0000000..cf88017 --- /dev/null +++ b/docs/examples/tables/get-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.get_index( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '' +) diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md new file mode 100644 index 0000000..25fefb2 --- /dev/null +++ b/docs/examples/tables/get-row.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +tables = Tables(client) + +result = tables.get_row( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>', + queries = [] # optional +) diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md new file mode 100644 index 0000000..789410c --- /dev/null +++ b/docs/examples/tables/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.get( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>' +) diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md new file mode 100644 index 0000000..cfb9230 --- /dev/null +++ b/docs/examples/tables/increment-row-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.increment_row_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>', + column = '', + value = None, # optional + max = None # optional +) diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md new file mode 100644 index 0000000..d9c5b16 --- /dev/null +++ b/docs/examples/tables/list-columns.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.list_columns( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + queries = [] # optional +) diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md new file mode 100644 index 0000000..0b0bb58 --- /dev/null +++ b/docs/examples/tables/list-indexes.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.list_indexes( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + queries = [] # optional +) diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md new file mode 100644 index 0000000..2ece6f6 --- /dev/null +++ b/docs/examples/tables/list-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +tables = Tables(client) + +result = tables.list_rows( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + queries = [] # optional +) diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md new file mode 100644 index 0000000..55a99e9 --- /dev/null +++ b/docs/examples/tables/list.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.list( + database_id = '<DATABASE_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md new file mode 100644 index 0000000..1bc7a4a --- /dev/null +++ b/docs/examples/tables/update-boolean-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_boolean_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = False, + new_key = '' # optional +) diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md new file mode 100644 index 0000000..157ff44 --- /dev/null +++ b/docs/examples/tables/update-datetime-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_datetime_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md new file mode 100644 index 0000000..8b9e4ca --- /dev/null +++ b/docs/examples/tables/update-email-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_email_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = 'email@example.com', + new_key = '' # optional +) diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md new file mode 100644 index 0000000..b46971b --- /dev/null +++ b/docs/examples/tables/update-enum-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_enum_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + elements = [], + required = False, + default = '<DEFAULT>', + new_key = '' # optional +) diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md new file mode 100644 index 0000000..243a26f --- /dev/null +++ b/docs/examples/tables/update-float-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_float_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md new file mode 100644 index 0000000..99b55c1 --- /dev/null +++ b/docs/examples/tables/update-integer-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_integer_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md new file mode 100644 index 0000000..2fb470a --- /dev/null +++ b/docs/examples/tables/update-ip-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_ip_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md new file mode 100644 index 0000000..35a307c --- /dev/null +++ b/docs/examples/tables/update-relationship-column.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_relationship_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + on_delete = RelationMutate.CASCADE, # optional + new_key = '' # optional +) diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md new file mode 100644 index 0000000..4a71fc9 --- /dev/null +++ b/docs/examples/tables/update-row.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +tables = Tables(client) + +result = tables.update_row( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>', + data = {}, # optional + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md new file mode 100644 index 0000000..a834346 --- /dev/null +++ b/docs/examples/tables/update-rows.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_rows( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + data = {}, # optional + queries = [] # optional +) diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md new file mode 100644 index 0000000..252c264 --- /dev/null +++ b/docs/examples/tables/update-string-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_string_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = '<DEFAULT>', + size = 1, # optional + new_key = '' # optional +) diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md new file mode 100644 index 0000000..235e2f3 --- /dev/null +++ b/docs/examples/tables/update-url-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update_url_column( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + key = '', + required = False, + default = 'https://example.com', + new_key = '' # optional +) diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md new file mode 100644 index 0000000..c567bd5 --- /dev/null +++ b/docs/examples/tables/update.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.update( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + row_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md new file mode 100644 index 0000000..e418708 --- /dev/null +++ b/docs/examples/tables/upsert-row.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +tables = Tables(client) + +result = tables.upsert_row( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>', + row_id = '<ROW_ID>' +) diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md new file mode 100644 index 0000000..85c2e94 --- /dev/null +++ b/docs/examples/tables/upsert-rows.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables import Tables + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_admin('') # +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tables = Tables(client) + +result = tables.upsert_rows( + database_id = '<DATABASE_ID>', + table_id = '<TABLE_ID>' +) diff --git a/setup.py b/setup.py index 18c78cc..f0bb253 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '11.1.0', + version = '12.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/11.1.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/12.0.0.tar.gz', install_requires=[ 'requests', ], From 8344f2d14ec919a4b40eb9d445c6e13ba992e16c Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Thu, 24 Jul 2025 06:43:18 +0000 Subject: [PATCH 21/24] chore: regen to 1.7.x --- README.md | 4 +- appwrite/client.py | 6 +- appwrite/services/account.py | 4 - appwrite/services/databases.py | 207 +- appwrite/services/tables.py | 2331 ----------------- docs/examples/databases/create-document.md | 3 +- docs/examples/databases/create-documents.md | 2 +- docs/examples/databases/upsert-document.md | 7 +- docs/examples/databases/upsert-documents.md | 5 +- docs/examples/tables/create-boolean-column.md | 18 - .../examples/tables/create-datetime-column.md | 18 - docs/examples/tables/create-email-column.md | 18 - docs/examples/tables/create-enum-column.md | 19 - docs/examples/tables/create-float-column.md | 20 - docs/examples/tables/create-index.md | 20 - docs/examples/tables/create-integer-column.md | 20 - docs/examples/tables/create-ip-column.md | 18 - .../tables/create-relationship-column.md | 21 - docs/examples/tables/create-row.md | 18 - docs/examples/tables/create-rows.md | 15 - docs/examples/tables/create-string-column.md | 20 - docs/examples/tables/create-url-column.md | 18 - docs/examples/tables/create.md | 18 - docs/examples/tables/decrement-row-column.md | 18 - docs/examples/tables/delete-column.md | 15 - docs/examples/tables/delete-index.md | 15 - docs/examples/tables/delete-row.md | 15 - docs/examples/tables/delete-rows.md | 15 - docs/examples/tables/delete.md | 14 - docs/examples/tables/get-column.md | 15 - docs/examples/tables/get-index.md | 15 - docs/examples/tables/get-row.md | 16 - docs/examples/tables/get.md | 14 - docs/examples/tables/increment-row-column.md | 18 - docs/examples/tables/list-columns.md | 15 - docs/examples/tables/list-indexes.md | 15 - docs/examples/tables/list-rows.md | 15 - docs/examples/tables/list.md | 15 - docs/examples/tables/update-boolean-column.md | 18 - .../examples/tables/update-datetime-column.md | 18 - docs/examples/tables/update-email-column.md | 18 - docs/examples/tables/update-enum-column.md | 19 - docs/examples/tables/update-float-column.md | 20 - docs/examples/tables/update-integer-column.md | 20 - docs/examples/tables/update-ip-column.md | 18 - .../tables/update-relationship-column.md | 17 - docs/examples/tables/update-row.md | 17 - docs/examples/tables/update-rows.md | 16 - docs/examples/tables/update-string-column.md | 19 - docs/examples/tables/update-url-column.md | 18 - docs/examples/tables/update.md | 18 - docs/examples/tables/upsert-row.md | 16 - docs/examples/tables/upsert-rows.md | 14 - setup.py | 4 +- 54 files changed, 83 insertions(+), 3247 deletions(-) delete mode 100644 appwrite/services/tables.py delete mode 100644 docs/examples/tables/create-boolean-column.md delete mode 100644 docs/examples/tables/create-datetime-column.md delete mode 100644 docs/examples/tables/create-email-column.md delete mode 100644 docs/examples/tables/create-enum-column.md delete mode 100644 docs/examples/tables/create-float-column.md delete mode 100644 docs/examples/tables/create-index.md delete mode 100644 docs/examples/tables/create-integer-column.md delete mode 100644 docs/examples/tables/create-ip-column.md delete mode 100644 docs/examples/tables/create-relationship-column.md delete mode 100644 docs/examples/tables/create-row.md delete mode 100644 docs/examples/tables/create-rows.md delete mode 100644 docs/examples/tables/create-string-column.md delete mode 100644 docs/examples/tables/create-url-column.md delete mode 100644 docs/examples/tables/create.md delete mode 100644 docs/examples/tables/decrement-row-column.md delete mode 100644 docs/examples/tables/delete-column.md delete mode 100644 docs/examples/tables/delete-index.md delete mode 100644 docs/examples/tables/delete-row.md delete mode 100644 docs/examples/tables/delete-rows.md delete mode 100644 docs/examples/tables/delete.md delete mode 100644 docs/examples/tables/get-column.md delete mode 100644 docs/examples/tables/get-index.md delete mode 100644 docs/examples/tables/get-row.md delete mode 100644 docs/examples/tables/get.md delete mode 100644 docs/examples/tables/increment-row-column.md delete mode 100644 docs/examples/tables/list-columns.md delete mode 100644 docs/examples/tables/list-indexes.md delete mode 100644 docs/examples/tables/list-rows.md delete mode 100644 docs/examples/tables/list.md delete mode 100644 docs/examples/tables/update-boolean-column.md delete mode 100644 docs/examples/tables/update-datetime-column.md delete mode 100644 docs/examples/tables/update-email-column.md delete mode 100644 docs/examples/tables/update-enum-column.md delete mode 100644 docs/examples/tables/update-float-column.md delete mode 100644 docs/examples/tables/update-integer-column.md delete mode 100644 docs/examples/tables/update-ip-column.md delete mode 100644 docs/examples/tables/update-relationship-column.md delete mode 100644 docs/examples/tables/update-row.md delete mode 100644 docs/examples/tables/update-rows.md delete mode 100644 docs/examples/tables/update-string-column.md delete mode 100644 docs/examples/tables/update-url-column.md delete mode 100644 docs/examples/tables/update.md delete mode 100644 docs/examples/tables/upsert-row.md delete mode 100644 docs/examples/tables/upsert-rows.md diff --git a/README.md b/README.md index a2dea19..a68a5ae 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** +**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-python/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Python SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/appwrite/client.py b/appwrite/client.py index 93897d8..b7ab483 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,12 +14,12 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/12.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/11.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '12.0.0', - 'X-Appwrite-Response-Format' : '1.8.0', + 'x-sdk-version': '11.0.0', + 'X-Appwrite-Response-Format' : '1.7.0', } def set_self_signed(self, status=True): diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 8b67abe..6062ad4 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -887,8 +887,6 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. - .. deprecated:: - This API has been deprecated. Parameters ---------- @@ -928,8 +926,6 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. - .. deprecated:: - This API has been deprecated. Parameters ---------- diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 20ddd16..40b7372 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -196,8 +196,6 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.list` instead. Parameters ---------- @@ -236,8 +234,6 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create` instead. Parameters ---------- @@ -292,8 +288,6 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.get` instead. Parameters ---------- @@ -332,8 +326,6 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per """ Update a collection by its unique ID. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update` instead. Parameters ---------- @@ -388,8 +380,6 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.delete` instead. Parameters ---------- @@ -429,15 +419,13 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st """ List attributes in the collection. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.list_columns` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). queries : List[str] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error @@ -473,15 +461,13 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st Create a boolean attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_boolean_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -532,15 +518,13 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Update a boolean attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_boolean_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -591,15 +575,13 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Create a date time attribute according to the ISO 8601 standard. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_datetime_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -650,15 +632,13 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Update a date time attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_datetime_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -710,15 +690,13 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, Create an email attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_email_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -770,15 +748,13 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, Update an email attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_email_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -786,7 +762,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -827,22 +803,20 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, def create_enum_attribute(self, database_id: str, collection_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: """ - Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_enum_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. elements : List[str] - Array of enum values. + Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. required : bool Is attribute required? default : str @@ -896,25 +870,23 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, Update an enum attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_enum_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. elements : List[str] - Updated list of enum values. + Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long. required : bool Is attribute required? default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -962,25 +934,23 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, Create a float attribute. Optionally, minimum and maximum values can be provided. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_float_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? min : float - Minimum value. + Minimum value to enforce on new documents max : float - Maximum value. + Maximum value to enforce on new documents default : float - Default value. Cannot be set when required. + Default value for attribute when not provided. Cannot be set when attribute is required. array : bool Is attribute an array? @@ -1028,27 +998,25 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, Update a float attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_float_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? default : float - Default value. Cannot be set when required. + Default value for attribute when not provided. Cannot be set when attribute is required. min : float - Minimum value. + Minimum value to enforce on new documents max : float - Maximum value. + Maximum value to enforce on new documents new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1094,25 +1062,23 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st Create an integer attribute. Optionally, minimum and maximum values can be provided. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_integer_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? min : float - Minimum value + Minimum value to enforce on new documents max : float - Maximum value + Maximum value to enforce on new documents default : float - Default value. Cannot be set when attribute is required. + Default value for attribute when not provided. Cannot be set when attribute is required. array : bool Is attribute an array? @@ -1160,27 +1126,25 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st Update an integer attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_integer_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? default : float - Default value. Cannot be set when attribute is required. + Default value for attribute when not provided. Cannot be set when attribute is required. min : float - Minimum value + Minimum value to enforce on new documents max : float - Maximum value + Maximum value to enforce on new documents new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1226,21 +1190,19 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re Create IP address attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_ip_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? default : str - Default value. Cannot be set when attribute is required. + Default value for attribute when not provided. Cannot be set when attribute is required. array : bool Is attribute an array? @@ -1286,23 +1248,21 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re Update an ip attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_ip_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool Is attribute required? default : str - Default value. Cannot be set when attribute is required. + Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1346,17 +1306,15 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_relationship_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). related_collection_id : str - Related Collection ID. + Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). type : RelationshipType Relation type two_way : bool @@ -1412,15 +1370,13 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str Create a string attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_string_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. size : float @@ -1481,15 +1437,13 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str Update a string attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_string_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -1499,7 +1453,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str size : float Maximum size of the string attribute. new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1544,15 +1498,13 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r Create a URL attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_url_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -1604,15 +1556,13 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r Update an url attribute. Changing the `default` value will not update already existing documents. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_url_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. required : bool @@ -1620,7 +1570,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r default : str Default value for attribute when not provided. Cannot be set when attribute is required. new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1663,15 +1613,13 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ """ Get attribute by ID. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.get_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. @@ -1709,15 +1657,13 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Di """ Deletes an attribute. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.delete_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. @@ -1757,21 +1703,19 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_relationship_column` instead. Parameters ---------- database_id : str Database ID. collection_id : str - Collection ID. + Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). key : str Attribute Key. on_delete : RelationMutate Constraints option new_key : str - New Attribute Key. + New attribute key. Returns ------- @@ -1810,8 +1754,6 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.list_rows` instead. Parameters ---------- @@ -1853,8 +1795,6 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_row` instead. Parameters ---------- @@ -1911,8 +1851,6 @@ def create_documents(self, database_id: str, collection_id: str, documents: List Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_row` instead. Parameters ---------- @@ -1954,15 +1892,13 @@ def create_documents(self, database_id: str, collection_id: str, documents: List 'content-type': 'application/json', }, api_params) - def upsert_documents(self, database_id: str, collection_id: str) -> Dict[str, Any]: + def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.upsert_rows` instead. Parameters ---------- @@ -1970,6 +1906,8 @@ def upsert_documents(self, database_id: str, collection_id: str) -> Dict[str, An Database ID. collection_id : str Collection ID. + documents : List[dict] + Array of document data as JSON objects. May contain partial documents. Returns ------- @@ -1990,9 +1928,13 @@ def upsert_documents(self, database_id: str, collection_id: str) -> Dict[str, An if collection_id is None: raise AppwriteException('Missing required parameter: "collection_id"') + if documents is None: + raise AppwriteException('Missing required parameter: "documents"') + api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) + api_params['documents'] = documents return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2004,8 +1946,6 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_rows` instead. Parameters ---------- @@ -2053,8 +1993,6 @@ def delete_documents(self, database_id: str, collection_id: str, queries: List[s Bulk delete documents using queries, if no queries are passed then all documents are deleted. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.delete_rows` instead. Parameters ---------- @@ -2097,8 +2035,6 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.get_row` instead. Parameters ---------- @@ -2142,14 +2078,12 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q return self.client.call('get', api_path, { }, api_params) - def upsert_document(self, database_id: str, collection_id: str, document_id: str) -> Dict[str, Any]: + def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: """ **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.upsert_row` instead. Parameters ---------- @@ -2159,6 +2093,10 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str Collection ID. document_id : str Document ID. + data : dict + Document data as JSON object. Include all required attributes of the document to be created or updated. + permissions : List[str] + An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). Returns ------- @@ -2182,10 +2120,15 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str if document_id is None: raise AppwriteException('Missing required parameter: "document_id"') + if data is None: + raise AppwriteException('Missing required parameter: "data"') + api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) api_path = api_path.replace('{documentId}', document_id) + api_params['data'] = data + api_params['permissions'] = permissions return self.client.call('put', api_path, { 'content-type': 'application/json', @@ -2195,8 +2138,6 @@ def update_document(self, database_id: str, collection_id: str, document_id: str """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.update_row` instead. Parameters ---------- @@ -2248,8 +2189,6 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str """ Delete a document by its unique ID. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.delete_row` instead. Parameters ---------- @@ -2295,8 +2234,6 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc """ Decrement a specific attribute of a document by a given value. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.decrement_row_column` instead. Parameters ---------- @@ -2309,7 +2246,7 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc attribute : str Attribute key. value : float - Value to increment the attribute by. The value must be a number. + Value to decrement the attribute by. The value must be a number. min : float Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. @@ -2354,8 +2291,6 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc """ Increment a specific attribute of a document by a given value. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.increment_row_column` instead. Parameters ---------- @@ -2413,8 +2348,6 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] """ List indexes in the collection. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.list_indexes` instead. Parameters ---------- @@ -2457,8 +2390,6 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.create_index` instead. Parameters ---------- @@ -2522,8 +2453,6 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, """ Get index by ID. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.get_index` instead. Parameters ---------- @@ -2568,8 +2497,6 @@ def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[s """ Delete an index. - .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tables.delete_index` instead. Parameters ---------- diff --git a/appwrite/services/tables.py b/appwrite/services/tables.py deleted file mode 100644 index f54cd5b..0000000 --- a/appwrite/services/tables.py +++ /dev/null @@ -1,2331 +0,0 @@ -from ..service import Service -from typing import List, Dict, Any -from ..exception import AppwriteException -from ..enums.relationship_type import RelationshipType; -from ..enums.relation_mutate import RelationMutate; -from ..enums.index_type import IndexType; - -class Tables(Service): - - def __init__(self, client) -> None: - super(Tables, self).__init__(client) - - def list(self, database_id: str, queries: List[str] = None, search: str = None) -> Dict[str, Any]: - """ - Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - - - Parameters - ---------- - database_id : str - Database ID. - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, rowSecurity - search : str - Search term to filter your list results. Max length: 256 chars. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - api_path = api_path.replace('{databaseId}', database_id) - - api_params['queries'] = queries - api_params['search'] = search - - return self.client.call('get', api_path, { - }, api_params) - - def create(self, database_id: str, table_id: str, name: str, permissions: List[str] = None, row_security: bool = None, enabled: bool = None) -> Dict[str, Any]: - """ - Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - name : str - Table name. Max length: 128 chars. - permissions : List[str] - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - row_security : bool - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - enabled : bool - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if name is None: - raise AppwriteException('Missing required parameter: "name"') - - api_path = api_path.replace('{databaseId}', database_id) - - api_params['tableId'] = table_id - api_params['name'] = name - api_params['permissions'] = permissions - api_params['rowSecurity'] = row_security - api_params['enabled'] = enabled - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get(self, database_id: str, table_id: str) -> Dict[str, Any]: - """ - Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - - return self.client.call('get', api_path, { - }, api_params) - - def update(self, database_id: str, table_id: str, name: str, permissions: List[str] = None, row_security: bool = None, enabled: bool = None) -> Dict[str, Any]: - """ - Update a table by its unique ID. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - name : str - Table name. Max length: 128 chars. - permissions : List[str] - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - row_security : bool - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - enabled : bool - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if name is None: - raise AppwriteException('Missing required parameter: "name"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['name'] = name - api_params['permissions'] = permissions - api_params['rowSecurity'] = row_security - api_params['enabled'] = enabled - - return self.client.call('put', api_path, { - 'content-type': 'application/json', - }, api_params) - - def delete(self, database_id: str, table_id: str) -> Dict[str, Any]: - """ - Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, api_params) - - def list_columns(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: - """ - List attributes in the collection. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['queries'] = queries - - return self.client.call('get', api_path, { - }, api_params) - - def create_boolean_column(self, database_id: str, table_id: str, key: str, required: bool, default: bool = None, array: bool = None) -> Dict[str, Any]: - """ - Create a boolean column. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Column Key. - required : bool - Is column required? - default : bool - Default value for column when not provided. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/boolean' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_boolean_column(self, database_id: str, table_id: str, key: str, required: bool, default: bool, new_key: str = None) -> Dict[str, Any]: - """ - Update a boolean column. Changing the `default` value will not update already existing rows. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Column Key. - required : bool - Is column required? - default : bool - Default value for column when not provided. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/boolean/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_datetime_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: - """ - Create a date time column according to the ISO 8601 standard. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/datetime' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_datetime_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: - """ - Update a date time column. Changing the `default` value will not update already existing rows. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/datetime/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_email_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: - """ - Create an email column. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/email' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_email_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: - """ - Update an email column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/email/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_enum_column(self, database_id: str, table_id: str, key: str, elements: List[str], required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: - """ - Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - elements : List[str] - Array of enum values. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/enum' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if elements is None: - raise AppwriteException('Missing required parameter: "elements"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['elements'] = elements - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_enum_column(self, database_id: str, table_id: str, key: str, elements: List[str], required: bool, default: str, new_key: str = None) -> Dict[str, Any]: - """ - Update an enum column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - elements : List[str] - Updated list of enum values. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/enum/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if elements is None: - raise AppwriteException('Missing required parameter: "elements"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['elements'] = elements - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_float_column(self, database_id: str, table_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None) -> Dict[str, Any]: - """ - Create a float column. Optionally, minimum and maximum values can be provided. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - min : float - Minimum value - max : float - Maximum value - default : float - Default value. Cannot be set when required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/float' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['min'] = min - api_params['max'] = max - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_float_column(self, database_id: str, table_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None) -> Dict[str, Any]: - """ - Update a float column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : float - Default value. Cannot be set when required. - min : float - Minimum value - max : float - Maximum value - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/float/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['min'] = min - api_params['max'] = max - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_integer_column(self, database_id: str, table_id: str, key: str, required: bool, min: float = None, max: float = None, default: float = None, array: bool = None) -> Dict[str, Any]: - """ - Create an integer column. Optionally, minimum and maximum values can be provided. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - min : float - Minimum value - max : float - Maximum value - default : float - Default value. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/integer' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['min'] = min - api_params['max'] = max - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_integer_column(self, database_id: str, table_id: str, key: str, required: bool, default: float, min: float = None, max: float = None, new_key: str = None) -> Dict[str, Any]: - """ - Update an integer column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : float - Default value. Cannot be set when column is required. - min : float - Minimum value - max : float - Maximum value - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/integer/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['min'] = min - api_params['max'] = max - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_ip_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: - """ - Create IP address column. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/ip' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_ip_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: - """ - Update an ip column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/ip/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_relationship_column(self, database_id: str, table_id: str, related_table_id: str, type: RelationshipType, two_way: bool = None, key: str = None, two_way_key: str = None, on_delete: RelationMutate = None) -> Dict[str, Any]: - """ - Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - related_table_id : str - Related Table ID. - type : RelationshipType - Relation type - two_way : bool - Is Two Way? - key : str - Column Key. - two_way_key : str - Two Way Column Key. - on_delete : RelationMutate - Constraints option - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/relationship' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if related_table_id is None: - raise AppwriteException('Missing required parameter: "related_table_id"') - - if type is None: - raise AppwriteException('Missing required parameter: "type"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['relatedTableId'] = related_table_id - api_params['type'] = type - api_params['twoWay'] = two_way - api_params['key'] = key - api_params['twoWayKey'] = two_way_key - api_params['onDelete'] = on_delete - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_string_column(self, database_id: str, table_id: str, key: str, size: float, required: bool, default: str = None, array: bool = None, encrypt: bool = None) -> Dict[str, Any]: - """ - Create a string column. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Column Key. - size : float - Attribute size for text attributes, in number of characters. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - array : bool - Is column an array? - encrypt : bool - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/string' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if size is None: - raise AppwriteException('Missing required parameter: "size"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['size'] = size - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - api_params['encrypt'] = encrypt - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_string_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, size: float = None, new_key: str = None) -> Dict[str, Any]: - """ - Update a string column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - size : float - Maximum size of the string column. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/string/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['size'] = size - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_url_column(self, database_id: str, table_id: str, key: str, required: bool, default: str = None, array: bool = None) -> Dict[str, Any]: - """ - Create a URL column. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - array : bool - Is column an array? - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/url' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['required'] = required - api_params['default'] = default - api_params['array'] = array - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_url_column(self, database_id: str, table_id: str, key: str, required: bool, default: str, new_key: str = None) -> Dict[str, Any]: - """ - Update an url column. Changing the `default` value will not update already existing rows. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - required : bool - Is column required? - default : str - Default value for column when not provided. Cannot be set when column is required. - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/url/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if required is None: - raise AppwriteException('Missing required parameter: "required"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['required'] = required - api_params['default'] = default - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_column(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: - """ - Get column by ID. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - - return self.client.call('get', api_path, { - }, api_params) - - def delete_column(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: - """ - Deletes a column. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_relationship_column(self, database_id: str, table_id: str, key: str, on_delete: RelationMutate = None, new_key: str = None) -> Dict[str, Any]: - """ - Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - key : str - Column Key. - on_delete : RelationMutate - Constraints option - new_key : str - New Column Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/columns/{key}/relationship' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - api_params['onDelete'] = on_delete - api_params['newKey'] = new_key - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def list_indexes(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: - """ - List indexes in the collection. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/indexes' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['queries'] = queries - - return self.client.call('get', api_path, { - }, api_params) - - def create_index(self, database_id: str, table_id: str, key: str, type: IndexType, columns: List[str], orders: List[str] = None, lengths: List[float] = None) -> Dict[str, Any]: - """ - Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - Attributes can be `key`, `fulltext`, and `unique`. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Index Key. - type : IndexType - Index type. - columns : List[str] - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - orders : List[str] - Array of index orders. Maximum of 100 orders are allowed. - lengths : List[float] - Length of index. Maximum of 100 - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/indexes' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - if type is None: - raise AppwriteException('Missing required parameter: "type"') - - if columns is None: - raise AppwriteException('Missing required parameter: "columns"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['key'] = key - api_params['type'] = type - api_params['columns'] = columns - api_params['orders'] = orders - api_params['lengths'] = lengths - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_index(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: - """ - Get index by ID. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Index Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/indexes/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - - return self.client.call('get', api_path, { - }, api_params) - - def delete_index(self, database_id: str, table_id: str, key: str) -> Dict[str, Any]: - """ - Delete an index. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - key : str - Index Key. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/indexes/{key}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if key is None: - raise AppwriteException('Missing required parameter: "key"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{key}', key) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, api_params) - - def list_rows(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: - """ - Get a list of all the user's rows in a given table. You can use the query params to filter your results. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['queries'] = queries - - return self.client.call('get', api_path, { - }, api_params) - - def create_row(self, database_id: str, table_id: str, row_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: - """ - Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - row_id : str - Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. - data : dict - Row data as JSON object. - permissions : List[str] - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - if data is None: - raise AppwriteException('Missing required parameter: "data"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['rowId'] = row_id - api_params['data'] = data - api_params['permissions'] = permissions - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def create_rows(self, database_id: str, table_id: str, rows: List[dict]) -> Dict[str, Any]: - """ - Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). Make sure to define columns before creating rows. - rows : List[dict] - Array of documents data as JSON objects. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if rows is None: - raise AppwriteException('Missing required parameter: "rows"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['rows'] = rows - - return self.client.call('post', api_path, { - 'content-type': 'application/json', - }, api_params) - - def upsert_rows(self, database_id: str, table_id: str) -> Dict[str, Any]: - """ - Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - - return self.client.call('put', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_rows(self, database_id: str, table_id: str, data: dict = None, queries: List[str] = None) -> Dict[str, Any]: - """ - Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - data : dict - Row data as JSON object. Include only column and value pairs to be updated. - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['data'] = data - api_params['queries'] = queries - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def delete_rows(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: - """ - Bulk delete rows using queries, if no queries are passed then all rows are deleted. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - - api_params['queries'] = queries - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, api_params) - - def get_row(self, database_id: str, table_id: str, row_id: str, queries: List[str] = None) -> Dict[str, Any]: - """ - Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - row_id : str - Row ID. - queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - - api_params['queries'] = queries - - return self.client.call('get', api_path, { - }, api_params) - - def upsert_row(self, database_id: str, table_id: str, row_id: str) -> Dict[str, Any]: - """ - Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateTable) API or directly from your database console. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - row_id : str - Row ID. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - - - return self.client.call('put', api_path, { - 'content-type': 'application/json', - }, api_params) - - def update_row(self, database_id: str, table_id: str, row_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: - """ - Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - row_id : str - Row ID. - data : dict - Row data as JSON object. Include only columns and value pairs to be updated. - permissions : List[str] - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - - api_params['data'] = data - api_params['permissions'] = permissions - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def delete_row(self, database_id: str, table_id: str, row_id: str) -> Dict[str, Any]: - """ - Delete a row by its unique ID. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tables#tablesCreate). - row_id : str - Row ID. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - - - return self.client.call('delete', api_path, { - 'content-type': 'application/json', - }, api_params) - - def decrement_row_column(self, database_id: str, table_id: str, row_id: str, column: str, value: float = None, min: float = None) -> Dict[str, Any]: - """ - Decrement a specific column of a row by a given value. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - row_id : str - Row ID. - column : str - Column key. - value : float - Value to increment the column by. The value must be a number. - min : float - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - if column is None: - raise AppwriteException('Missing required parameter: "column"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - api_path = api_path.replace('{column}', column) - - api_params['value'] = value - api_params['min'] = min - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) - - def increment_row_column(self, database_id: str, table_id: str, row_id: str, column: str, value: float = None, max: float = None) -> Dict[str, Any]: - """ - Increment a specific column of a row by a given value. - - - Parameters - ---------- - database_id : str - Database ID. - table_id : str - Table ID. - row_id : str - Row ID. - column : str - Column key. - value : float - Value to increment the column by. The value must be a number. - max : float - Maximum value for the column. If the current value is greater than this value, an error will be thrown. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/databases/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment' - api_params = {} - if database_id is None: - raise AppwriteException('Missing required parameter: "database_id"') - - if table_id is None: - raise AppwriteException('Missing required parameter: "table_id"') - - if row_id is None: - raise AppwriteException('Missing required parameter: "row_id"') - - if column is None: - raise AppwriteException('Missing required parameter: "column"') - - api_path = api_path.replace('{databaseId}', database_id) - api_path = api_path.replace('{tableId}', table_id) - api_path = api_path.replace('{rowId}', row_id) - api_path = api_path.replace('{column}', column) - - api_params['value'] = value - api_params['max'] = max - - return self.client.call('patch', api_path, { - 'content-type': 'application/json', - }, api_params) diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1a8500b..1eaf024 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,9 +3,8 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with -client.set_key('<YOUR_API_KEY>') # Your secret API key -client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token databases = Databases(client) diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 27ad6e8..1b94e51 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -3,7 +3,7 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_admin('') # +client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key databases = Databases(client) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 8711e44..c491ea4 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -3,14 +3,15 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_session('') # The user session to authenticate with -client.set_key('<YOUR_API_KEY>') # Your secret API key -client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token databases = Databases(client) result = databases.upsert_document( database_id = '<DATABASE_ID>', collection_id = '<COLLECTION_ID>', - document_id = '<DOCUMENT_ID>' + document_id = '<DOCUMENT_ID>', + data = {}, + permissions = ["read("any")"] # optional ) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 79888c8..5136d5f 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -3,12 +3,13 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_admin('') # +client.set_project('<YOUR_PROJECT_ID>') # Your project ID client.set_key('<YOUR_API_KEY>') # Your secret API key databases = Databases(client) result = databases.upsert_documents( database_id = '<DATABASE_ID>', - collection_id = '<COLLECTION_ID>' + collection_id = '<COLLECTION_ID>', + documents = [] ) diff --git a/docs/examples/tables/create-boolean-column.md b/docs/examples/tables/create-boolean-column.md deleted file mode 100644 index cfbaa3b..0000000 --- a/docs/examples/tables/create-boolean-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_boolean_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = False, # optional - array = False # optional -) diff --git a/docs/examples/tables/create-datetime-column.md b/docs/examples/tables/create-datetime-column.md deleted file mode 100644 index a9f76b5..0000000 --- a/docs/examples/tables/create-datetime-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_datetime_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = '', # optional - array = False # optional -) diff --git a/docs/examples/tables/create-email-column.md b/docs/examples/tables/create-email-column.md deleted file mode 100644 index 73ac0fa..0000000 --- a/docs/examples/tables/create-email-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_email_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = 'email@example.com', # optional - array = False # optional -) diff --git a/docs/examples/tables/create-enum-column.md b/docs/examples/tables/create-enum-column.md deleted file mode 100644 index 2013c39..0000000 --- a/docs/examples/tables/create-enum-column.md +++ /dev/null @@ -1,19 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_enum_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - elements = [], - required = False, - default = '<DEFAULT>', # optional - array = False # optional -) diff --git a/docs/examples/tables/create-float-column.md b/docs/examples/tables/create-float-column.md deleted file mode 100644 index a56a196..0000000 --- a/docs/examples/tables/create-float-column.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_float_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - min = None, # optional - max = None, # optional - default = None, # optional - array = False # optional -) diff --git a/docs/examples/tables/create-index.md b/docs/examples/tables/create-index.md deleted file mode 100644 index 69086af..0000000 --- a/docs/examples/tables/create-index.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables -from appwrite.enums import IndexType - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_index( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - type = IndexType.KEY, - columns = [], - orders = [], # optional - lengths = [] # optional -) diff --git a/docs/examples/tables/create-integer-column.md b/docs/examples/tables/create-integer-column.md deleted file mode 100644 index d52b14b..0000000 --- a/docs/examples/tables/create-integer-column.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_integer_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - min = None, # optional - max = None, # optional - default = None, # optional - array = False # optional -) diff --git a/docs/examples/tables/create-ip-column.md b/docs/examples/tables/create-ip-column.md deleted file mode 100644 index b5c7ef5..0000000 --- a/docs/examples/tables/create-ip-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_ip_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = '', # optional - array = False # optional -) diff --git a/docs/examples/tables/create-relationship-column.md b/docs/examples/tables/create-relationship-column.md deleted file mode 100644 index 187271f..0000000 --- a/docs/examples/tables/create-relationship-column.md +++ /dev/null @@ -1,21 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables -from appwrite.enums import RelationshipType - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_relationship_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - related_table_id = '<RELATED_TABLE_ID>', - type = RelationshipType.ONETOONE, - two_way = False, # optional - key = '', # optional - two_way_key = '', # optional - on_delete = RelationMutate.CASCADE # optional -) diff --git a/docs/examples/tables/create-row.md b/docs/examples/tables/create-row.md deleted file mode 100644 index 8850a97..0000000 --- a/docs/examples/tables/create-row.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_session('') # The user session to authenticate with -client.set_key('<YOUR_API_KEY>') # Your secret API key -client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token - -tables = Tables(client) - -result = tables.create_row( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>', - data = {}, - permissions = ["read("any")"] # optional -) diff --git a/docs/examples/tables/create-rows.md b/docs/examples/tables/create-rows.md deleted file mode 100644 index 3fae165..0000000 --- a/docs/examples/tables/create-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_admin('') # -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_rows( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - rows = [] -) diff --git a/docs/examples/tables/create-string-column.md b/docs/examples/tables/create-string-column.md deleted file mode 100644 index 1308fea..0000000 --- a/docs/examples/tables/create-string-column.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_string_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - size = 1, - required = False, - default = '<DEFAULT>', # optional - array = False, # optional - encrypt = False # optional -) diff --git a/docs/examples/tables/create-url-column.md b/docs/examples/tables/create-url-column.md deleted file mode 100644 index f15c3e0..0000000 --- a/docs/examples/tables/create-url-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create_url_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = 'https://example.com', # optional - array = False # optional -) diff --git a/docs/examples/tables/create.md b/docs/examples/tables/create.md deleted file mode 100644 index 3a02843..0000000 --- a/docs/examples/tables/create.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.create( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - name = '<NAME>', - permissions = ["read("any")"], # optional - row_security = False, # optional - enabled = False # optional -) diff --git a/docs/examples/tables/decrement-row-column.md b/docs/examples/tables/decrement-row-column.md deleted file mode 100644 index bf027d6..0000000 --- a/docs/examples/tables/decrement-row-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.decrement_row_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>', - column = '', - value = None, # optional - min = None # optional -) diff --git a/docs/examples/tables/delete-column.md b/docs/examples/tables/delete-column.md deleted file mode 100644 index cf2dd6d..0000000 --- a/docs/examples/tables/delete-column.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.delete_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '' -) diff --git a/docs/examples/tables/delete-index.md b/docs/examples/tables/delete-index.md deleted file mode 100644 index 5f78d1c..0000000 --- a/docs/examples/tables/delete-index.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.delete_index( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '' -) diff --git a/docs/examples/tables/delete-row.md b/docs/examples/tables/delete-row.md deleted file mode 100644 index 40a8b09..0000000 --- a/docs/examples/tables/delete-row.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_session('') # The user session to authenticate with - -tables = Tables(client) - -result = tables.delete_row( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>' -) diff --git a/docs/examples/tables/delete-rows.md b/docs/examples/tables/delete-rows.md deleted file mode 100644 index 236aea1..0000000 --- a/docs/examples/tables/delete-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.delete_rows( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - queries = [] # optional -) diff --git a/docs/examples/tables/delete.md b/docs/examples/tables/delete.md deleted file mode 100644 index de48bfc..0000000 --- a/docs/examples/tables/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.delete( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>' -) diff --git a/docs/examples/tables/get-column.md b/docs/examples/tables/get-column.md deleted file mode 100644 index 4bd4617..0000000 --- a/docs/examples/tables/get-column.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.get_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '' -) diff --git a/docs/examples/tables/get-index.md b/docs/examples/tables/get-index.md deleted file mode 100644 index cf88017..0000000 --- a/docs/examples/tables/get-index.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.get_index( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '' -) diff --git a/docs/examples/tables/get-row.md b/docs/examples/tables/get-row.md deleted file mode 100644 index 25fefb2..0000000 --- a/docs/examples/tables/get-row.md +++ /dev/null @@ -1,16 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_session('') # The user session to authenticate with - -tables = Tables(client) - -result = tables.get_row( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>', - queries = [] # optional -) diff --git a/docs/examples/tables/get.md b/docs/examples/tables/get.md deleted file mode 100644 index 789410c..0000000 --- a/docs/examples/tables/get.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.get( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>' -) diff --git a/docs/examples/tables/increment-row-column.md b/docs/examples/tables/increment-row-column.md deleted file mode 100644 index cfb9230..0000000 --- a/docs/examples/tables/increment-row-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.increment_row_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>', - column = '', - value = None, # optional - max = None # optional -) diff --git a/docs/examples/tables/list-columns.md b/docs/examples/tables/list-columns.md deleted file mode 100644 index d9c5b16..0000000 --- a/docs/examples/tables/list-columns.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.list_columns( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - queries = [] # optional -) diff --git a/docs/examples/tables/list-indexes.md b/docs/examples/tables/list-indexes.md deleted file mode 100644 index 0b0bb58..0000000 --- a/docs/examples/tables/list-indexes.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.list_indexes( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - queries = [] # optional -) diff --git a/docs/examples/tables/list-rows.md b/docs/examples/tables/list-rows.md deleted file mode 100644 index 2ece6f6..0000000 --- a/docs/examples/tables/list-rows.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_session('') # The user session to authenticate with - -tables = Tables(client) - -result = tables.list_rows( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - queries = [] # optional -) diff --git a/docs/examples/tables/list.md b/docs/examples/tables/list.md deleted file mode 100644 index 55a99e9..0000000 --- a/docs/examples/tables/list.md +++ /dev/null @@ -1,15 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.list( - database_id = '<DATABASE_ID>', - queries = [], # optional - search = '<SEARCH>' # optional -) diff --git a/docs/examples/tables/update-boolean-column.md b/docs/examples/tables/update-boolean-column.md deleted file mode 100644 index 1bc7a4a..0000000 --- a/docs/examples/tables/update-boolean-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_boolean_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = False, - new_key = '' # optional -) diff --git a/docs/examples/tables/update-datetime-column.md b/docs/examples/tables/update-datetime-column.md deleted file mode 100644 index 157ff44..0000000 --- a/docs/examples/tables/update-datetime-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_datetime_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = '', - new_key = '' # optional -) diff --git a/docs/examples/tables/update-email-column.md b/docs/examples/tables/update-email-column.md deleted file mode 100644 index 8b9e4ca..0000000 --- a/docs/examples/tables/update-email-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_email_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = 'email@example.com', - new_key = '' # optional -) diff --git a/docs/examples/tables/update-enum-column.md b/docs/examples/tables/update-enum-column.md deleted file mode 100644 index b46971b..0000000 --- a/docs/examples/tables/update-enum-column.md +++ /dev/null @@ -1,19 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_enum_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - elements = [], - required = False, - default = '<DEFAULT>', - new_key = '' # optional -) diff --git a/docs/examples/tables/update-float-column.md b/docs/examples/tables/update-float-column.md deleted file mode 100644 index 243a26f..0000000 --- a/docs/examples/tables/update-float-column.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_float_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = None, - min = None, # optional - max = None, # optional - new_key = '' # optional -) diff --git a/docs/examples/tables/update-integer-column.md b/docs/examples/tables/update-integer-column.md deleted file mode 100644 index 99b55c1..0000000 --- a/docs/examples/tables/update-integer-column.md +++ /dev/null @@ -1,20 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_integer_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = None, - min = None, # optional - max = None, # optional - new_key = '' # optional -) diff --git a/docs/examples/tables/update-ip-column.md b/docs/examples/tables/update-ip-column.md deleted file mode 100644 index 2fb470a..0000000 --- a/docs/examples/tables/update-ip-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_ip_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = '', - new_key = '' # optional -) diff --git a/docs/examples/tables/update-relationship-column.md b/docs/examples/tables/update-relationship-column.md deleted file mode 100644 index 35a307c..0000000 --- a/docs/examples/tables/update-relationship-column.md +++ /dev/null @@ -1,17 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_relationship_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - on_delete = RelationMutate.CASCADE, # optional - new_key = '' # optional -) diff --git a/docs/examples/tables/update-row.md b/docs/examples/tables/update-row.md deleted file mode 100644 index 4a71fc9..0000000 --- a/docs/examples/tables/update-row.md +++ /dev/null @@ -1,17 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_session('') # The user session to authenticate with - -tables = Tables(client) - -result = tables.update_row( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>', - data = {}, # optional - permissions = ["read("any")"] # optional -) diff --git a/docs/examples/tables/update-rows.md b/docs/examples/tables/update-rows.md deleted file mode 100644 index a834346..0000000 --- a/docs/examples/tables/update-rows.md +++ /dev/null @@ -1,16 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_rows( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - data = {}, # optional - queries = [] # optional -) diff --git a/docs/examples/tables/update-string-column.md b/docs/examples/tables/update-string-column.md deleted file mode 100644 index 252c264..0000000 --- a/docs/examples/tables/update-string-column.md +++ /dev/null @@ -1,19 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_string_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = '<DEFAULT>', - size = 1, # optional - new_key = '' # optional -) diff --git a/docs/examples/tables/update-url-column.md b/docs/examples/tables/update-url-column.md deleted file mode 100644 index 235e2f3..0000000 --- a/docs/examples/tables/update-url-column.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update_url_column( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - key = '', - required = False, - default = 'https://example.com', - new_key = '' # optional -) diff --git a/docs/examples/tables/update.md b/docs/examples/tables/update.md deleted file mode 100644 index c567bd5..0000000 --- a/docs/examples/tables/update.md +++ /dev/null @@ -1,18 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_project('<YOUR_PROJECT_ID>') # Your project ID -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.update( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - name = '<NAME>', - permissions = ["read("any")"], # optional - row_security = False, # optional - enabled = False # optional -) diff --git a/docs/examples/tables/upsert-row.md b/docs/examples/tables/upsert-row.md deleted file mode 100644 index e418708..0000000 --- a/docs/examples/tables/upsert-row.md +++ /dev/null @@ -1,16 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_session('') # The user session to authenticate with -client.set_key('<YOUR_API_KEY>') # Your secret API key -client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token - -tables = Tables(client) - -result = tables.upsert_row( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>', - row_id = '<ROW_ID>' -) diff --git a/docs/examples/tables/upsert-rows.md b/docs/examples/tables/upsert-rows.md deleted file mode 100644 index 85c2e94..0000000 --- a/docs/examples/tables/upsert-rows.md +++ /dev/null @@ -1,14 +0,0 @@ -from appwrite.client import Client -from appwrite.services.tables import Tables - -client = Client() -client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint -client.set_admin('') # -client.set_key('<YOUR_API_KEY>') # Your secret API key - -tables = Tables(client) - -result = tables.upsert_rows( - database_id = '<DATABASE_ID>', - table_id = '<TABLE_ID>' -) diff --git a/setup.py b/setup.py index f0bb253..5c6270f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '12.0.0', + version = '11.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/12.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/11.0.0.tar.gz', install_requires=[ 'requests', ], From d1111d5eb3b2e1b51f45303b6423ab766ac9b79d Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Thu, 24 Jul 2025 10:38:43 +0000 Subject: [PATCH 22/24] chore: changelog --- CHANGELOG.md | 8 +++++- appwrite/services/account.py | 31 --------------------- appwrite/services/avatars.py | 7 ----- appwrite/services/databases.py | 49 ---------------------------------- appwrite/services/functions.py | 24 ----------------- appwrite/services/graphql.py | 2 -- appwrite/services/health.py | 14 ---------- appwrite/services/messaging.py | 46 ------------------------------- appwrite/services/sites.py | 23 ---------------- appwrite/services/storage.py | 13 --------- appwrite/services/teams.py | 13 --------- appwrite/services/tokens.py | 5 ---- appwrite/services/users.py | 42 ----------------------------- 13 files changed, 7 insertions(+), 270 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..510e270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,7 @@ -# Change Log \ No newline at end of file +# Change Log + +## 11.1.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Add `dart38` and `flutter332` support to runtime models +* Add `gif` support to `ImageFormat` enum diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 6062ad4..9dd3c5e 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -35,7 +35,6 @@ def create(self, user_id: str, email: str, password: str, name: str = None) -> D """ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). - Parameters ---------- user_id : str @@ -85,7 +84,6 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - Parameters ---------- email : str @@ -124,7 +122,6 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. - Parameters ---------- queries : List[str] @@ -153,7 +150,6 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. - Parameters ---------- identity_id : str @@ -208,7 +204,6 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. - Parameters ---------- queries : List[str] @@ -237,7 +232,6 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on an account. - Parameters ---------- mfa : bool @@ -270,7 +264,6 @@ def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. - Parameters ---------- type : AuthenticatorType @@ -303,7 +296,6 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st """ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. - Parameters ---------- type : AuthenticatorType @@ -342,7 +334,6 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. - Parameters ---------- type : AuthenticatorType @@ -375,7 +366,6 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: """ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. - Parameters ---------- factor : AuthenticationFactor @@ -408,7 +398,6 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: """ Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. - Parameters ---------- challenge_id : str @@ -533,7 +522,6 @@ def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. - Parameters ---------- name : str @@ -566,7 +554,6 @@ def update_password(self, password: str, old_password: str = None) -> Dict[str, """ Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. - Parameters ---------- password : str @@ -602,7 +589,6 @@ def update_phone(self, phone: str, password: str) -> Dict[str, Any]: """ Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. - Parameters ---------- phone : str @@ -662,7 +648,6 @@ def update_prefs(self, prefs: dict) -> Dict[str, Any]: """ Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - Parameters ---------- prefs : dict @@ -695,7 +680,6 @@ def create_recovery(self, email: str, url: str) -> Dict[str, Any]: """ Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. - Parameters ---------- email : str @@ -736,7 +720,6 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - Parameters ---------- user_id : str @@ -848,7 +831,6 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - Parameters ---------- email : str @@ -887,7 +869,6 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. - Parameters ---------- user_id : str @@ -926,7 +907,6 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. - Parameters ---------- user_id : str @@ -965,7 +945,6 @@ def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. - Parameters ---------- user_id : str @@ -1004,7 +983,6 @@ def get_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. - Parameters ---------- session_id : str @@ -1036,7 +1014,6 @@ def update_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. - Parameters ---------- session_id : str @@ -1069,7 +1046,6 @@ def delete_session(self, session_id: str) -> Dict[str, Any]: """ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. - Parameters ---------- session_id : str @@ -1126,7 +1102,6 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> D A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - Parameters ---------- user_id : str @@ -1171,7 +1146,6 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - Parameters ---------- user_id : str @@ -1220,7 +1194,6 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - Parameters ---------- provider : OAuthProvider @@ -1263,7 +1236,6 @@ def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - Parameters ---------- user_id : str @@ -1305,7 +1277,6 @@ def create_verification(self, url: str) -> Dict[str, Any]: Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. - Parameters ---------- url : str @@ -1338,7 +1309,6 @@ def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. - Parameters ---------- user_id : str @@ -1399,7 +1369,6 @@ def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any] """ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. - Parameters ---------- user_id : str diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 2bd32f7..6ee1d4f 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -16,7 +16,6 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - Parameters ---------- code : Browser @@ -60,7 +59,6 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - Parameters ---------- code : CreditCard @@ -103,7 +101,6 @@ def get_favicon(self, url: str) -> bytes: This endpoint does not follow HTTP redirects. - Parameters ---------- url : str @@ -138,7 +135,6 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - Parameters ---------- code : Flag @@ -183,7 +179,6 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte This endpoint does not follow HTTP redirects. - Parameters ---------- url : str @@ -226,7 +221,6 @@ def get_initials(self, name: str = None, width: float = None, height: float = No When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - Parameters ---------- name : str @@ -265,7 +259,6 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - Parameters ---------- text : str diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 40b7372..b025e0c 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -14,7 +14,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - Parameters ---------- queries : List[str] @@ -47,7 +46,6 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Create a new Database. - Parameters ---------- database_id : str @@ -89,7 +87,6 @@ def get(self, database_id: str) -> Dict[str, Any]: """ Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - Parameters ---------- database_id : str @@ -121,7 +118,6 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Update a database by its unique ID. - Parameters ---------- database_id : str @@ -163,7 +159,6 @@ def delete(self, database_id: str) -> Dict[str, Any]: """ Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - Parameters ---------- database_id : str @@ -196,7 +191,6 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. - Parameters ---------- database_id : str @@ -234,7 +228,6 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- database_id : str @@ -288,7 +281,6 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - Parameters ---------- database_id : str @@ -326,7 +318,6 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per """ Update a collection by its unique ID. - Parameters ---------- database_id : str @@ -380,7 +371,6 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - Parameters ---------- database_id : str @@ -419,7 +409,6 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st """ List attributes in the collection. - Parameters ---------- database_id : str @@ -461,7 +450,6 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st Create a boolean attribute. - Parameters ---------- database_id : str @@ -518,7 +506,6 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Update a boolean attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -575,7 +562,6 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Create a date time attribute according to the ISO 8601 standard. - Parameters ---------- database_id : str @@ -632,7 +618,6 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Update a date time attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -690,7 +675,6 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, Create an email attribute. - Parameters ---------- database_id : str @@ -748,7 +732,6 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, Update an email attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -806,7 +789,6 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. - Parameters ---------- database_id : str @@ -870,7 +852,6 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, Update an enum attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -934,7 +915,6 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, Create a float attribute. Optionally, minimum and maximum values can be provided. - Parameters ---------- database_id : str @@ -998,7 +978,6 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, Update a float attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -1062,7 +1041,6 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st Create an integer attribute. Optionally, minimum and maximum values can be provided. - Parameters ---------- database_id : str @@ -1126,7 +1104,6 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st Update an integer attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -1190,7 +1167,6 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re Create IP address attribute. - Parameters ---------- database_id : str @@ -1248,7 +1224,6 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re Update an ip attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -1306,7 +1281,6 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - Parameters ---------- database_id : str @@ -1370,7 +1344,6 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str Create a string attribute. - Parameters ---------- database_id : str @@ -1437,7 +1410,6 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str Update a string attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -1498,7 +1470,6 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r Create a URL attribute. - Parameters ---------- database_id : str @@ -1556,7 +1527,6 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r Update an url attribute. Changing the `default` value will not update already existing documents. - Parameters ---------- database_id : str @@ -1613,7 +1583,6 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ """ Get attribute by ID. - Parameters ---------- database_id : str @@ -1657,7 +1626,6 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Di """ Deletes an attribute. - Parameters ---------- database_id : str @@ -1703,7 +1671,6 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - Parameters ---------- database_id : str @@ -1754,7 +1721,6 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - Parameters ---------- database_id : str @@ -1795,7 +1761,6 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- database_id : str @@ -1851,7 +1816,6 @@ def create_documents(self, database_id: str, collection_id: str, documents: List Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- database_id : str @@ -1899,7 +1863,6 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- database_id : str @@ -1946,7 +1909,6 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - Parameters ---------- database_id : str @@ -1993,7 +1955,6 @@ def delete_documents(self, database_id: str, collection_id: str, queries: List[s Bulk delete documents using queries, if no queries are passed then all documents are deleted. - Parameters ---------- database_id : str @@ -2035,7 +1996,6 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. - Parameters ---------- database_id : str @@ -2084,7 +2044,6 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - Parameters ---------- database_id : str @@ -2138,7 +2097,6 @@ def update_document(self, database_id: str, collection_id: str, document_id: str """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - Parameters ---------- database_id : str @@ -2189,7 +2147,6 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str """ Delete a document by its unique ID. - Parameters ---------- database_id : str @@ -2234,7 +2191,6 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc """ Decrement a specific attribute of a document by a given value. - Parameters ---------- database_id : str @@ -2291,7 +2247,6 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc """ Increment a specific attribute of a document by a given value. - Parameters ---------- database_id : str @@ -2348,7 +2303,6 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] """ List indexes in the collection. - Parameters ---------- database_id : str @@ -2390,7 +2344,6 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. - Parameters ---------- database_id : str @@ -2453,7 +2406,6 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, """ Get index by ID. - Parameters ---------- database_id : str @@ -2497,7 +2449,6 @@ def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[s """ Delete an index. - Parameters ---------- database_id : str diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 3dd2459..9dce425 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -16,7 +16,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. - Parameters ---------- queries : List[str] @@ -48,7 +47,6 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. - Parameters ---------- function_id : str @@ -180,7 +178,6 @@ def get(self, function_id: str) -> Dict[str, Any]: """ Get a function by its unique ID. - Parameters ---------- function_id : str @@ -212,7 +209,6 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: """ Update function by its unique ID. - Parameters ---------- function_id : str @@ -299,7 +295,6 @@ def delete(self, function_id: str) -> Dict[str, Any]: """ Delete a function by its unique ID. - Parameters ---------- function_id : str @@ -332,7 +327,6 @@ def update_function_deployment(self, function_id: str, deployment_id: str) -> Di """ Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. - Parameters ---------- function_id : str @@ -371,7 +365,6 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: """ Get a list of all the function's code deployments. You can use the query params to filter your results. - Parameters ---------- function_id : str @@ -413,7 +406,6 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e Use the "command" param to set the entrypoint used to execute your code. - Parameters ---------- function_id : str @@ -471,7 +463,6 @@ def create_duplicate_deployment(self, function_id: str, deployment_id: str, buil """ Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - Parameters ---------- function_id : str @@ -515,7 +506,6 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. - Parameters ---------- function_id : str @@ -577,7 +567,6 @@ def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, refer This endpoint lets you create deployment from a branch, commit, or a tag. - Parameters ---------- function_id : str @@ -625,7 +614,6 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] """ Get a function deployment by its unique ID. - Parameters ---------- function_id : str @@ -663,7 +651,6 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A """ Delete a code deployment by its unique ID. - Parameters ---------- function_id : str @@ -702,7 +689,6 @@ def get_deployment_download(self, function_id: str, deployment_id: str, type: De """ Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - Parameters ---------- function_id : str @@ -743,7 +729,6 @@ def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict """ Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - Parameters ---------- function_id : str @@ -782,7 +767,6 @@ def list_executions(self, function_id: str, queries: List[str] = None) -> Dict[s """ Get a list of all the current user function execution logs. You can use the query params to filter your results. - Parameters ---------- function_id : str @@ -817,7 +801,6 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No """ Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. - Parameters ---------- function_id : str @@ -868,7 +851,6 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Get a function execution log by its unique ID. - Parameters ---------- function_id : str @@ -906,7 +888,6 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any """ Delete a function execution by its unique ID. - Parameters ---------- function_id : str @@ -945,7 +926,6 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific function. - Parameters ---------- function_id : str @@ -977,7 +957,6 @@ def create_variable(self, function_id: str, key: str, value: str, secret: bool = """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. - Parameters ---------- function_id : str @@ -1025,7 +1004,6 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. - Parameters ---------- function_id : str @@ -1063,7 +1041,6 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s """ Update variable by its unique ID. - Parameters ---------- function_id : str @@ -1114,7 +1091,6 @@ def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. - Parameters ---------- function_id : str diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 69ad4e0..22ca3aa 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -11,7 +11,6 @@ def query(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. - Parameters ---------- query : dict @@ -45,7 +44,6 @@ def mutation(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. - Parameters ---------- query : dict diff --git a/appwrite/services/health.py b/appwrite/services/health.py index 665fd1e..dd1d183 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -75,7 +75,6 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: """ Get the SSL certificate for a domain - Parameters ---------- domain : str @@ -146,7 +145,6 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -175,7 +173,6 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -204,7 +201,6 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict """ Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- name : str @@ -236,7 +232,6 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -266,7 +261,6 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] Returns the amount of failed jobs in a given queue. - Parameters ---------- name : Name @@ -301,7 +295,6 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -330,7 +323,6 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of logs that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -359,7 +351,6 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of mails that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -388,7 +379,6 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of messages that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -417,7 +407,6 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -446,7 +435,6 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. - Parameters ---------- threshold : float @@ -475,7 +463,6 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float @@ -504,7 +491,6 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. - Parameters ---------- threshold : float diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 153a1f7..639a820 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -13,7 +13,6 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s """ Get a list of all messages from the current Appwrite project. - Parameters ---------- queries : List[str] @@ -45,7 +44,6 @@ def create_email(self, message_id: str, subject: str, content: str, topics: List """ Create a new email message. - Parameters ---------- message_id : str @@ -118,7 +116,6 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - Parameters ---------- message_id : str @@ -184,7 +181,6 @@ def create_push(self, message_id: str, title: str = None, body: str = None, topi """ Create a new push notification. - Parameters ---------- message_id : str @@ -272,7 +268,6 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - Parameters ---------- message_id : str @@ -359,7 +354,6 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us """ Create a new SMS message. - Parameters ---------- message_id : str @@ -414,7 +408,6 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - Parameters ---------- message_id : str @@ -466,7 +459,6 @@ def get_message(self, message_id: str) -> Dict[str, Any]: Get a message by its unique ID. - Parameters ---------- message_id : str @@ -498,7 +490,6 @@ def delete(self, message_id: str) -> Dict[str, Any]: """ Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. - Parameters ---------- message_id : str @@ -531,7 +522,6 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ """ Get the message activity logs listed by its unique ID. - Parameters ---------- message_id : str @@ -566,7 +556,6 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, """ Get a list of the targets associated with a message. - Parameters ---------- message_id : str @@ -601,7 +590,6 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ """ Get a list of all providers from the current Appwrite project. - Parameters ---------- queries : List[str] @@ -633,7 +621,6 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None """ Create a new Apple Push Notification service provider. - Parameters ---------- provider_id : str @@ -690,7 +677,6 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Apple Push Notification service provider by its unique ID. - Parameters ---------- provider_id : str @@ -744,7 +730,6 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: """ Create a new Firebase Cloud Messaging provider. - Parameters ---------- provider_id : str @@ -789,7 +774,6 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Firebase Cloud Messaging provider by its unique ID. - Parameters ---------- provider_id : str @@ -831,7 +815,6 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No """ Create a new Mailgun provider. - Parameters ---------- provider_id : str @@ -894,7 +877,6 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s """ Update a Mailgun provider by its unique ID. - Parameters ---------- provider_id : str @@ -954,7 +936,6 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = """ Create a new MSG91 provider. - Parameters ---------- provider_id : str @@ -1005,7 +986,6 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo """ Update a MSG91 provider by its unique ID. - Parameters ---------- provider_id : str @@ -1053,7 +1033,6 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N """ Create a new Sendgrid provider. - Parameters ---------- provider_id : str @@ -1110,7 +1089,6 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: """ Update a Sendgrid provider by its unique ID. - Parameters ---------- provider_id : str @@ -1164,7 +1142,6 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo """ Create a new SMTP provider. - Parameters ---------- provider_id : str @@ -1242,7 +1219,6 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N """ Update a SMTP provider by its unique ID. - Parameters ---------- provider_id : str @@ -1314,7 +1290,6 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non """ Create a new Telesign provider. - Parameters ---------- provider_id : str @@ -1365,7 +1340,6 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: """ Update a Telesign provider by its unique ID. - Parameters ---------- provider_id : str @@ -1413,7 +1387,6 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No """ Create a new Textmagic provider. - Parameters ---------- provider_id : str @@ -1464,7 +1437,6 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: """ Update a Textmagic provider by its unique ID. - Parameters ---------- provider_id : str @@ -1512,7 +1484,6 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Twilio provider. - Parameters ---------- provider_id : str @@ -1563,7 +1534,6 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Twilio provider by its unique ID. - Parameters ---------- provider_id : str @@ -1611,7 +1581,6 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Vonage provider. - Parameters ---------- provider_id : str @@ -1662,7 +1631,6 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Vonage provider by its unique ID. - Parameters ---------- provider_id : str @@ -1711,7 +1679,6 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: Get a provider by its unique ID. - Parameters ---------- provider_id : str @@ -1743,7 +1710,6 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. - Parameters ---------- provider_id : str @@ -1776,7 +1742,6 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic """ Get the provider activity logs listed by its unique ID. - Parameters ---------- provider_id : str @@ -1811,7 +1776,6 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> """ Get the subscriber activity logs listed by its unique ID. - Parameters ---------- subscriber_id : str @@ -1846,7 +1810,6 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str """ Get a list of all topics from the current Appwrite project. - Parameters ---------- queries : List[str] @@ -1878,7 +1841,6 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> """ Create a new topic. - Parameters ---------- topic_id : str @@ -1921,7 +1883,6 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: Get a topic by its unique ID. - Parameters ---------- topic_id : str @@ -1954,7 +1915,6 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N Update a topic by its unique ID. - Parameters ---------- topic_id : str @@ -1993,7 +1953,6 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. - Parameters ---------- topic_id : str @@ -2026,7 +1985,6 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, """ Get the topic activity logs listed by its unique ID. - Parameters ---------- topic_id : str @@ -2061,7 +2019,6 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str """ Get a list of all subscribers from the current Appwrite project. - Parameters ---------- topic_id : str @@ -2099,7 +2056,6 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) - """ Create a new subscriber. - Parameters ---------- topic_id : str @@ -2145,7 +2101,6 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: Get a subscriber by its unique ID. - Parameters ---------- topic_id : str @@ -2183,7 +2138,6 @@ def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any] """ Delete a subscriber by its unique ID. - Parameters ---------- topic_id : str diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index 857cabe..bcb7597 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -17,7 +17,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's sites. You can use the query params to filter your results. - Parameters ---------- queries : List[str] @@ -49,7 +48,6 @@ def create(self, site_id: str, name: str, framework: Framework, build_runtime: B """ Create a new site. - Parameters ---------- site_id : str @@ -184,7 +182,6 @@ def get(self, site_id: str) -> Dict[str, Any]: """ Get a site by its unique ID. - Parameters ---------- site_id : str @@ -216,7 +213,6 @@ def update(self, site_id: str, name: str, framework: Framework, enabled: bool = """ Update site by its unique ID. - Parameters ---------- site_id : str @@ -306,7 +302,6 @@ def delete(self, site_id: str) -> Dict[str, Any]: """ Delete a site by its unique ID. - Parameters ---------- site_id : str @@ -339,7 +334,6 @@ def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, """ Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. - Parameters ---------- site_id : str @@ -378,7 +372,6 @@ def list_deployments(self, site_id: str, queries: List[str] = None, search: str """ Get a list of all the site's code deployments. You can use the query params to filter your results. - Parameters ---------- site_id : str @@ -416,7 +409,6 @@ def create_deployment(self, site_id: str, code: InputFile, activate: bool, insta """ Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. - Parameters ---------- site_id : str @@ -477,7 +469,6 @@ def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[ """ Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - Parameters ---------- site_id : str @@ -518,7 +509,6 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. - Parameters ---------- site_id : str @@ -580,7 +570,6 @@ def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference This endpoint lets you create deployment from a branch, commit, or a tag. - Parameters ---------- site_id : str @@ -628,7 +617,6 @@ def get_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a site deployment by its unique ID. - Parameters ---------- site_id : str @@ -666,7 +654,6 @@ def delete_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Delete a site deployment by its unique ID. - Parameters ---------- site_id : str @@ -705,7 +692,6 @@ def get_deployment_download(self, site_id: str, deployment_id: str, type: Deploy """ Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - Parameters ---------- site_id : str @@ -746,7 +732,6 @@ def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str """ Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - Parameters ---------- site_id : str @@ -785,7 +770,6 @@ def list_logs(self, site_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all site logs. You can use the query params to filter your results. - Parameters ---------- site_id : str @@ -820,7 +804,6 @@ def get_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Get a site request log by its unique ID. - Parameters ---------- site_id : str @@ -858,7 +841,6 @@ def delete_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Delete a site log by its unique ID. - Parameters ---------- site_id : str @@ -897,7 +879,6 @@ def list_variables(self, site_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific site. - Parameters ---------- site_id : str @@ -929,7 +910,6 @@ def create_variable(self, site_id: str, key: str, value: str, secret: bool = Non """ Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. - Parameters ---------- site_id : str @@ -977,7 +957,6 @@ def get_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. - Parameters ---------- site_id : str @@ -1015,7 +994,6 @@ def update_variable(self, site_id: str, variable_id: str, key: str, value: str = """ Update variable by its unique ID. - Parameters ---------- site_id : str @@ -1066,7 +1044,6 @@ def delete_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. - Parameters ---------- site_id : str diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index e970187..22198eb 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -15,7 +15,6 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st """ Get a list of all the storage buckets. You can use the query params to filter your results. - Parameters ---------- queries : List[str] @@ -47,7 +46,6 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Create a new storage bucket. - Parameters ---------- bucket_id : str @@ -110,7 +108,6 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. - Parameters ---------- bucket_id : str @@ -142,7 +139,6 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Update a storage bucket by its unique ID. - Parameters ---------- bucket_id : str @@ -205,7 +201,6 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Delete a storage bucket by its unique ID. - Parameters ---------- bucket_id : str @@ -238,7 +233,6 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No """ Get a list of all the user files. You can use the query params to filter your results. - Parameters ---------- bucket_id : str @@ -283,7 +277,6 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - Parameters ---------- bucket_id : str @@ -339,7 +332,6 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. - Parameters ---------- bucket_id : str @@ -377,7 +369,6 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission """ Update a file by its unique ID. Only users with write permissions have access to update this resource. - Parameters ---------- bucket_id : str @@ -422,7 +413,6 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Delete a file by its unique ID. Only users with write permissions have access to delete this resource. - Parameters ---------- bucket_id : str @@ -461,7 +451,6 @@ def get_file_download(self, bucket_id: str, file_id: str, token: str = None) -> """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - Parameters ---------- bucket_id : str @@ -502,7 +491,6 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. - Parameters ---------- bucket_id : str @@ -576,7 +564,6 @@ def get_file_view(self, bucket_id: str, file_id: str, token: str = None) -> byte """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. - Parameters ---------- bucket_id : str diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 50e0297..808dc2a 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -11,7 +11,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. - Parameters ---------- queries : List[str] @@ -43,7 +42,6 @@ def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, """ Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. - Parameters ---------- team_id : str @@ -85,7 +83,6 @@ def get(self, team_id: str) -> Dict[str, Any]: """ Get a team by its ID. All team members have read access for this resource. - Parameters ---------- team_id : str @@ -117,7 +114,6 @@ def update_name(self, team_id: str, name: str) -> Dict[str, Any]: """ Update the team's name by its unique ID. - Parameters ---------- team_id : str @@ -156,7 +152,6 @@ def delete(self, team_id: str) -> Dict[str, Any]: """ Delete a team using its ID. Only team members with the owner role can delete the team. - Parameters ---------- team_id : str @@ -189,7 +184,6 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. - Parameters ---------- team_id : str @@ -234,7 +228,6 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - Parameters ---------- team_id : str @@ -288,7 +281,6 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. - Parameters ---------- team_id : str @@ -327,7 +319,6 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - Parameters ---------- team_id : str @@ -372,7 +363,6 @@ def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. - Parameters ---------- team_id : str @@ -414,7 +404,6 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st If the request is successful, a session for the user is automatically created. - Parameters ---------- team_id : str @@ -465,7 +454,6 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: """ Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - Parameters ---------- team_id : str @@ -497,7 +485,6 @@ def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: """ Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. - Parameters ---------- team_id : str diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 93ba739..7ec7f4f 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -11,7 +11,6 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ """ List all the tokens created for a specific file or bucket. You can use the query params to filter your results. - Parameters ---------- bucket_id : str @@ -52,7 +51,6 @@ def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> """ Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. - Parameters ---------- bucket_id : str @@ -94,7 +92,6 @@ def get(self, token_id: str) -> Dict[str, Any]: """ Get a token by its unique ID. - Parameters ---------- token_id : str @@ -126,7 +123,6 @@ def update(self, token_id: str, expire: str = None) -> Dict[str, Any]: """ Update a token by its unique ID. Use this endpoint to update a token's expiry date. - Parameters ---------- token_id : str @@ -162,7 +158,6 @@ def delete(self, token_id: str) -> Dict[str, Any]: """ Delete a token by its unique ID. - Parameters ---------- token_id : str diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 1af4e41..694657f 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -14,7 +14,6 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. - Parameters ---------- queries : List[str] @@ -46,7 +45,6 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s """ Create a new user. - Parameters ---------- user_id : str @@ -91,7 +89,6 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -139,7 +136,6 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -187,7 +183,6 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict """ Get identities for all users. - Parameters ---------- queries : List[str] @@ -219,7 +214,6 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. - Parameters ---------- identity_id : str @@ -252,7 +246,6 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N """ Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -300,7 +293,6 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -348,7 +340,6 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s """ Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -426,7 +417,6 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p """ Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -492,7 +482,6 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers """ Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - Parameters ---------- user_id : str @@ -543,7 +532,6 @@ def get(self, user_id: str) -> Dict[str, Any]: """ Get a user by its unique ID. - Parameters ---------- user_id : str @@ -575,7 +563,6 @@ def delete(self, user_id: str) -> Dict[str, Any]: """ Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. - Parameters ---------- user_id : str @@ -608,7 +595,6 @@ def update_email(self, user_id: str, email: str) -> Dict[str, Any]: """ Update the user email by its unique ID. - Parameters ---------- user_id : str @@ -647,7 +633,6 @@ def create_jwt(self, user_id: str, session_id: str = None, duration: float = Non """ Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - Parameters ---------- user_id : str @@ -688,7 +673,6 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. - Parameters ---------- user_id : str @@ -727,7 +711,6 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. - Parameters ---------- user_id : str @@ -762,7 +745,6 @@ def list_memberships(self, user_id: str, queries: List[str] = None, search: str """ Get the user membership list by its unique ID. - Parameters ---------- user_id : str @@ -800,7 +782,6 @@ def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. - Parameters ---------- user_id : str @@ -839,7 +820,6 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic """ Delete an authenticator app. - Parameters ---------- user_id : str @@ -878,7 +858,6 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. - Parameters ---------- user_id : str @@ -910,7 +889,6 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - Parameters ---------- user_id : str @@ -942,7 +920,6 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - Parameters ---------- user_id : str @@ -975,7 +952,6 @@ def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - Parameters ---------- user_id : str @@ -1008,7 +984,6 @@ def update_name(self, user_id: str, name: str) -> Dict[str, Any]: """ Update the user name by its unique ID. - Parameters ---------- user_id : str @@ -1047,7 +1022,6 @@ def update_password(self, user_id: str, password: str) -> Dict[str, Any]: """ Update the user password by its unique ID. - Parameters ---------- user_id : str @@ -1086,7 +1060,6 @@ def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: """ Update the user phone by its unique ID. - Parameters ---------- user_id : str @@ -1125,7 +1098,6 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: """ Get the user preferences by its unique ID. - Parameters ---------- user_id : str @@ -1157,7 +1129,6 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: """ Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - Parameters ---------- user_id : str @@ -1196,7 +1167,6 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. - Parameters ---------- user_id : str @@ -1230,7 +1200,6 @@ def create_session(self, user_id: str) -> Dict[str, Any]: If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. - Parameters ---------- user_id : str @@ -1263,7 +1232,6 @@ def delete_sessions(self, user_id: str) -> Dict[str, Any]: """ Delete all user's sessions by using the user's unique ID. - Parameters ---------- user_id : str @@ -1296,7 +1264,6 @@ def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: """ Delete a user sessions by its unique ID. - Parameters ---------- user_id : str @@ -1335,7 +1302,6 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: """ Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. - Parameters ---------- user_id : str @@ -1374,7 +1340,6 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any """ List the messaging targets that are associated with a user. - Parameters ---------- user_id : str @@ -1409,7 +1374,6 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr """ Create a messaging target. - Parameters ---------- user_id : str @@ -1466,7 +1430,6 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Get a user's push notification target by ID. - Parameters ---------- user_id : str @@ -1504,7 +1467,6 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr """ Update a messaging target. - Parameters ---------- user_id : str @@ -1552,7 +1514,6 @@ def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. - Parameters ---------- user_id : str @@ -1592,7 +1553,6 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - Parameters ---------- user_id : str @@ -1631,7 +1591,6 @@ def update_email_verification(self, user_id: str, email_verification: bool) -> D """ Update the user email verification status by its unique ID. - Parameters ---------- user_id : str @@ -1670,7 +1629,6 @@ def update_phone_verification(self, user_id: str, phone_verification: bool) -> D """ Update the user phone verification status by its unique ID. - Parameters ---------- user_id : str From ff8807b39c497d04e5f7adb0cb9570fa2dce2471 Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Thu, 24 Jul 2025 10:41:18 +0000 Subject: [PATCH 23/24] chore: changelog --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 510e270..ff63134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,24 @@ * Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service * Add `dart38` and `flutter332` support to runtime models * Add `gif` support to `ImageFormat` enum +* Add `upsertDocument` support to `Databases` service + +## 11.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Remove `search` param from `listExecutions` method + +## 10.0.0 + +* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests + +## 9.0.3 + +* Update sdk to use Numpy-style docstrings From 228f76bae3a010a176556d3991bf3a9e2a401971 Mon Sep 17 00:00:00 2001 From: root <chiragaggarwal5k@gmail.com> Date: Thu, 24 Jul 2025 10:44:24 +0000 Subject: [PATCH 24/24] fix: version --- appwrite/client.py | 4 +-- appwrite/services/account.py | 31 +++++++++++++++++++++ appwrite/services/avatars.py | 7 +++++ appwrite/services/databases.py | 49 ++++++++++++++++++++++++++++++++++ appwrite/services/functions.py | 24 +++++++++++++++++ appwrite/services/graphql.py | 2 ++ appwrite/services/health.py | 14 ++++++++++ appwrite/services/messaging.py | 46 +++++++++++++++++++++++++++++++ appwrite/services/sites.py | 23 ++++++++++++++++ appwrite/services/storage.py | 13 +++++++++ appwrite/services/teams.py | 13 +++++++++ appwrite/services/tokens.py | 5 ++++ appwrite/services/users.py | 42 +++++++++++++++++++++++++++++ setup.py | 4 +-- 14 files changed, 273 insertions(+), 4 deletions(-) diff --git a/appwrite/client.py b/appwrite/client.py index b7ab483..ed4d4b5 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/11.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/11.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '11.0.0', + 'x-sdk-version': '11.1.0', 'X-Appwrite-Response-Format' : '1.7.0', } diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 9dd3c5e..6062ad4 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -35,6 +35,7 @@ def create(self, user_id: str, email: str, password: str, name: str = None) -> D """ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + Parameters ---------- user_id : str @@ -84,6 +85,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + Parameters ---------- email : str @@ -122,6 +124,7 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. + Parameters ---------- queries : List[str] @@ -150,6 +153,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -204,6 +208,7 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. + Parameters ---------- queries : List[str] @@ -232,6 +237,7 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on an account. + Parameters ---------- mfa : bool @@ -264,6 +270,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -296,6 +303,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st """ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -334,6 +342,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. + Parameters ---------- type : AuthenticatorType @@ -366,6 +375,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: """ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + Parameters ---------- factor : AuthenticationFactor @@ -398,6 +408,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: """ Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Parameters ---------- challenge_id : str @@ -522,6 +533,7 @@ def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. + Parameters ---------- name : str @@ -554,6 +566,7 @@ def update_password(self, password: str, old_password: str = None) -> Dict[str, """ Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + Parameters ---------- password : str @@ -589,6 +602,7 @@ def update_phone(self, phone: str, password: str) -> Dict[str, Any]: """ Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + Parameters ---------- phone : str @@ -648,6 +662,7 @@ def update_prefs(self, prefs: dict) -> Dict[str, Any]: """ Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- prefs : dict @@ -680,6 +695,7 @@ def create_recovery(self, email: str, url: str) -> Dict[str, Any]: """ Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + Parameters ---------- email : str @@ -720,6 +736,7 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- user_id : str @@ -831,6 +848,7 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- email : str @@ -869,6 +887,7 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -907,6 +926,7 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -945,6 +965,7 @@ def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -983,6 +1004,7 @@ def get_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + Parameters ---------- session_id : str @@ -1014,6 +1036,7 @@ def update_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + Parameters ---------- session_id : str @@ -1046,6 +1069,7 @@ def delete_session(self, session_id: str) -> Dict[str, Any]: """ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + Parameters ---------- session_id : str @@ -1102,6 +1126,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> D A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1146,6 +1171,7 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1194,6 +1220,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- provider : OAuthProvider @@ -1236,6 +1263,7 @@ def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1277,6 +1305,7 @@ def create_verification(self, url: str) -> Dict[str, Any]: Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- url : str @@ -1309,6 +1338,7 @@ def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str @@ -1369,6 +1399,7 @@ def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any] """ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 6ee1d4f..2bd32f7 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -16,6 +16,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Browser @@ -59,6 +60,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : CreditCard @@ -101,6 +103,7 @@ def get_favicon(self, url: str) -> bytes: This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -135,6 +138,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Flag @@ -179,6 +183,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -221,6 +226,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- name : str @@ -259,6 +265,7 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + Parameters ---------- text : str diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index b025e0c..40b7372 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Create a new Database. + Parameters ---------- database_id : str @@ -87,6 +89,7 @@ def get(self, database_id: str) -> Dict[str, Any]: """ Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + Parameters ---------- database_id : str @@ -118,6 +121,7 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Update a database by its unique ID. + Parameters ---------- database_id : str @@ -159,6 +163,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: """ Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + Parameters ---------- database_id : str @@ -191,6 +196,7 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + Parameters ---------- database_id : str @@ -228,6 +234,7 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -281,6 +288,7 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + Parameters ---------- database_id : str @@ -318,6 +326,7 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per """ Update a collection by its unique ID. + Parameters ---------- database_id : str @@ -371,6 +380,7 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- database_id : str @@ -409,6 +419,7 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st """ List attributes in the collection. + Parameters ---------- database_id : str @@ -450,6 +461,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st Create a boolean attribute. + Parameters ---------- database_id : str @@ -506,6 +518,7 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Update a boolean attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -562,6 +575,7 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Create a date time attribute according to the ISO 8601 standard. + Parameters ---------- database_id : str @@ -618,6 +632,7 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Update a date time attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -675,6 +690,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, Create an email attribute. + Parameters ---------- database_id : str @@ -732,6 +748,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, Update an email attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -789,6 +806,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + Parameters ---------- database_id : str @@ -852,6 +870,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, Update an enum attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -915,6 +934,7 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, Create a float attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -978,6 +998,7 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, Update a float attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1041,6 +1062,7 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st Create an integer attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -1104,6 +1126,7 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st Update an integer attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1167,6 +1190,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re Create IP address attribute. + Parameters ---------- database_id : str @@ -1224,6 +1248,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re Update an ip attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1281,6 +1306,7 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1344,6 +1370,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str Create a string attribute. + Parameters ---------- database_id : str @@ -1410,6 +1437,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str Update a string attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1470,6 +1498,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r Create a URL attribute. + Parameters ---------- database_id : str @@ -1527,6 +1556,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r Update an url attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1583,6 +1613,7 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ """ Get attribute by ID. + Parameters ---------- database_id : str @@ -1626,6 +1657,7 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Di """ Deletes an attribute. + Parameters ---------- database_id : str @@ -1671,6 +1703,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1721,6 +1754,7 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + Parameters ---------- database_id : str @@ -1761,6 +1795,7 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1816,6 +1851,7 @@ def create_documents(self, database_id: str, collection_id: str, documents: List Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1863,6 +1899,7 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1909,6 +1946,7 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + Parameters ---------- database_id : str @@ -1955,6 +1993,7 @@ def delete_documents(self, database_id: str, collection_id: str, queries: List[s Bulk delete documents using queries, if no queries are passed then all documents are deleted. + Parameters ---------- database_id : str @@ -1996,6 +2035,7 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + Parameters ---------- database_id : str @@ -2044,6 +2084,7 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -2097,6 +2138,7 @@ def update_document(self, database_id: str, collection_id: str, document_id: str """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + Parameters ---------- database_id : str @@ -2147,6 +2189,7 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str """ Delete a document by its unique ID. + Parameters ---------- database_id : str @@ -2191,6 +2234,7 @@ def decrement_document_attribute(self, database_id: str, collection_id: str, doc """ Decrement a specific attribute of a document by a given value. + Parameters ---------- database_id : str @@ -2247,6 +2291,7 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc """ Increment a specific attribute of a document by a given value. + Parameters ---------- database_id : str @@ -2303,6 +2348,7 @@ def list_indexes(self, database_id: str, collection_id: str, queries: List[str] """ List indexes in the collection. + Parameters ---------- database_id : str @@ -2344,6 +2390,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. + Parameters ---------- database_id : str @@ -2406,6 +2453,7 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, """ Get index by ID. + Parameters ---------- database_id : str @@ -2449,6 +2497,7 @@ def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[s """ Delete an index. + Parameters ---------- database_id : str diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 9dce425..3dd2459 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -16,6 +16,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -47,6 +48,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + Parameters ---------- function_id : str @@ -178,6 +180,7 @@ def get(self, function_id: str) -> Dict[str, Any]: """ Get a function by its unique ID. + Parameters ---------- function_id : str @@ -209,6 +212,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: """ Update function by its unique ID. + Parameters ---------- function_id : str @@ -295,6 +299,7 @@ def delete(self, function_id: str) -> Dict[str, Any]: """ Delete a function by its unique ID. + Parameters ---------- function_id : str @@ -327,6 +332,7 @@ def update_function_deployment(self, function_id: str, deployment_id: str) -> Di """ Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + Parameters ---------- function_id : str @@ -365,6 +371,7 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: """ Get a list of all the function's code deployments. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -406,6 +413,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e Use the "command" param to set the entrypoint used to execute your code. + Parameters ---------- function_id : str @@ -463,6 +471,7 @@ def create_duplicate_deployment(self, function_id: str, deployment_id: str, buil """ Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- function_id : str @@ -506,6 +515,7 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + Parameters ---------- function_id : str @@ -567,6 +577,7 @@ def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, refer This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- function_id : str @@ -614,6 +625,7 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] """ Get a function deployment by its unique ID. + Parameters ---------- function_id : str @@ -651,6 +663,7 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A """ Delete a code deployment by its unique ID. + Parameters ---------- function_id : str @@ -689,6 +702,7 @@ def get_deployment_download(self, function_id: str, deployment_id: str, type: De """ Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- function_id : str @@ -729,6 +743,7 @@ def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict """ Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- function_id : str @@ -767,6 +782,7 @@ def list_executions(self, function_id: str, queries: List[str] = None) -> Dict[s """ Get a list of all the current user function execution logs. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -801,6 +817,7 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No """ Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + Parameters ---------- function_id : str @@ -851,6 +868,7 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Get a function execution log by its unique ID. + Parameters ---------- function_id : str @@ -888,6 +906,7 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any """ Delete a function execution by its unique ID. + Parameters ---------- function_id : str @@ -926,6 +945,7 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific function. + Parameters ---------- function_id : str @@ -957,6 +977,7 @@ def create_variable(self, function_id: str, key: str, value: str, secret: bool = """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + Parameters ---------- function_id : str @@ -1004,6 +1025,7 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- function_id : str @@ -1041,6 +1063,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s """ Update variable by its unique ID. + Parameters ---------- function_id : str @@ -1091,6 +1114,7 @@ def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- function_id : str diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 22ca3aa..69ad4e0 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -11,6 +11,7 @@ def query(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict @@ -44,6 +45,7 @@ def mutation(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict diff --git a/appwrite/services/health.py b/appwrite/services/health.py index dd1d183..665fd1e 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -75,6 +75,7 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: """ Get the SSL certificate for a domain + Parameters ---------- domain : str @@ -145,6 +146,7 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -173,6 +175,7 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -201,6 +204,7 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict """ Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- name : str @@ -232,6 +236,7 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -261,6 +266,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] Returns the amount of failed jobs in a given queue. + Parameters ---------- name : Name @@ -295,6 +301,7 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -323,6 +330,7 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -351,6 +359,7 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -379,6 +388,7 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -407,6 +417,7 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -435,6 +446,7 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + Parameters ---------- threshold : float @@ -463,6 +475,7 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -491,6 +504,7 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 639a820..153a1f7 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -13,6 +13,7 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s """ Get a list of all messages from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -44,6 +45,7 @@ def create_email(self, message_id: str, subject: str, content: str, topics: List """ Create a new email message. + Parameters ---------- message_id : str @@ -116,6 +118,7 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -181,6 +184,7 @@ def create_push(self, message_id: str, title: str = None, body: str = None, topi """ Create a new push notification. + Parameters ---------- message_id : str @@ -268,6 +272,7 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -354,6 +359,7 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us """ Create a new SMS message. + Parameters ---------- message_id : str @@ -408,6 +414,7 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -459,6 +466,7 @@ def get_message(self, message_id: str) -> Dict[str, Any]: Get a message by its unique ID. + Parameters ---------- message_id : str @@ -490,6 +498,7 @@ def delete(self, message_id: str) -> Dict[str, Any]: """ Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + Parameters ---------- message_id : str @@ -522,6 +531,7 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ """ Get the message activity logs listed by its unique ID. + Parameters ---------- message_id : str @@ -556,6 +566,7 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, """ Get a list of the targets associated with a message. + Parameters ---------- message_id : str @@ -590,6 +601,7 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ """ Get a list of all providers from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -621,6 +633,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None """ Create a new Apple Push Notification service provider. + Parameters ---------- provider_id : str @@ -677,6 +690,7 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Apple Push Notification service provider by its unique ID. + Parameters ---------- provider_id : str @@ -730,6 +744,7 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: """ Create a new Firebase Cloud Messaging provider. + Parameters ---------- provider_id : str @@ -774,6 +789,7 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Firebase Cloud Messaging provider by its unique ID. + Parameters ---------- provider_id : str @@ -815,6 +831,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No """ Create a new Mailgun provider. + Parameters ---------- provider_id : str @@ -877,6 +894,7 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s """ Update a Mailgun provider by its unique ID. + Parameters ---------- provider_id : str @@ -936,6 +954,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = """ Create a new MSG91 provider. + Parameters ---------- provider_id : str @@ -986,6 +1005,7 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo """ Update a MSG91 provider by its unique ID. + Parameters ---------- provider_id : str @@ -1033,6 +1053,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N """ Create a new Sendgrid provider. + Parameters ---------- provider_id : str @@ -1089,6 +1110,7 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: """ Update a Sendgrid provider by its unique ID. + Parameters ---------- provider_id : str @@ -1142,6 +1164,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo """ Create a new SMTP provider. + Parameters ---------- provider_id : str @@ -1219,6 +1242,7 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N """ Update a SMTP provider by its unique ID. + Parameters ---------- provider_id : str @@ -1290,6 +1314,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non """ Create a new Telesign provider. + Parameters ---------- provider_id : str @@ -1340,6 +1365,7 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: """ Update a Telesign provider by its unique ID. + Parameters ---------- provider_id : str @@ -1387,6 +1413,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No """ Create a new Textmagic provider. + Parameters ---------- provider_id : str @@ -1437,6 +1464,7 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: """ Update a Textmagic provider by its unique ID. + Parameters ---------- provider_id : str @@ -1484,6 +1512,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Twilio provider. + Parameters ---------- provider_id : str @@ -1534,6 +1563,7 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Twilio provider by its unique ID. + Parameters ---------- provider_id : str @@ -1581,6 +1611,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Vonage provider. + Parameters ---------- provider_id : str @@ -1631,6 +1662,7 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Vonage provider by its unique ID. + Parameters ---------- provider_id : str @@ -1679,6 +1711,7 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: Get a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1710,6 +1743,7 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1742,6 +1776,7 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic """ Get the provider activity logs listed by its unique ID. + Parameters ---------- provider_id : str @@ -1776,6 +1811,7 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> """ Get the subscriber activity logs listed by its unique ID. + Parameters ---------- subscriber_id : str @@ -1810,6 +1846,7 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str """ Get a list of all topics from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -1841,6 +1878,7 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> """ Create a new topic. + Parameters ---------- topic_id : str @@ -1883,6 +1921,7 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: Get a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1915,6 +1954,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N Update a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1953,6 +1993,7 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1985,6 +2026,7 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, """ Get the topic activity logs listed by its unique ID. + Parameters ---------- topic_id : str @@ -2019,6 +2061,7 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str """ Get a list of all subscribers from the current Appwrite project. + Parameters ---------- topic_id : str @@ -2056,6 +2099,7 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) - """ Create a new subscriber. + Parameters ---------- topic_id : str @@ -2101,6 +2145,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: Get a subscriber by its unique ID. + Parameters ---------- topic_id : str @@ -2138,6 +2183,7 @@ def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any] """ Delete a subscriber by its unique ID. + Parameters ---------- topic_id : str diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index bcb7597..857cabe 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -17,6 +17,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's sites. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -48,6 +49,7 @@ def create(self, site_id: str, name: str, framework: Framework, build_runtime: B """ Create a new site. + Parameters ---------- site_id : str @@ -182,6 +184,7 @@ def get(self, site_id: str) -> Dict[str, Any]: """ Get a site by its unique ID. + Parameters ---------- site_id : str @@ -213,6 +216,7 @@ def update(self, site_id: str, name: str, framework: Framework, enabled: bool = """ Update site by its unique ID. + Parameters ---------- site_id : str @@ -302,6 +306,7 @@ def delete(self, site_id: str) -> Dict[str, Any]: """ Delete a site by its unique ID. + Parameters ---------- site_id : str @@ -334,6 +339,7 @@ def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, """ Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + Parameters ---------- site_id : str @@ -372,6 +378,7 @@ def list_deployments(self, site_id: str, queries: List[str] = None, search: str """ Get a list of all the site's code deployments. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -409,6 +416,7 @@ def create_deployment(self, site_id: str, code: InputFile, activate: bool, insta """ Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + Parameters ---------- site_id : str @@ -469,6 +477,7 @@ def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[ """ Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- site_id : str @@ -509,6 +518,7 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + Parameters ---------- site_id : str @@ -570,6 +580,7 @@ def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- site_id : str @@ -617,6 +628,7 @@ def get_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -654,6 +666,7 @@ def delete_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Delete a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -692,6 +705,7 @@ def get_deployment_download(self, site_id: str, deployment_id: str, type: Deploy """ Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- site_id : str @@ -732,6 +746,7 @@ def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str """ Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- site_id : str @@ -770,6 +785,7 @@ def list_logs(self, site_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all site logs. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -804,6 +820,7 @@ def get_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Get a site request log by its unique ID. + Parameters ---------- site_id : str @@ -841,6 +858,7 @@ def delete_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Delete a site log by its unique ID. + Parameters ---------- site_id : str @@ -879,6 +897,7 @@ def list_variables(self, site_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific site. + Parameters ---------- site_id : str @@ -910,6 +929,7 @@ def create_variable(self, site_id: str, key: str, value: str, secret: bool = Non """ Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + Parameters ---------- site_id : str @@ -957,6 +977,7 @@ def get_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- site_id : str @@ -994,6 +1015,7 @@ def update_variable(self, site_id: str, variable_id: str, key: str, value: str = """ Update variable by its unique ID. + Parameters ---------- site_id : str @@ -1044,6 +1066,7 @@ def delete_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- site_id : str diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 22198eb..e970187 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -15,6 +15,7 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st """ Get a list of all the storage buckets. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Create a new storage bucket. + Parameters ---------- bucket_id : str @@ -108,6 +110,7 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + Parameters ---------- bucket_id : str @@ -139,6 +142,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Update a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -201,6 +205,7 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Delete a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -233,6 +238,7 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No """ Get a list of all the user files. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -277,6 +283,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + Parameters ---------- bucket_id : str @@ -332,6 +339,7 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + Parameters ---------- bucket_id : str @@ -369,6 +377,7 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission """ Update a file by its unique ID. Only users with write permissions have access to update this resource. + Parameters ---------- bucket_id : str @@ -413,6 +422,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- bucket_id : str @@ -451,6 +461,7 @@ def get_file_download(self, bucket_id: str, file_id: str, token: str = None) -> """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- bucket_id : str @@ -491,6 +502,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + Parameters ---------- bucket_id : str @@ -564,6 +576,7 @@ def get_file_view(self, bucket_id: str, file_id: str, token: str = None) -> byte """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + Parameters ---------- bucket_id : str diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 808dc2a..50e0297 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -11,6 +11,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + Parameters ---------- queries : List[str] @@ -42,6 +43,7 @@ def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, """ Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + Parameters ---------- team_id : str @@ -83,6 +85,7 @@ def get(self, team_id: str) -> Dict[str, Any]: """ Get a team by its ID. All team members have read access for this resource. + Parameters ---------- team_id : str @@ -114,6 +117,7 @@ def update_name(self, team_id: str, name: str) -> Dict[str, Any]: """ Update the team's name by its unique ID. + Parameters ---------- team_id : str @@ -152,6 +156,7 @@ def delete(self, team_id: str) -> Dict[str, Any]: """ Delete a team using its ID. Only team members with the owner role can delete the team. + Parameters ---------- team_id : str @@ -184,6 +189,7 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -228,6 +234,7 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + Parameters ---------- team_id : str @@ -281,6 +288,7 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -319,6 +327,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + Parameters ---------- team_id : str @@ -363,6 +372,7 @@ def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + Parameters ---------- team_id : str @@ -404,6 +414,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st If the request is successful, a session for the user is automatically created. + Parameters ---------- team_id : str @@ -454,6 +465,7 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: """ Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + Parameters ---------- team_id : str @@ -485,6 +497,7 @@ def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: """ Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + Parameters ---------- team_id : str diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 7ec7f4f..93ba739 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -11,6 +11,7 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ """ List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -51,6 +52,7 @@ def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> """ Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + Parameters ---------- bucket_id : str @@ -92,6 +94,7 @@ def get(self, token_id: str) -> Dict[str, Any]: """ Get a token by its unique ID. + Parameters ---------- token_id : str @@ -123,6 +126,7 @@ def update(self, token_id: str, expire: str = None) -> Dict[str, Any]: """ Update a token by its unique ID. Use this endpoint to update a token's expiry date. + Parameters ---------- token_id : str @@ -158,6 +162,7 @@ def delete(self, token_id: str) -> Dict[str, Any]: """ Delete a token by its unique ID. + Parameters ---------- token_id : str diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 694657f..1af4e41 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -45,6 +46,7 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s """ Create a new user. + Parameters ---------- user_id : str @@ -89,6 +91,7 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -136,6 +139,7 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -183,6 +187,7 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict """ Get identities for all users. + Parameters ---------- queries : List[str] @@ -214,6 +219,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -246,6 +252,7 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N """ Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -293,6 +300,7 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -340,6 +348,7 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s """ Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -417,6 +426,7 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p """ Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -482,6 +492,7 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers """ Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -532,6 +543,7 @@ def get(self, user_id: str) -> Dict[str, Any]: """ Get a user by its unique ID. + Parameters ---------- user_id : str @@ -563,6 +575,7 @@ def delete(self, user_id: str) -> Dict[str, Any]: """ Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + Parameters ---------- user_id : str @@ -595,6 +608,7 @@ def update_email(self, user_id: str, email: str) -> Dict[str, Any]: """ Update the user email by its unique ID. + Parameters ---------- user_id : str @@ -633,6 +647,7 @@ def create_jwt(self, user_id: str, session_id: str = None, duration: float = Non """ Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + Parameters ---------- user_id : str @@ -673,6 +688,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + Parameters ---------- user_id : str @@ -711,6 +727,7 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. + Parameters ---------- user_id : str @@ -745,6 +762,7 @@ def list_memberships(self, user_id: str, queries: List[str] = None, search: str """ Get the user membership list by its unique ID. + Parameters ---------- user_id : str @@ -782,6 +800,7 @@ def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. + Parameters ---------- user_id : str @@ -820,6 +839,7 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic """ Delete an authenticator app. + Parameters ---------- user_id : str @@ -858,6 +878,7 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. + Parameters ---------- user_id : str @@ -889,6 +910,7 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -920,6 +942,7 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -952,6 +975,7 @@ def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + Parameters ---------- user_id : str @@ -984,6 +1008,7 @@ def update_name(self, user_id: str, name: str) -> Dict[str, Any]: """ Update the user name by its unique ID. + Parameters ---------- user_id : str @@ -1022,6 +1047,7 @@ def update_password(self, user_id: str, password: str) -> Dict[str, Any]: """ Update the user password by its unique ID. + Parameters ---------- user_id : str @@ -1060,6 +1086,7 @@ def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: """ Update the user phone by its unique ID. + Parameters ---------- user_id : str @@ -1098,6 +1125,7 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: """ Get the user preferences by its unique ID. + Parameters ---------- user_id : str @@ -1129,6 +1157,7 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: """ Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- user_id : str @@ -1167,6 +1196,7 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. + Parameters ---------- user_id : str @@ -1200,6 +1230,7 @@ def create_session(self, user_id: str) -> Dict[str, Any]: If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + Parameters ---------- user_id : str @@ -1232,6 +1263,7 @@ def delete_sessions(self, user_id: str) -> Dict[str, Any]: """ Delete all user's sessions by using the user's unique ID. + Parameters ---------- user_id : str @@ -1264,6 +1296,7 @@ def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: """ Delete a user sessions by its unique ID. + Parameters ---------- user_id : str @@ -1302,6 +1335,7 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: """ Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + Parameters ---------- user_id : str @@ -1340,6 +1374,7 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any """ List the messaging targets that are associated with a user. + Parameters ---------- user_id : str @@ -1374,6 +1409,7 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr """ Create a messaging target. + Parameters ---------- user_id : str @@ -1430,6 +1466,7 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Get a user's push notification target by ID. + Parameters ---------- user_id : str @@ -1467,6 +1504,7 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr """ Update a messaging target. + Parameters ---------- user_id : str @@ -1514,6 +1552,7 @@ def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. + Parameters ---------- user_id : str @@ -1553,6 +1592,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + Parameters ---------- user_id : str @@ -1591,6 +1631,7 @@ def update_email_verification(self, user_id: str, email_verification: bool) -> D """ Update the user email verification status by its unique ID. + Parameters ---------- user_id : str @@ -1629,6 +1670,7 @@ def update_phone_verification(self, user_id: str, phone_verification: bool) -> D """ Update the user phone verification status by its unique ID. + Parameters ---------- user_id : str diff --git a/setup.py b/setup.py index 5c6270f..18c78cc 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '11.0.0', + version = '11.1.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/11.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/11.1.0.tar.gz', install_requires=[ 'requests', ],