From df716591048dba4beac7b06b0d955cefbaa44483 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:29:05 +0000 Subject: [PATCH 1/6] updates: sync as per latest cloud specs --- CHANGELOG.md | 12 - LICENSE | 2 +- README.md | 6 +- appwrite/client.py | 4 +- appwrite/encoders/value_class_encoder.py | 8 +- appwrite/enums/build_runtime.py | 3 - appwrite/enums/name.py | 1 + appwrite/enums/o_auth_provider.py | 3 + appwrite/enums/output.py | 10 - appwrite/enums/runtime.py | 3 - appwrite/operator.py | 2 - appwrite/query.py | 1 - appwrite/service.py | 1 - appwrite/services/account.py | 12 +- appwrite/services/avatars.py | 6 +- appwrite/services/backups.py | 440 ++++++++++++++++++ appwrite/services/databases.py | 10 +- appwrite/services/health.py | 145 ++++++ appwrite/services/organizations.py | 73 +++ appwrite/services/storage.py | 19 +- docs/examples/account/create-jwt.md | 4 +- docs/examples/avatars/get-screenshot.md | 4 +- docs/examples/backups/create-archive.md | 14 + docs/examples/backups/create-policy.md | 19 + docs/examples/backups/create-restoration.md | 16 + docs/examples/backups/delete-archive.md | 13 + docs/examples/backups/delete-policy.md | 13 + docs/examples/backups/get-archive.md | 13 + docs/examples/backups/get-policy.md | 13 + docs/examples/backups/get-restoration.md | 13 + docs/examples/backups/list-archives.md | 13 + docs/examples/backups/list-policies.md | 13 + docs/examples/backups/list-restorations.md | 13 + docs/examples/backups/update-policy.md | 17 + docs/examples/databases/update-document.md | 8 +- docs/examples/databases/update-documents.md | 8 +- docs/examples/databases/upsert-document.md | 8 +- .../get-queue-billing-project-aggregation.md | 13 + .../get-queue-billing-team-aggregation.md | 13 + .../health/get-queue-priority-builds.md | 13 + .../health/get-queue-region-manager.md | 13 + docs/examples/health/get-queue-threats.md | 13 + docs/examples/organizations/delete.md | 13 + .../estimation-delete-organization.md | 13 + docs/examples/tablesdb/update-row.md | 8 +- docs/examples/tablesdb/update-rows.md | 8 +- docs/examples/tablesdb/upsert-row.md | 8 +- setup.py | 6 +- 48 files changed, 1008 insertions(+), 76 deletions(-) delete mode 100644 appwrite/enums/output.py create mode 100644 appwrite/services/backups.py create mode 100644 appwrite/services/organizations.py create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md create mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md create mode 100644 docs/examples/health/get-queue-priority-builds.md create mode 100644 docs/examples/health/get-queue-region-manager.md create mode 100644 docs/examples/health/get-queue-threats.md create mode 100644 docs/examples/organizations/delete.md create mode 100644 docs/examples/organizations/estimation-delete-organization.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 160d5aa..31396fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,5 @@ # Change Log -## 14.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 14.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `create_template_deployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters -* Add `get_screenshot` method to `Avatars` service -* Add `Theme`, `Timezone` and `Output` enums -* Add support for dart39 and flutter335 runtimes - ## 13.6.1 * Fix passing of `None` to nullable parameters diff --git a/LICENSE b/LICENSE index c1602fc..6f8702b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 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/README.md b/README.md index a2dea19..fa3f8d4 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # 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.8.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) -**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 latest. 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) +Appwrite is an open-source backend as a service server that abstracts and simplifies 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) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) diff --git a/appwrite/client.py b/appwrite/client.py index c6ae723..b4d2231 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -15,11 +15,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/14.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/15.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': '14.1.0', + 'x-sdk-version': '15.0.0', 'X-Appwrite-Response-Format' : '1.8.0', } diff --git a/appwrite/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index cc9db59..148a15b 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -7,7 +7,7 @@ from ..enums.flag import Flag from ..enums.theme import Theme from ..enums.timezone import Timezone -from ..enums.output import Output +from ..enums.image_format import ImageFormat from ..enums.relationship_type import RelationshipType from ..enums.relation_mutate import RelationMutate from ..enums.index_type import IndexType @@ -24,7 +24,6 @@ from ..enums.adapter import Adapter from ..enums.compression import Compression from ..enums.image_gravity import ImageGravity -from ..enums.image_format import ImageFormat from ..enums.password_hash import PasswordHash from ..enums.messaging_provider_type import MessagingProviderType from ..enums.database_type import DatabaseType @@ -64,7 +63,7 @@ def default(self, o): if isinstance(o, Timezone): return o.value - if isinstance(o, Output): + if isinstance(o, ImageFormat): return o.value if isinstance(o, RelationshipType): @@ -115,9 +114,6 @@ def default(self, o): if isinstance(o, ImageGravity): return o.value - if isinstance(o, ImageFormat): - return o.value - if isinstance(o, PasswordHash): return o.value diff --git a/appwrite/enums/build_runtime.py b/appwrite/enums/build_runtime.py index 0b506b9..0d9c3d2 100644 --- a/appwrite/enums/build_runtime.py +++ b/appwrite/enums/build_runtime.py @@ -23,9 +23,6 @@ class BuildRuntime(Enum): 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" diff --git a/appwrite/enums/name.py b/appwrite/enums/name.py index c4b981e..7af7da7 100644 --- a/appwrite/enums/name.py +++ b/appwrite/enums/name.py @@ -11,5 +11,6 @@ class Name(Enum): V1_WEBHOOKS = "v1-webhooks" V1_CERTIFICATES = "v1-certificates" V1_BUILDS = "v1-builds" + V1_SCREENSHOTS = "v1-screenshots" V1_MESSAGING = "v1-messaging" V1_MIGRATIONS = "v1-migrations" diff --git a/appwrite/enums/o_auth_provider.py b/appwrite/enums/o_auth_provider.py index 6c1e6bd..29230a3 100644 --- a/appwrite/enums/o_auth_provider.py +++ b/appwrite/enums/o_auth_provider.py @@ -41,3 +41,6 @@ class OAuthProvider(Enum): ZOHO = "zoho" ZOOM = "zoom" MOCK = "mock" + MOCK_UNVERIFIED = "mock-unverified" + GITHUBIMAGINE = "githubImagine" + GOOGLEIMAGINE = "googleImagine" diff --git a/appwrite/enums/output.py b/appwrite/enums/output.py deleted file mode 100644 index c76e835..0000000 --- a/appwrite/enums/output.py +++ /dev/null @@ -1,10 +0,0 @@ -from enum import Enum - -class Output(Enum): - JPG = "jpg" - JPEG = "jpeg" - PNG = "png" - WEBP = "webp" - HEIC = "heic" - AVIF = "avif" - GIF = "gif" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index 0f0be3c..51c7533 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -23,9 +23,6 @@ class Runtime(Enum): 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" diff --git a/appwrite/operator.py b/appwrite/operator.py index f4ced58..ddec91e 100644 --- a/appwrite/operator.py +++ b/appwrite/operator.py @@ -2,7 +2,6 @@ import math from enum import Enum - class Condition(Enum): EQUAL = "equal" NOT_EQUAL = "notEqual" @@ -14,7 +13,6 @@ class Condition(Enum): IS_NULL = "isNull" IS_NOT_NULL = "isNotNull" - class Operator(): def __init__(self, method, values=None): self.method = method diff --git a/appwrite/query.py b/appwrite/query.py index b989a76..9d3e69c 100644 --- a/appwrite/query.py +++ b/appwrite/query.py @@ -1,6 +1,5 @@ import json - # Inherit from dict to allow for easy serialization class Query(): def __init__(self, method, attribute=None, values=None): diff --git a/appwrite/service.py b/appwrite/service.py index b5b60e6..f5e2adb 100644 --- a/appwrite/service.py +++ b/appwrite/service.py @@ -1,6 +1,5 @@ from .client import Client - class Service: def __init__(self, client: Client): self.client = client diff --git a/appwrite/services/account.py b/appwrite/services/account.py index b7bf1e4..77b3847 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -185,10 +185,15 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def create_jwt(self) -> Dict[str, Any]: + def create_jwt(self, duration: Optional[float] = None) -> 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. + Parameters + ---------- + duration : Optional[float] + Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + Returns ------- Dict[str, Any] @@ -203,6 +208,9 @@ def create_jwt(self) -> Dict[str, Any]: api_path = '/account/jwts' api_params = {} + if duration is not None: + api_params['duration'] = duration + return self.client.call('post', api_path, { 'content-type': 'application/json', }, api_params) @@ -1220,7 +1228,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: Optional[str] = Parameters ---------- provider : OAuthProvider - 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. + 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, githubImagine, googleImagine. success : Optional[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 : Optional[str] diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index db5efeb..e0b5112 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -7,7 +7,7 @@ from ..enums.flag import Flag; from ..enums.theme import Theme; from ..enums.timezone import Timezone; -from ..enums.output import Output; +from ..enums.image_format import ImageFormat; class Avatars(Service): @@ -317,7 +317,7 @@ def get_qr(self, text: str, size: Optional[float] = None, margin: Optional[float return self.client.call('get', api_path, { }, api_params) - def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_width: Optional[float] = None, viewport_height: Optional[float] = None, scale: Optional[float] = None, theme: Optional[Theme] = None, user_agent: Optional[str] = None, fullpage: Optional[bool] = None, locale: Optional[str] = None, timezone: Optional[Timezone] = None, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, touch: Optional[bool] = None, permissions: Optional[List[str]] = None, sleep: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, quality: Optional[float] = None, output: Optional[Output] = None) -> bytes: + def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_width: Optional[float] = None, viewport_height: Optional[float] = None, scale: Optional[float] = None, theme: Optional[Theme] = None, user_agent: Optional[str] = None, fullpage: Optional[bool] = None, locale: Optional[str] = None, timezone: Optional[Timezone] = None, latitude: Optional[float] = None, longitude: Optional[float] = None, accuracy: Optional[float] = None, touch: Optional[bool] = None, permissions: Optional[List[str]] = None, sleep: Optional[float] = None, width: Optional[float] = None, height: Optional[float] = None, quality: Optional[float] = None, output: Optional[ImageFormat] = None) -> bytes: """ Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. @@ -365,7 +365,7 @@ def get_screenshot(self, url: str, headers: Optional[dict] = None, viewport_widt Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). quality : Optional[float] Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - output : Optional[Output] + output : Optional[ImageFormat] Output format type (jpeg, jpg, png, gif and webp). Returns diff --git a/appwrite/services/backups.py b/appwrite/services/backups.py new file mode 100644 index 0000000..8b42edb --- /dev/null +++ b/appwrite/services/backups.py @@ -0,0 +1,440 @@ +from ..service import Service +from typing import List, Dict, Any, Optional +from ..exception import AppwriteException +from appwrite.utils.deprecated import deprecated + +class Backups(Service): + + def __init__(self, client) -> None: + super(Backups, self).__init__(client) + + def list_archives(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: + """ + List all archives for a project. + + Parameters + ---------- + queries : Optional[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 = '/backups/archives' + api_params = {} + + if queries is not None: + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_archive(self, services: List[str], resource_id: Optional[str] = None) -> Dict[str, Any]: + """ + Create a new archive asynchronously for a project. + + Parameters + ---------- + services : List[str] + Array of services to backup + resource_id : Optional[str] + Resource ID. When set, only this single resource will be backed up. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/backups/archives' + api_params = {} + if services is None: + raise AppwriteException('Missing required parameter: "services"') + + + api_params['services'] = services + api_params['resourceId'] = resource_id + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_archive(self, archive_id: str) -> Dict[str, Any]: + """ + Get a backup archive using it's ID. + + Parameters + ---------- + archive_id : str + Archive ID. Choose a custom ID`. 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 = '/backups/archives/{archiveId}' + api_params = {} + if archive_id is None: + raise AppwriteException('Missing required parameter: "archive_id"') + + api_path = api_path.replace('{archiveId}', archive_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def delete_archive(self, archive_id: str) -> Dict[str, Any]: + """ + Delete an existing archive for a project. + + Parameters + ---------- + archive_id : str + Policy 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 = '/backups/archives/{archiveId}' + api_params = {} + if archive_id is None: + raise AppwriteException('Missing required parameter: "archive_id"') + + api_path = api_path.replace('{archiveId}', archive_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_policies(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: + """ + List all policies for a project. + + Parameters + ---------- + queries : Optional[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 = '/backups/policies' + api_params = {} + + if queries is not None: + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def create_policy(self, policy_id: str, services: List[str], retention: float, schedule: str, name: Optional[str] = None, resource_id: Optional[str] = None, enabled: Optional[bool] = None) -> Dict[str, Any]: + """ + Create a new backup policy. + + Parameters + ---------- + policy_id : str + Policy 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. + services : List[str] + Array of services to backup + retention : float + Days to keep backups before deletion + schedule : str + Schedule CRON syntax. + name : Optional[str] + Policy name. Max length: 128 chars. + resource_id : Optional[str] + Resource ID. When set, only this single resource will be backed up. + enabled : Optional[bool] + Is policy enabled? When set to 'disabled', no backups will be taken + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/backups/policies' + api_params = {} + if policy_id is None: + raise AppwriteException('Missing required parameter: "policy_id"') + + if services is None: + raise AppwriteException('Missing required parameter: "services"') + + if retention is None: + raise AppwriteException('Missing required parameter: "retention"') + + if schedule is None: + raise AppwriteException('Missing required parameter: "schedule"') + + + api_params['policyId'] = policy_id + if name is not None: + api_params['name'] = name + api_params['services'] = services + api_params['resourceId'] = resource_id + if enabled is not None: + api_params['enabled'] = enabled + api_params['retention'] = retention + api_params['schedule'] = schedule + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def get_policy(self, policy_id: str) -> Dict[str, Any]: + """ + Get a backup policy using it's ID. + + Parameters + ---------- + policy_id : str + Policy ID. Choose a custom ID`. 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 = '/backups/policies/{policyId}' + api_params = {} + if policy_id is None: + raise AppwriteException('Missing required parameter: "policy_id"') + + api_path = api_path.replace('{policyId}', policy_id) + + + return self.client.call('get', api_path, { + }, api_params) + + def update_policy(self, policy_id: str, name: Optional[str] = None, retention: Optional[float] = None, schedule: Optional[str] = None, enabled: Optional[bool] = None) -> Dict[str, Any]: + """ + Update an existing policy using it's ID. + + Parameters + ---------- + policy_id : str + Policy ID. Choose a custom ID`. 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 : Optional[str] + Policy name. Max length: 128 chars. + retention : Optional[float] + Days to keep backups before deletion + schedule : Optional[str] + Cron expression + enabled : Optional[bool] + Is Backup enabled? When set to 'disabled', No backup will be taken + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/backups/policies/{policyId}' + api_params = {} + if policy_id is None: + raise AppwriteException('Missing required parameter: "policy_id"') + + api_path = api_path.replace('{policyId}', policy_id) + + api_params['name'] = name + api_params['retention'] = retention + if schedule is not None: + api_params['schedule'] = schedule + api_params['enabled'] = enabled + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_policy(self, policy_id: str) -> Dict[str, Any]: + """ + Delete a policy using it's ID. + + Parameters + ---------- + policy_id : str + Policy 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 = '/backups/policies/{policyId}' + api_params = {} + if policy_id is None: + raise AppwriteException('Missing required parameter: "policy_id"') + + api_path = api_path.replace('{policyId}', policy_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def create_restoration(self, archive_id: str, services: List[str], new_resource_id: Optional[str] = None, new_resource_name: Optional[str] = None) -> Dict[str, Any]: + """ + Create and trigger a new restoration for a backup on a project. + + Parameters + ---------- + archive_id : str + Backup archive ID to restore + services : List[str] + Array of services to restore + new_resource_id : Optional[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. + new_resource_name : Optional[str] + Database name. Max length: 128 chars. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/backups/restoration' + api_params = {} + if archive_id is None: + raise AppwriteException('Missing required parameter: "archive_id"') + + if services is None: + raise AppwriteException('Missing required parameter: "services"') + + + api_params['archiveId'] = archive_id + api_params['services'] = services + if new_resource_id is not None: + api_params['newResourceId'] = new_resource_id + if new_resource_name is not None: + api_params['newResourceName'] = new_resource_name + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_restorations(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: + """ + List all backup restorations for a project. + + Parameters + ---------- + queries : Optional[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 = '/backups/restorations' + api_params = {} + + if queries is not None: + api_params['queries'] = queries + + return self.client.call('get', api_path, { + }, api_params) + + def get_restoration(self, restoration_id: str) -> Dict[str, Any]: + """ + Get the current status of a backup restoration. + + Parameters + ---------- + restoration_id : str + Restoration ID. Choose a custom ID`. 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 = '/backups/restorations/{restorationId}' + api_params = {} + if restoration_id is None: + raise AppwriteException('Missing required parameter: "restoration_id"') + + api_path = api_path.replace('{restorationId}', restoration_id) + + + return self.client.call('get', api_path, { + }, api_params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index b2f96d5..516c864 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -2770,7 +2770,7 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q }, api_params) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.upsert_row` instead.") - def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: Optional[List[str]] = None, transaction_id: Optional[str] = None) -> Dict[str, Any]: + def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: Optional[dict] = None, permissions: Optional[List[str]] = None, transaction_id: Optional[str] = None) -> Dict[str, Any]: """ 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. @@ -2784,7 +2784,7 @@ def upsert_document(self, database_id: str, collection_id: str, document_id: str Collection ID. document_id : str Document ID. - data : dict + data : Optional[dict] Document data as JSON object. Include all required attributes of the document to be created or updated. permissions : Optional[List[str]] An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). @@ -2813,14 +2813,12 @@ 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 + if data is not None: + api_params['data'] = data api_params['permissions'] = permissions api_params['transactionId'] = transaction_id diff --git a/appwrite/services/health.py b/appwrite/services/health.py index c6250a1..b88ad6a 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -143,6 +143,64 @@ def get_pub_sub(self) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) + def get_queue_billing_project_aggregation(self, threshold: Optional[float] = None) -> Dict[str, Any]: + """ + Get billing project aggregation queue. + + Parameters + ---------- + threshold : Optional[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/billing-project-aggregation' + api_params = {} + + if threshold is not None: + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + }, api_params) + + def get_queue_billing_team_aggregation(self, threshold: Optional[float] = None) -> Dict[str, Any]: + """ + Get billing team aggregation queue. + + Parameters + ---------- + threshold : Optional[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/billing-team-aggregation' + api_params = {} + + if threshold is not None: + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + }, api_params) + def get_queue_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. @@ -172,6 +230,35 @@ def get_queue_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) + def get_queue_priority_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: + """ + Get the priority builds queue size. + + Parameters + ---------- + threshold : Optional[float] + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/health/queue/builds-priority' + api_params = {} + + if threshold is not None: + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + }, api_params) + def get_queue_certificates(self, threshold: Optional[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. @@ -444,6 +531,35 @@ def get_queue_migrations(self, threshold: Optional[float] = None) -> Dict[str, A return self.client.call('get', api_path, { }, api_params) + def get_queue_region_manager(self, threshold: Optional[float] = None) -> Dict[str, Any]: + """ + Get region manager queue. + + Parameters + ---------- + threshold : Optional[float] + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/health/queue/region-manager' + api_params = {} + + if threshold is not None: + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + }, api_params) + def get_queue_stats_resources(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. @@ -502,6 +618,35 @@ def get_queue_usage(self, threshold: Optional[float] = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) + def get_queue_threats(self, threshold: Optional[float] = None) -> Dict[str, Any]: + """ + Get threats queue. + + Parameters + ---------- + threshold : Optional[float] + Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/health/queue/threats' + api_params = {} + + if threshold is not None: + api_params['threshold'] = threshold + + return self.client.call('get', api_path, { + }, api_params) + def get_queue_webhooks(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. diff --git a/appwrite/services/organizations.py b/appwrite/services/organizations.py new file mode 100644 index 0000000..cc3172d --- /dev/null +++ b/appwrite/services/organizations.py @@ -0,0 +1,73 @@ +from ..service import Service +from typing import List, Dict, Any, Optional +from ..exception import AppwriteException +from appwrite.utils.deprecated import deprecated + +class Organizations(Service): + + def __init__(self, client) -> None: + super(Organizations, self).__init__(client) + + def delete(self, organization_id: str) -> Dict[str, Any]: + """ + Delete an organization. + + Parameters + ---------- + organization_id : str + Team ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/organizations/{organizationId}' + api_params = {} + if organization_id is None: + raise AppwriteException('Missing required parameter: "organization_id"') + + api_path = api_path.replace('{organizationId}', organization_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def estimation_delete_organization(self, organization_id: str) -> Dict[str, Any]: + """ + Get estimation for deleting an organization. + + Parameters + ---------- + organization_id : str + Team ID. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/organizations/{organizationId}/estimations/delete-organization' + api_params = {} + if organization_id is None: + raise AppwriteException('Missing required parameter: "organization_id"') + + api_path = api_path.replace('{organizationId}', organization_id) + + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index d07b1fc..36f993d 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -66,11 +66,11 @@ def create_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st enabled : Optional[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 : Optional[float] - Maximum file size allowed in bytes. Maximum allowed value is 30MB. + Maximum file size allowed in bytes. Maximum allowed value is 5GB. allowed_file_extensions : Optional[List[str]] Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. compression : Optional[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 + Compression algorithm chosen 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 : Optional[bool] Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled antivirus : Optional[bool] @@ -170,11 +170,11 @@ def update_bucket(self, bucket_id: str, name: str, permissions: Optional[List[st enabled : Optional[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 : Optional[float] - Maximum file size allowed in bytes. Maximum allowed value is 30MB. + Maximum file size allowed in bytes. Maximum allowed value is 5GB. allowed_file_extensions : Optional[List[str]] Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. compression : Optional[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 + Compression algorithm chosen 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 : Optional[bool] Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled antivirus : Optional[bool] @@ -408,13 +408,13 @@ def update_file(self, bucket_id: str, file_id: str, name: Optional[str] = None, 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). + Bucket unique ID. file_id : str - File unique ID. + File ID. name : Optional[str] - Name of the file + File name. permissions : Optional[List[str]] - An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). Returns ------- @@ -438,7 +438,8 @@ def update_file(self, bucket_id: str, file_id: str, name: Optional[str] = None, api_path = api_path.replace('{bucketId}', bucket_id) api_path = api_path.replace('{fileId}', file_id) - api_params['name'] = name + if name is not None: + api_params['name'] = name api_params['permissions'] = permissions return self.client.call('put', api_path, { diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 9b5fd90..6f95338 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -8,4 +8,6 @@ client.set_session('') # The user session to authenticate with account = Account(client) -result = account.create_jwt() +result = account.create_jwt( + duration = 0 # optional +) diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 4375594..17aeab2 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -2,7 +2,7 @@ from appwrite.client import Client from appwrite.services.avatars import Avatars from appwrite.enums import Theme from appwrite.enums import Timezone -from appwrite.enums import Output +from appwrite.enums import ImageFormat client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint @@ -34,5 +34,5 @@ result = avatars.get_screenshot( width = 800, # optional height = 600, # optional quality = 85, # optional - output = Output.JPG # optional + output = ImageFormat.JPG # optional ) diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 0000000..681c93f --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.create_archive( + services = [], + resource_id = '' # optional +) diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 0000000..c99a329 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.create_policy( + policy_id = '', + services = [], + retention = 1, + schedule = '', + name = '', # optional + resource_id = '', # optional + enabled = False # optional +) diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 0000000..d700e1b --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.create_restoration( + archive_id = '', + services = [], + new_resource_id = '', # optional + new_resource_name = '' # optional +) diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 0000000..331ba9a --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.delete_archive( + archive_id = '' +) diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 0000000..29a790b --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.delete_policy( + policy_id = '' +) diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 0000000..9e9d8f0 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.get_archive( + archive_id = '' +) diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 0000000..e3fcea3 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.get_policy( + policy_id = '' +) diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 0000000..fc1a0ef --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.get_restoration( + restoration_id = '' +) diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 0000000..3a42662 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.list_archives( + queries = [] # optional +) diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 0000000..f97ef6b --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.list_policies( + queries = [] # optional +) diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 0000000..d1d65e6 --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.list_restorations( + queries = [] # optional +) diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 0000000..0c7d8c9 --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.backups import Backups + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +backups = Backups(client) + +result = backups.update_policy( + policy_id = '', + name = '', # optional + retention = 1, # optional + schedule = '', # optional + enabled = False # optional +) diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index a396b9e..91d233d 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -14,7 +14,13 @@ result = databases.update_document( database_id = '', collection_id = '', document_id = '', - data = {}, # optional + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": False + }, # optional permissions = [Permission.read(Role.any())], # optional transaction_id = '' # optional ) diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 2aab8c6..cbf6f64 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -11,7 +11,13 @@ databases = Databases(client) result = databases.update_documents( database_id = '', collection_id = '', - data = {}, # optional + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": False + }, # optional queries = [], # optional transaction_id = '' # optional ) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index ac53ae1..0d0f1b2 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -14,7 +14,13 @@ result = databases.upsert_document( database_id = '', collection_id = '', document_id = '', - data = {}, + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": False + }, # optional permissions = [Permission.read(Role.any())], # optional transaction_id = '' # optional ) diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md new file mode 100644 index 0000000..08d72ea --- /dev/null +++ b/docs/examples/health/get-queue-billing-project-aggregation.md @@ -0,0 +1,13 @@ +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 +client.set_key('') # Your secret API key + +health = Health(client) + +result = health.get_queue_billing_project_aggregation( + threshold = None # optional +) diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md new file mode 100644 index 0000000..eacb116 --- /dev/null +++ b/docs/examples/health/get-queue-billing-team-aggregation.md @@ -0,0 +1,13 @@ +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 +client.set_key('') # Your secret API key + +health = Health(client) + +result = health.get_queue_billing_team_aggregation( + threshold = None # optional +) diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md new file mode 100644 index 0000000..96ac687 --- /dev/null +++ b/docs/examples/health/get-queue-priority-builds.md @@ -0,0 +1,13 @@ +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 +client.set_key('') # Your secret API key + +health = Health(client) + +result = health.get_queue_priority_builds( + threshold = None # optional +) diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md new file mode 100644 index 0000000..f9cd25b --- /dev/null +++ b/docs/examples/health/get-queue-region-manager.md @@ -0,0 +1,13 @@ +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 +client.set_key('') # Your secret API key + +health = Health(client) + +result = health.get_queue_region_manager( + threshold = None # optional +) diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md new file mode 100644 index 0000000..3cc9f20 --- /dev/null +++ b/docs/examples/health/get-queue-threats.md @@ -0,0 +1,13 @@ +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 +client.set_key('') # Your secret API key + +health = Health(client) + +result = health.get_queue_threats( + threshold = None # optional +) diff --git a/docs/examples/organizations/delete.md b/docs/examples/organizations/delete.md new file mode 100644 index 0000000..8259428 --- /dev/null +++ b/docs/examples/organizations/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.organizations import Organizations + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +organizations = Organizations(client) + +result = organizations.delete( + organization_id = '' +) diff --git a/docs/examples/organizations/estimation-delete-organization.md b/docs/examples/organizations/estimation-delete-organization.md new file mode 100644 index 0000000..a6516e2 --- /dev/null +++ b/docs/examples/organizations/estimation-delete-organization.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.organizations import Organizations + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +organizations = Organizations(client) + +result = organizations.estimation_delete_organization( + organization_id = '' +) diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 3d34264..d6a55c6 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -14,7 +14,13 @@ result = tables_db.update_row( database_id = '', table_id = '', row_id = '', - data = {}, # optional + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": False + }, # optional permissions = [Permission.read(Role.any())], # optional transaction_id = '' # optional ) diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 4717581..77360af 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -11,7 +11,13 @@ tables_db = TablesDB(client) result = tables_db.update_rows( database_id = '', table_id = '', - data = {}, # optional + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": False + }, # optional queries = [], # optional transaction_id = '' # optional ) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index a89d657..d0520b3 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -14,7 +14,13 @@ result = tables_db.upsert_row( database_id = '', table_id = '', row_id = '', - data = {}, # optional + data = { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": False + }, # optional permissions = [Permission.read(Role.any())], # optional transaction_id = '' # optional ) diff --git a/setup.py b/setup.py index 3c922e7..4404000 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,9 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '14.1.0', + version = '15.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', + description = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API', long_description = long_description, long_description_content_type = 'text/markdown', author = 'Appwrite Team', @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/14.1.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/15.0.0.tar.gz', install_requires=[ 'requests', ], From ccd727a6b2acdc0181d53976331fe5cf7d20e062 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:41:36 +0000 Subject: [PATCH 2/6] latest updates as per server specs. --- CHANGELOG.md | 4 ++++ appwrite/client.py | 4 ++-- setup.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31396fa..b3906b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 14.1.1 + +* Update SDK as per latest server specs + ## 13.6.1 * Fix passing of `None` to nullable parameters diff --git a/appwrite/client.py b/appwrite/client.py index b4d2231..3b99ea0 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -15,11 +15,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/15.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/14.1.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': '15.0.0', + 'x-sdk-version': '14.1.1', 'X-Appwrite-Response-Format' : '1.8.0', } diff --git a/setup.py b/setup.py index 4404000..3dd6836 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '15.0.0', + version = '14.1.1', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/15.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/14.1.1.tar.gz', install_requires=[ 'requests', ], From f618b120a65887e9f5cfadcf36c9d3e08f2489f5 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 07:56:54 +0000 Subject: [PATCH 3/6] misc-docs-update --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3906b7..31ec0a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ * Update SDK as per latest server specs +## 14.1.0 + +* Added ability to create columns and indexes synchronously while creating a table + +## 14.0.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `create_template_deployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) + and `reference` parameters +* Add `get_screenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums +* Add support for dart39 and flutter335 runtimes + ## 13.6.1 * Fix passing of `None` to nullable parameters From 7762a92545066abeed72f66a44180e63536ec47c Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 14 Jan 2026 13:48:27 +0530 Subject: [PATCH 4/6] Apply suggestion from @ItzNotABug --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31ec0a0..40c3fa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,11 @@ ## 14.1.1 -* Update SDK as per latest server specs +* Update SDK as per latest server specs, these include - + * Updates to Runtime enums + * `Output` is now renamed to `ImageFormat` - Note that this is a breaking change + * Introduces Backups module for managing Database backups + * Introduces Organization module ## 14.1.0 From d2e995231b898e0db7c92e8ece198297b8fa439c Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 15 Jan 2026 07:15:21 +0000 Subject: [PATCH 5/6] misc-fixes --- appwrite/enums/o_auth_provider.py | 4 ---- appwrite/services/account.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/appwrite/enums/o_auth_provider.py b/appwrite/enums/o_auth_provider.py index 29230a3..b200f77 100644 --- a/appwrite/enums/o_auth_provider.py +++ b/appwrite/enums/o_auth_provider.py @@ -40,7 +40,3 @@ class OAuthProvider(Enum): YANDEX = "yandex" ZOHO = "zoho" ZOOM = "zoom" - MOCK = "mock" - MOCK_UNVERIFIED = "mock-unverified" - GITHUBIMAGINE = "githubImagine" - GOOGLEIMAGINE = "googleImagine" diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 77b3847..29bfd00 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -1228,7 +1228,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: Optional[str] = Parameters ---------- provider : OAuthProvider - 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, githubImagine, googleImagine. + 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 : Optional[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 : Optional[str] From 493c5cfd17ebb48982ccea3382c1637d144a820f Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 15 Jan 2026 07:42:23 +0000 Subject: [PATCH 6/6] misc-fixes --- appwrite/services/health.py | 145 ------------------ .../get-queue-billing-project-aggregation.md | 13 -- .../get-queue-billing-team-aggregation.md | 13 -- .../health/get-queue-priority-builds.md | 13 -- .../health/get-queue-region-manager.md | 13 -- docs/examples/health/get-queue-threats.md | 13 -- 6 files changed, 210 deletions(-) delete mode 100644 docs/examples/health/get-queue-billing-project-aggregation.md delete mode 100644 docs/examples/health/get-queue-billing-team-aggregation.md delete mode 100644 docs/examples/health/get-queue-priority-builds.md delete mode 100644 docs/examples/health/get-queue-region-manager.md delete mode 100644 docs/examples/health/get-queue-threats.md diff --git a/appwrite/services/health.py b/appwrite/services/health.py index b88ad6a..c6250a1 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -143,64 +143,6 @@ def get_pub_sub(self) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def get_queue_billing_project_aggregation(self, threshold: Optional[float] = None) -> Dict[str, Any]: - """ - Get billing project aggregation queue. - - Parameters - ---------- - threshold : Optional[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/billing-project-aggregation' - api_params = {} - - if threshold is not None: - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - }, api_params) - - def get_queue_billing_team_aggregation(self, threshold: Optional[float] = None) -> Dict[str, Any]: - """ - Get billing team aggregation queue. - - Parameters - ---------- - threshold : Optional[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/billing-team-aggregation' - api_params = {} - - if threshold is not None: - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - }, api_params) - def get_queue_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. @@ -230,35 +172,6 @@ def get_queue_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def get_queue_priority_builds(self, threshold: Optional[float] = None) -> Dict[str, Any]: - """ - Get the priority builds queue size. - - Parameters - ---------- - threshold : Optional[float] - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 500. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/health/queue/builds-priority' - api_params = {} - - if threshold is not None: - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - }, api_params) - def get_queue_certificates(self, threshold: Optional[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. @@ -531,35 +444,6 @@ def get_queue_migrations(self, threshold: Optional[float] = None) -> Dict[str, A return self.client.call('get', api_path, { }, api_params) - def get_queue_region_manager(self, threshold: Optional[float] = None) -> Dict[str, Any]: - """ - Get region manager queue. - - Parameters - ---------- - threshold : Optional[float] - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/health/queue/region-manager' - api_params = {} - - if threshold is not None: - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - }, api_params) - def get_queue_stats_resources(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. @@ -618,35 +502,6 @@ def get_queue_usage(self, threshold: Optional[float] = None) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) - def get_queue_threats(self, threshold: Optional[float] = None) -> Dict[str, Any]: - """ - Get threats queue. - - Parameters - ---------- - threshold : Optional[float] - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 100. - - Returns - ------- - Dict[str, Any] - API response as a dictionary - - Raises - ------ - AppwriteException - If API request fails - """ - - api_path = '/health/queue/threats' - api_params = {} - - if threshold is not None: - api_params['threshold'] = threshold - - return self.client.call('get', api_path, { - }, api_params) - def get_queue_webhooks(self, threshold: Optional[float] = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. diff --git a/docs/examples/health/get-queue-billing-project-aggregation.md b/docs/examples/health/get-queue-billing-project-aggregation.md deleted file mode 100644 index 08d72ea..0000000 --- a/docs/examples/health/get-queue-billing-project-aggregation.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 -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_billing_project_aggregation( - threshold = None # optional -) diff --git a/docs/examples/health/get-queue-billing-team-aggregation.md b/docs/examples/health/get-queue-billing-team-aggregation.md deleted file mode 100644 index eacb116..0000000 --- a/docs/examples/health/get-queue-billing-team-aggregation.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 -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_billing_team_aggregation( - threshold = None # optional -) diff --git a/docs/examples/health/get-queue-priority-builds.md b/docs/examples/health/get-queue-priority-builds.md deleted file mode 100644 index 96ac687..0000000 --- a/docs/examples/health/get-queue-priority-builds.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 -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_priority_builds( - threshold = None # optional -) diff --git a/docs/examples/health/get-queue-region-manager.md b/docs/examples/health/get-queue-region-manager.md deleted file mode 100644 index f9cd25b..0000000 --- a/docs/examples/health/get-queue-region-manager.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 -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_region_manager( - threshold = None # optional -) diff --git a/docs/examples/health/get-queue-threats.md b/docs/examples/health/get-queue-threats.md deleted file mode 100644 index 3cc9f20..0000000 --- a/docs/examples/health/get-queue-threats.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 -client.set_key('') # Your secret API key - -health = Health(client) - -result = health.get_queue_threats( - threshold = None # optional -)