From 82d29c9abcb6fc82eee778a37e7672eb7f79772a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 03:11:40 +1200 Subject: [PATCH 1/4] Add 1.8.x support --- README.md | 4 +- appwrite/client.py | 6 +- appwrite/encoders/value_class_encoder.py | 4 + appwrite/enums/type.py | 5 + appwrite/query.py | 36 + appwrite/services/account.py | 35 +- appwrite/services/avatars.py | 7 - appwrite/services/databases.py | 263 +- 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_db.py | 2480 +++++++++++++++++ appwrite/services/teams.py | 13 - appwrite/services/tokens.py | 5 - appwrite/services/users.py | 42 - docs/examples/databases/create.md | 3 +- docs/examples/functions/create-execution.md | 2 +- .../tablesdb/create-boolean-column.md | 18 + .../tablesdb/create-datetime-column.md | 18 + docs/examples/tablesdb/create-email-column.md | 18 + docs/examples/tablesdb/create-enum-column.md | 19 + docs/examples/tablesdb/create-float-column.md | 20 + docs/examples/tablesdb/create-index.md | 20 + .../tablesdb/create-integer-column.md | 20 + docs/examples/tablesdb/create-ip-column.md | 18 + .../tablesdb/create-relationship-column.md | 21 + docs/examples/tablesdb/create-row.md | 17 + docs/examples/tablesdb/create-rows.md | 15 + .../examples/tablesdb/create-string-column.md | 20 + docs/examples/tablesdb/create-table.md | 18 + docs/examples/tablesdb/create-url-column.md | 18 + docs/examples/tablesdb/create.md | 16 + .../examples/tablesdb/decrement-row-column.md | 18 + docs/examples/tablesdb/delete-column.md | 15 + docs/examples/tablesdb/delete-index.md | 15 + docs/examples/tablesdb/delete-row.md | 15 + docs/examples/tablesdb/delete-rows.md | 15 + docs/examples/tablesdb/delete-table.md | 14 + docs/examples/tablesdb/delete.md | 13 + docs/examples/tablesdb/get-column.md | 15 + docs/examples/tablesdb/get-index.md | 15 + docs/examples/tablesdb/get-row.md | 16 + docs/examples/tablesdb/get-table.md | 14 + docs/examples/tablesdb/get.md | 13 + .../examples/tablesdb/increment-row-column.md | 18 + docs/examples/tablesdb/list-columns.md | 15 + docs/examples/tablesdb/list-indexes.md | 15 + docs/examples/tablesdb/list-rows.md | 15 + docs/examples/tablesdb/list-tables.md | 15 + docs/examples/tablesdb/list.md | 14 + .../tablesdb/update-boolean-column.md | 18 + .../tablesdb/update-datetime-column.md | 18 + docs/examples/tablesdb/update-email-column.md | 18 + docs/examples/tablesdb/update-enum-column.md | 19 + docs/examples/tablesdb/update-float-column.md | 20 + .../tablesdb/update-integer-column.md | 20 + docs/examples/tablesdb/update-ip-column.md | 18 + .../tablesdb/update-relationship-column.md | 17 + docs/examples/tablesdb/update-row.md | 17 + docs/examples/tablesdb/update-rows.md | 16 + .../examples/tablesdb/update-string-column.md | 19 + docs/examples/tablesdb/update-table.md | 18 + docs/examples/tablesdb/update-url-column.md | 18 + docs/examples/tablesdb/update.md | 15 + docs/examples/tablesdb/upsert-row.md | 17 + docs/examples/tablesdb/upsert-rows.md | 15 + setup.py | 4 +- 70 files changed, 3521 insertions(+), 339 deletions(-) create mode 100644 appwrite/enums/type.py create mode 100644 appwrite/services/tables_db.py create mode 100644 docs/examples/tablesdb/create-boolean-column.md create mode 100644 docs/examples/tablesdb/create-datetime-column.md create mode 100644 docs/examples/tablesdb/create-email-column.md create mode 100644 docs/examples/tablesdb/create-enum-column.md create mode 100644 docs/examples/tablesdb/create-float-column.md create mode 100644 docs/examples/tablesdb/create-index.md create mode 100644 docs/examples/tablesdb/create-integer-column.md create mode 100644 docs/examples/tablesdb/create-ip-column.md create mode 100644 docs/examples/tablesdb/create-relationship-column.md create mode 100644 docs/examples/tablesdb/create-row.md create mode 100644 docs/examples/tablesdb/create-rows.md create mode 100644 docs/examples/tablesdb/create-string-column.md create mode 100644 docs/examples/tablesdb/create-table.md create mode 100644 docs/examples/tablesdb/create-url-column.md create mode 100644 docs/examples/tablesdb/create.md create mode 100644 docs/examples/tablesdb/decrement-row-column.md create mode 100644 docs/examples/tablesdb/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.md create mode 100644 docs/examples/tablesdb/delete-row.md create mode 100644 docs/examples/tablesdb/delete-rows.md create mode 100644 docs/examples/tablesdb/delete-table.md create mode 100644 docs/examples/tablesdb/delete.md create mode 100644 docs/examples/tablesdb/get-column.md create mode 100644 docs/examples/tablesdb/get-index.md create mode 100644 docs/examples/tablesdb/get-row.md create mode 100644 docs/examples/tablesdb/get-table.md create mode 100644 docs/examples/tablesdb/get.md create mode 100644 docs/examples/tablesdb/increment-row-column.md create mode 100644 docs/examples/tablesdb/list-columns.md create mode 100644 docs/examples/tablesdb/list-indexes.md create mode 100644 docs/examples/tablesdb/list-rows.md create mode 100644 docs/examples/tablesdb/list-tables.md create mode 100644 docs/examples/tablesdb/list.md create mode 100644 docs/examples/tablesdb/update-boolean-column.md create mode 100644 docs/examples/tablesdb/update-datetime-column.md create mode 100644 docs/examples/tablesdb/update-email-column.md create mode 100644 docs/examples/tablesdb/update-enum-column.md create mode 100644 docs/examples/tablesdb/update-float-column.md create mode 100644 docs/examples/tablesdb/update-integer-column.md create mode 100644 docs/examples/tablesdb/update-ip-column.md create mode 100644 docs/examples/tablesdb/update-relationship-column.md create mode 100644 docs/examples/tablesdb/update-row.md create mode 100644 docs/examples/tablesdb/update-rows.md create mode 100644 docs/examples/tablesdb/update-string-column.md create mode 100644 docs/examples/tablesdb/update-table.md create mode 100644 docs/examples/tablesdb/update-url-column.md create mode 100644 docs/examples/tablesdb/update.md create mode 100644 docs/examples/tablesdb/upsert-row.md create mode 100644 docs/examples/tablesdb/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/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index 72297a5..4388e9a 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -5,6 +5,7 @@ from ..enums.browser import Browser from ..enums.credit_card import CreditCard from ..enums.flag import Flag +from ..enums.type import Type from ..enums.relationship_type import RelationshipType from ..enums.relation_mutate import RelationMutate from ..enums.index_type import IndexType @@ -44,6 +45,9 @@ def default(self, o): if isinstance(o, Flag): return o.value + if isinstance(o, Type): + return o.value + if isinstance(o, RelationshipType): return o.value diff --git a/appwrite/enums/type.py b/appwrite/enums/type.py new file mode 100644 index 0000000..1679c42 --- /dev/null +++ b/appwrite/enums/type.py @@ -0,0 +1,5 @@ +from enum import Enum + +class Type(Enum): + TABLESDB = "tablesdb" + LEGACY = "legacy" diff --git a/appwrite/query.py b/appwrite/query.py index f25e33d..80f105c 100644 --- a/appwrite/query.py +++ b/appwrite/query.py @@ -99,6 +99,42 @@ def offset(offset): def contains(attribute, value): return str(Query("contains", attribute, value)) + @staticmethod + def not_contains(attribute, value): + return str(Query("notContains", attribute, value)) + + @staticmethod + def not_search(attribute, value): + return str(Query("notSearch", attribute, value)) + + @staticmethod + def not_between(attribute, start, end): + return str(Query("notBetween", attribute, [start, end])) + + @staticmethod + def not_starts_with(attribute, value): + return str(Query("notStartsWith", attribute, value)) + + @staticmethod + def not_ends_with(attribute, value): + return str(Query("notEndsWith", attribute, value)) + + @staticmethod + def created_before(value): + return str(Query("createdBefore", None, value)) + + @staticmethod + def created_after(value): + return str(Query("createdAfter", None, value)) + + @staticmethod + def updated_before(value): + return str(Query("updatedBefore", None, value)) + + @staticmethod + def updated_after(value): + return str(Query("updatedAfter", None, value)) + @staticmethod def or_queries(queries): return str(Query("or", None, [json.loads(query) for query in queries])) diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 6062ad4..fbe5a6c 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,8 @@ 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 @@ -926,7 +909,8 @@ 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 @@ -965,7 +949,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 +987,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 +1018,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 +1050,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 +1106,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 +1150,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 +1198,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 +1240,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 +1281,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 +1313,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 +1373,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..8f6dc75 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,6 +1,7 @@ from ..service import Service from typing import List, Dict, Any from ..exception import AppwriteException +from ..enums.type import Type; from ..enums.relationship_type import RelationshipType; from ..enums.relation_mutate import RelationMutate; from ..enums.index_type import IndexType; @@ -14,7 +15,8 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.list` instead. Parameters ---------- queries : List[str] @@ -42,12 +44,13 @@ 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, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: + def create(self, database_id: str, name: str, enabled: bool = None, type: Type = None) -> Dict[str, Any]: """ Create a new Database. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.create_database` instead. Parameters ---------- database_id : str @@ -56,6 +59,8 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[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. + type : Type + Database type. Returns ------- @@ -80,6 +85,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, api_params['databaseId'] = database_id api_params['name'] = name api_params['enabled'] = enabled + api_params['type'] = type return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -89,7 +95,8 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.get` instead. Parameters ---------- database_id : str @@ -121,7 +128,8 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Update a database by its unique ID. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.update` instead. Parameters ---------- database_id : str @@ -163,7 +171,8 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.delete` instead. Parameters ---------- database_id : str @@ -196,7 +205,8 @@ 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 `tablesDb.list_tables` instead. Parameters ---------- database_id : str @@ -234,7 +244,8 @@ 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 `tablesDb.create_table` instead. Parameters ---------- database_id : str @@ -288,7 +299,8 @@ 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 `tablesDb.get_table` instead. Parameters ---------- database_id : str @@ -326,7 +338,8 @@ 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 `tablesDb.update_table` instead. Parameters ---------- database_id : str @@ -380,7 +393,8 @@ 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 `tablesDb.delete_table` instead. Parameters ---------- database_id : str @@ -419,13 +433,14 @@ 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 `tablesDb.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 @@ -461,13 +476,14 @@ 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 `tablesDb.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 @@ -518,13 +534,14 @@ 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 `tablesDb.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 @@ -575,13 +592,14 @@ 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 `tablesDb.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 @@ -632,13 +650,14 @@ 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 `tablesDb.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 @@ -690,13 +709,14 @@ 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 `tablesDb.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 @@ -748,13 +768,14 @@ 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 `tablesDb.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 @@ -762,7 +783,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 ------- @@ -803,20 +824,21 @@ 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 `tablesDb.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 @@ -870,23 +892,24 @@ 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 `tablesDb.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 ------- @@ -934,23 +957,24 @@ 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 `tablesDb.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? @@ -998,25 +1022,26 @@ 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 `tablesDb.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 ------- @@ -1062,23 +1087,24 @@ 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 `tablesDb.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? @@ -1126,25 +1152,26 @@ 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 `tablesDb.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 ------- @@ -1190,19 +1217,20 @@ 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 `tablesDb.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? @@ -1248,21 +1276,22 @@ 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 `tablesDb.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 ------- @@ -1306,15 +1335,16 @@ 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 `tablesDb.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 @@ -1370,13 +1400,14 @@ 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 `tablesDb.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 @@ -1437,13 +1468,14 @@ 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 `tablesDb.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 @@ -1453,7 +1485,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 ------- @@ -1498,13 +1530,14 @@ 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 `tablesDb.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 @@ -1556,13 +1589,14 @@ 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 `tablesDb.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 @@ -1570,7 +1604,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 ------- @@ -1613,13 +1647,14 @@ 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 `tablesDb.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. @@ -1657,13 +1692,14 @@ 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 `tablesDb.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. @@ -1703,19 +1739,20 @@ 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 `tablesDb.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 ------- @@ -1754,7 +1791,8 @@ 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 `tablesDb.list_rows` instead. Parameters ---------- database_id : str @@ -1795,7 +1833,8 @@ 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 `tablesDb.create_row` instead. Parameters ---------- database_id : str @@ -1847,11 +1886,10 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.create_rows` instead. Parameters ---------- database_id : str @@ -1894,12 +1932,11 @@ def create_documents(self, database_id: str, collection_id: str, documents: List 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 `tablesDb.upsert_rows` instead. Parameters ---------- database_id : str @@ -1942,11 +1979,10 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.update_rows` instead. Parameters ---------- database_id : str @@ -1989,11 +2025,10 @@ 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. - + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `tablesDb.delete_rows` instead. Parameters ---------- database_id : str @@ -2035,7 +2070,8 @@ 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 `tablesDb.get_row` instead. Parameters ---------- database_id : str @@ -2080,11 +2116,10 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q 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 `tablesDb.upsert_row` instead. Parameters ---------- database_id : str @@ -2138,7 +2173,8 @@ 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 `tablesDb.update_row` instead. Parameters ---------- database_id : str @@ -2189,7 +2225,8 @@ 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 `tablesDb.delete_row` instead. Parameters ---------- database_id : str @@ -2234,7 +2271,8 @@ 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 `tablesDb.decrement_row_column` instead. Parameters ---------- database_id : str @@ -2246,7 +2284,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. @@ -2291,7 +2329,8 @@ 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 `tablesDb.increment_row_column` instead. Parameters ---------- database_id : str @@ -2348,7 +2387,8 @@ 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 `tablesDb.list_indexes` instead. Parameters ---------- database_id : str @@ -2390,7 +2430,8 @@ 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 `tablesDb.create_index` instead. Parameters ---------- database_id : str @@ -2453,7 +2494,8 @@ 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 `tablesDb.get_index` instead. Parameters ---------- database_id : str @@ -2497,7 +2539,8 @@ 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 `tablesDb.delete_index` instead. 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/tables_db.py b/appwrite/services/tables_db.py new file mode 100644 index 0000000..01d5983 --- /dev/null +++ b/appwrite/services/tables_db.py @@ -0,0 +1,2480 @@ +from ..service import Service +from typing import List, Dict, Any +from ..exception import AppwriteException +from ..enums.type import Type; +from ..enums.relationship_type import RelationshipType; +from ..enums.relation_mutate import RelationMutate; +from ..enums.index_type import IndexType; + +class TablesDb(Service): + + def __init__(self, client) -> None: + super(TablesDb, self).__init__(client) + + 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 = '/tablesdb' + api_params = {} + + api_params['queries'] = queries + api_params['search'] = search + + return self.client.call('get', api_path, { + }, api_params) + + def create(self, database_id: str, name: str, enabled: bool = None, type: Type = 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. + type : Type + Database type. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tablesdb' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + + api_params['databaseId'] = database_id + api_params['name'] = name + api_params['enabled'] = enabled + api_params['type'] = type + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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 = '/tablesdb/{databaseId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + api_path = api_path.replace('{databaseId}', database_id) + + + return self.client.call('get', api_path, { + }, api_params) + + 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 = '/tablesdb/{databaseId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + api_path = api_path.replace('{databaseId}', database_id) + + api_params['name'] = name + api_params['enabled'] = enabled + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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 = '/tablesdb/{databaseId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + api_path = api_path.replace('{databaseId}', database_id) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + def list_tables(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 = '/tablesdb/{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_table(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 = '/tablesdb/{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_table(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 = '/tablesdb/{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_table(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 = '/tablesdb/{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_table(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 = '/tablesdb/{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 columns in the table. + + 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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 columns listed. Your index should include all the columns 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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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, rows: List[dict]) -> 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. + rows : List[dict] + Array of row data as JSON objects. May contain partial rows. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/tablesdb/{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('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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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, data: dict = None, permissions: List[str] = None) -> 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. + data : dict + Row data as JSON object. Include all required columns of the row 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 = '/tablesdb/{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('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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 = '/tablesdb/{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 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 diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index 0492203..b908775 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,5 +11,6 @@ databases = Databases(client) result = databases.create( database_id = '', name = '', - enabled = False # optional + enabled = False, # optional + type = .TABLESDB # optional ) diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index b41c7e3..f80b864 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -15,5 +15,5 @@ result = functions.create_execution( path = '', # optional method = ExecutionMethod.GET, # optional headers = {}, # optional - scheduled_at = '' # optional + scheduled_at = '' # optional ) diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 0000000..bbcb275 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_boolean_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = False, # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 0000000..291f6cf --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_datetime_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 0000000..042ef85 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_email_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = 'email@example.com', # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 0000000..c60fad9 --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_enum_column( + database_id = '', + table_id = '', + key = '', + elements = [], + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 0000000..b84b79c --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_float_column( + database_id = '', + table_id = '', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 0000000..59f8531 --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb +from appwrite.enums import IndexType + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_index( + database_id = '', + table_id = '', + key = '', + type = IndexType.KEY, + columns = [], + orders = [], # optional + lengths = [] # optional +) diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 0000000..d0701cd --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_integer_column( + database_id = '', + table_id = '', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 0000000..0775c4a --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_ip_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 0000000..bf77f47 --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,21 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb +from appwrite.enums import RelationshipType + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_relationship_column( + database_id = '', + 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/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md new file mode 100644 index 0000000..5cdb569 --- /dev/null +++ b/docs/examples/tablesdb/create-row.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_row( + database_id = '', + table_id = '', + row_id = '', + data = {}, + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 0000000..e6ecd3a --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_rows( + database_id = '', + table_id = '', + rows = [] +) diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 0000000..19e49f0 --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_string_column( + database_id = '', + table_id = '', + key = '', + size = 1, + required = False, + default = '', # optional + array = False, # optional + encrypt = False # optional +) diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 0000000..3b3e579 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_table( + database_id = '', + table_id = '', + name = '', + permissions = ["read("any")"], # optional + row_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 0000000..32d5eba --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create_url_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = 'https://example.com', # optional + array = False # optional +) diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 0000000..939ee27 --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.create( + database_id = '', + name = '', + enabled = False, # optional + type = .TABLESDB # optional +) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md new file mode 100644 index 0000000..09329e6 --- /dev/null +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.decrement_row_column( + database_id = '', + table_id = '', + row_id = '', + column = '', + value = None, # optional + min = None # optional +) diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 0000000..1a134af --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete_column( + database_id = '', + table_id = '', + key = '' +) diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 0000000..84045cf --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete_index( + database_id = '', + table_id = '', + key = '' +) diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md new file mode 100644 index 0000000..30fc8dc --- /dev/null +++ b/docs/examples/tablesdb/delete-row.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete_row( + database_id = '', + table_id = '', + row_id = '' +) diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 0000000..05eb0fc --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete_rows( + database_id = '', + table_id = '', + queries = [] # optional +) diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 0000000..b4728da --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete_table( + database_id = '', + table_id = '' +) diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 0000000..a56ce6f --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.delete( + database_id = '' +) diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 0000000..e3b76c6 --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.get_column( + database_id = '', + table_id = '', + key = '' +) diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 0000000..5b7e6ca --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.get_index( + database_id = '', + table_id = '', + key = '' +) diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md new file mode 100644 index 0000000..a18da4d --- /dev/null +++ b/docs/examples/tablesdb/get-row.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.get_row( + database_id = '', + table_id = '', + row_id = '', + queries = [] # optional +) diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 0000000..252df86 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.get_table( + database_id = '', + table_id = '' +) diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 0000000..93ce63c --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.get( + database_id = '' +) diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md new file mode 100644 index 0000000..c1e7d1d --- /dev/null +++ b/docs/examples/tablesdb/increment-row-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.increment_row_column( + database_id = '', + table_id = '', + row_id = '', + column = '', + value = None, # optional + max = None # optional +) diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 0000000..207e367 --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.list_columns( + database_id = '', + table_id = '', + queries = [] # optional +) diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 0000000..9f9f3e6 --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.list_indexes( + database_id = '', + table_id = '', + queries = [] # optional +) diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md new file mode 100644 index 0000000..2ad2448 --- /dev/null +++ b/docs/examples/tablesdb/list-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.list_rows( + database_id = '', + table_id = '', + queries = [] # optional +) diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 0000000..8c61593 --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.list_tables( + database_id = '', + queries = [], # optional + search = '' # optional +) diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 0000000..27b2a36 --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.list( + queries = [], # optional + search = '' # optional +) diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 0000000..b343e67 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_boolean_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = False, + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 0000000..d6a8a7c --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_datetime_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 0000000..6150f3e --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_email_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = 'email@example.com', + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 0000000..d856611 --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_enum_column( + database_id = '', + table_id = '', + key = '', + elements = [], + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 0000000..c6791f5 --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_float_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 0000000..368c8a6 --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_integer_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 0000000..9cefab7 --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_ip_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 0000000..e0c1545 --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_relationship_column( + database_id = '', + table_id = '', + key = '', + on_delete = RelationMutate.CASCADE, # optional + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md new file mode 100644 index 0000000..74f6a29 --- /dev/null +++ b/docs/examples/tablesdb/update-row.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_row( + database_id = '', + table_id = '', + row_id = '', + data = {}, # optional + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 0000000..20dd803 --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_rows( + database_id = '', + table_id = '', + data = {}, # optional + queries = [] # optional +) diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 0000000..f2ec02e --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_string_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = '', + size = 1, # optional + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 0000000..b1c8718 --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_table( + database_id = '', + table_id = '', + name = '', + permissions = ["read("any")"], # optional + row_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 0000000..bd684f4 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update_url_column( + database_id = '', + table_id = '', + key = '', + required = False, + default = 'https://example.com', + new_key = '' # optional +) diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 0000000..7df2c02 --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.update( + database_id = '', + name = '', + enabled = False # optional +) diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md new file mode 100644 index 0000000..a1717b3 --- /dev/null +++ b/docs/examples/tablesdb/upsert-row.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.upsert_row( + database_id = '', + table_id = '', + row_id = '', + data = {}, # optional + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 0000000..c4ee151 --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tables_db import TablesDb + +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 + +tables_db = TablesDb(client) + +result = tables_db.upsert_rows( + database_id = '', + table_id = '', + rows = [] +) 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 c36d7264e3e885093a7ccf1fd0b9a7fd93c2efba Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 18:24:58 +1200 Subject: [PATCH 2/4] Add 1.8.x support --- appwrite/encoders/value_class_encoder.py | 4 ---- appwrite/enums/type.py | 5 ----- appwrite/services/databases.py | 6 +----- appwrite/services/tables_db.py | 10 +++------- docs/examples/databases/create.md | 3 +-- docs/examples/tablesdb/create.md | 3 +-- 6 files changed, 6 insertions(+), 25 deletions(-) delete mode 100644 appwrite/enums/type.py diff --git a/appwrite/encoders/value_class_encoder.py b/appwrite/encoders/value_class_encoder.py index 4388e9a..72297a5 100644 --- a/appwrite/encoders/value_class_encoder.py +++ b/appwrite/encoders/value_class_encoder.py @@ -5,7 +5,6 @@ from ..enums.browser import Browser from ..enums.credit_card import CreditCard from ..enums.flag import Flag -from ..enums.type import Type from ..enums.relationship_type import RelationshipType from ..enums.relation_mutate import RelationMutate from ..enums.index_type import IndexType @@ -45,9 +44,6 @@ def default(self, o): if isinstance(o, Flag): return o.value - if isinstance(o, Type): - return o.value - if isinstance(o, RelationshipType): return o.value diff --git a/appwrite/enums/type.py b/appwrite/enums/type.py deleted file mode 100644 index 1679c42..0000000 --- a/appwrite/enums/type.py +++ /dev/null @@ -1,5 +0,0 @@ -from enum import Enum - -class Type(Enum): - TABLESDB = "tablesdb" - LEGACY = "legacy" diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 8f6dc75..5e5ba9b 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -1,7 +1,6 @@ from ..service import Service from typing import List, Dict, Any from ..exception import AppwriteException -from ..enums.type import Type; from ..enums.relationship_type import RelationshipType; from ..enums.relation_mutate import RelationMutate; from ..enums.index_type import IndexType; @@ -44,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, database_id: str, name: str, enabled: bool = None, type: Type = None) -> Dict[str, Any]: + def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: """ Create a new Database. @@ -59,8 +58,6 @@ def create(self, database_id: str, name: str, enabled: bool = None, type: Type = 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. - type : Type - Database type. Returns ------- @@ -85,7 +82,6 @@ def create(self, database_id: str, name: str, enabled: bool = None, type: Type = api_params['databaseId'] = database_id api_params['name'] = name api_params['enabled'] = enabled - api_params['type'] = type return self.client.call('post', api_path, { 'content-type': 'application/json', diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index 01d5983..45844d0 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -1,7 +1,6 @@ from ..service import Service from typing import List, Dict, Any from ..exception import AppwriteException -from ..enums.type import Type; from ..enums.relationship_type import RelationshipType; from ..enums.relation_mutate import RelationMutate; from ..enums.index_type import IndexType; @@ -42,7 +41,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, database_id: str, name: str, enabled: bool = None, type: Type = None) -> Dict[str, Any]: + def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Any]: """ Create a new Database. @@ -55,8 +54,6 @@ def create(self, database_id: str, name: str, enabled: bool = None, type: Type = 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. - type : Type - Database type. Returns ------- @@ -81,7 +78,6 @@ def create(self, database_id: str, name: str, enabled: bool = None, type: Type = api_params['databaseId'] = database_id api_params['name'] = name api_params['enabled'] = enabled - api_params['type'] = type return self.client.call('post', api_path, { 'content-type': 'application/json', @@ -1722,7 +1718,7 @@ def update_relationship_column(self, database_id: str, table_id: str, key: str, def list_indexes(self, database_id: str, table_id: str, queries: List[str] = None) -> Dict[str, Any]: """ - List indexes in the collection. + List indexes on the table. Parameters ---------- @@ -1763,7 +1759,7 @@ def list_indexes(self, database_id: str, table_id: str, queries: List[str] = Non 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 columns listed. Your index should include all the columns you will query in a single request. - Attributes can be `key`, `fulltext`, and `unique`. + Type can be `key`, `fulltext`, or `unique`. Parameters ---------- diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index b908775..0492203 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -11,6 +11,5 @@ databases = Databases(client) result = databases.create( database_id = '', name = '', - enabled = False, # optional - type = .TABLESDB # optional + enabled = False # optional ) diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 939ee27..043ed4b 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -11,6 +11,5 @@ tables_db = TablesDb(client) result = tables_db.create( database_id = '', name = '', - enabled = False, # optional - type = .TABLESDB # optional + enabled = False # optional ) From 607bbe79438d5fe8895117ae7b0703c749d4cdd0 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 20 Aug 2025 19:19:37 +1200 Subject: [PATCH 3/4] Add 1.8.x support --- docs/examples/databases/decrement-document-attribute.md | 2 +- docs/examples/databases/increment-document-attribute.md | 2 +- docs/examples/tablesdb/decrement-row-column.md | 2 +- docs/examples/tablesdb/increment-row-column.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 397bdd4..3efedf7 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -4,7 +4,7 @@ from appwrite.services.databases import Databases 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 +client.set_session('') # The user session to authenticate with databases = Databases(client) diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index d5700e0..9ae1ced 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -4,7 +4,7 @@ from appwrite.services.databases import Databases 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 +client.set_session('') # The user session to authenticate with databases = Databases(client) diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index 09329e6..1d5a03f 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -4,7 +4,7 @@ from appwrite.services.tables_db import TablesDb 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 +client.set_session('') # The user session to authenticate with tables_db = TablesDb(client) diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index c1e7d1d..af93969 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -4,7 +4,7 @@ from appwrite.services.tables_db import TablesDb 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 +client.set_session('') # The user session to authenticate with tables_db = TablesDb(client) From d48705e0b4b687310ecfdeff9380a166c147ec53 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 21 Aug 2025 22:18:20 +1200 Subject: [PATCH 4/4] Fix casing --- appwrite/services/account.py | 268 ++++++++++ appwrite/services/databases.py | 98 ++-- appwrite/services/messaging.py | 462 ++++++++++++++++++ appwrite/services/tables_db.py | 42 +- appwrite/services/users.py | 214 ++++++++ .../account/create-m-f-a-authenticator.md | 14 + .../account/create-m-f-a-challenge.md | 13 + .../account/create-m-f-a-recovery-codes.md | 11 + .../account/delete-m-f-a-authenticator.md | 14 + .../account/get-m-f-a-recovery-codes.md | 11 + docs/examples/account/list-m-f-a-factors.md | 11 + .../account/update-m-f-a-authenticator.md | 15 + .../account/update-m-f-a-challenge.md | 14 + .../account/update-m-f-a-recovery-codes.md | 11 + .../messaging/create-a-p-n-s-provider.md | 20 + .../messaging/create-f-c-m-provider.md | 16 + docs/examples/messaging/create-s-m-s.md | 19 + .../messaging/create-s-m-t-p-provider.md | 26 + .../messaging/update-a-p-n-s-provider.md | 20 + .../messaging/update-f-c-m-provider.md | 16 + docs/examples/messaging/update-s-m-s.md | 19 + .../messaging/update-s-m-t-p-provider.md | 26 + .../tablesdb/create-boolean-column.md | 4 +- .../tablesdb/create-datetime-column.md | 4 +- docs/examples/tablesdb/create-email-column.md | 4 +- docs/examples/tablesdb/create-enum-column.md | 4 +- docs/examples/tablesdb/create-float-column.md | 4 +- docs/examples/tablesdb/create-index.md | 4 +- .../tablesdb/create-integer-column.md | 4 +- docs/examples/tablesdb/create-ip-column.md | 4 +- .../tablesdb/create-relationship-column.md | 4 +- docs/examples/tablesdb/create-row.md | 4 +- docs/examples/tablesdb/create-rows.md | 4 +- .../examples/tablesdb/create-string-column.md | 4 +- docs/examples/tablesdb/create-table.md | 4 +- docs/examples/tablesdb/create-url-column.md | 4 +- docs/examples/tablesdb/create.md | 4 +- .../examples/tablesdb/decrement-row-column.md | 4 +- docs/examples/tablesdb/delete-column.md | 4 +- docs/examples/tablesdb/delete-index.md | 4 +- docs/examples/tablesdb/delete-row.md | 4 +- docs/examples/tablesdb/delete-rows.md | 4 +- docs/examples/tablesdb/delete-table.md | 4 +- docs/examples/tablesdb/delete.md | 4 +- docs/examples/tablesdb/get-column.md | 4 +- docs/examples/tablesdb/get-index.md | 4 +- docs/examples/tablesdb/get-row.md | 4 +- docs/examples/tablesdb/get-table.md | 4 +- docs/examples/tablesdb/get.md | 4 +- .../examples/tablesdb/increment-row-column.md | 4 +- docs/examples/tablesdb/list-columns.md | 4 +- docs/examples/tablesdb/list-indexes.md | 4 +- docs/examples/tablesdb/list-rows.md | 4 +- docs/examples/tablesdb/list-tables.md | 4 +- docs/examples/tablesdb/list.md | 4 +- .../tablesdb/update-boolean-column.md | 4 +- .../tablesdb/update-datetime-column.md | 4 +- docs/examples/tablesdb/update-email-column.md | 4 +- docs/examples/tablesdb/update-enum-column.md | 4 +- docs/examples/tablesdb/update-float-column.md | 4 +- .../tablesdb/update-integer-column.md | 4 +- docs/examples/tablesdb/update-ip-column.md | 4 +- .../tablesdb/update-relationship-column.md | 4 +- docs/examples/tablesdb/update-row.md | 4 +- docs/examples/tablesdb/update-rows.md | 4 +- .../examples/tablesdb/update-string-column.md | 4 +- docs/examples/tablesdb/update-table.md | 4 +- docs/examples/tablesdb/update-url-column.md | 4 +- docs/examples/tablesdb/update.md | 4 +- docs/examples/tablesdb/upsert-row.md | 4 +- docs/examples/tablesdb/upsert-rows.md | 4 +- .../users/create-m-f-a-recovery-codes.md | 13 + .../users/delete-m-f-a-authenticator.md | 15 + .../users/get-m-f-a-recovery-codes.md | 13 + docs/examples/users/list-m-f-a-factors.md | 13 + .../users/update-m-f-a-recovery-codes.md | 13 + docs/examples/users/update-m-f-a.md | 14 + 77 files changed, 1469 insertions(+), 168 deletions(-) create mode 100644 docs/examples/account/create-m-f-a-authenticator.md create mode 100644 docs/examples/account/create-m-f-a-challenge.md create mode 100644 docs/examples/account/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/delete-m-f-a-authenticator.md create mode 100644 docs/examples/account/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/account/list-m-f-a-factors.md create mode 100644 docs/examples/account/update-m-f-a-authenticator.md create mode 100644 docs/examples/account/update-m-f-a-challenge.md create mode 100644 docs/examples/account/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/messaging/create-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/create-f-c-m-provider.md create mode 100644 docs/examples/messaging/create-s-m-s.md create mode 100644 docs/examples/messaging/create-s-m-t-p-provider.md create mode 100644 docs/examples/messaging/update-a-p-n-s-provider.md create mode 100644 docs/examples/messaging/update-f-c-m-provider.md create mode 100644 docs/examples/messaging/update-s-m-s.md create mode 100644 docs/examples/messaging/update-s-m-t-p-provider.md create mode 100644 docs/examples/users/create-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/delete-m-f-a-authenticator.md create mode 100644 docs/examples/users/get-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/list-m-f-a-factors.md create mode 100644 docs/examples/users/update-m-f-a-recovery-codes.md create mode 100644 docs/examples/users/update-m-f-a.md diff --git a/appwrite/services/account.py b/appwrite/services/account.py index fbe5a6c..35be982 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -260,6 +260,40 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_mfa_authenticator` instead. + 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 = {} + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + api_path = api_path.replace('{type}', type) + + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + 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. @@ -296,6 +330,8 @@ 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. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_mfa_authenticator` instead. Parameters ---------- type : AuthenticatorType @@ -330,6 +366,78 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st 'content-type': 'application/json', }, api_params) + 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 = {} + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + if otp is None: + raise AppwriteException('Missing required parameter: "otp"') + + api_path = api_path.replace('{type}', type) + + api_params['otp'] = otp + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: + """ + Delete an authenticator for a user by ID. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `delete_mfa_authenticator` instead. + 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 = {} + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + api_path = api_path.replace('{type}', type) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. @@ -362,6 +470,40 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_mfa_challenge` instead. + 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 = {} + if factor is None: + raise AppwriteException('Missing required parameter: "factor"') + + + api_params['factor'] = factor + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + 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. @@ -398,6 +540,8 @@ 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. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_mfa_challenge` instead. Parameters ---------- challenge_id : str @@ -432,6 +576,65 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + 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 = {} + if challenge_id is None: + raise AppwriteException('Missing required parameter: "challenge_id"') + + if otp is None: + raise AppwriteException('Missing required parameter: "otp"') + + + api_params['challengeId'] = challenge_id + api_params['otp'] = otp + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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 = {} + + return self.client.call('get', api_path, { + }, api_params) + def list_mfa_factors(self) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. @@ -474,6 +677,49 @@ def get_mfa_recovery_codes(self) -> Dict[str, Any]: return self.client.call('get', api_path, { }, api_params) + 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 = {} + + return self.client.call('get', api_path, { + }, api_params) + + 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 = {} + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + 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. @@ -518,6 +764,28 @@ def update_mfa_recovery_codes(self) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + 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 = {} + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index 5e5ba9b..898bc41 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -15,7 +15,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.list` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.list` instead. Parameters ---------- queries : List[str] @@ -49,7 +49,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_database` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_database` instead. Parameters ---------- database_id : str @@ -92,7 +92,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.get` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.get` instead. Parameters ---------- database_id : str @@ -125,7 +125,7 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Update a database by its unique ID. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update` instead. Parameters ---------- database_id : str @@ -168,7 +168,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.delete` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete` instead. Parameters ---------- database_id : str @@ -202,7 +202,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.list_tables` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.list_tables` instead. Parameters ---------- database_id : str @@ -241,7 +241,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_table` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_table` instead. Parameters ---------- database_id : str @@ -296,7 +296,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.get_table` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.get_table` instead. Parameters ---------- database_id : str @@ -335,7 +335,7 @@ 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 `tablesDb.update_table` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_table` instead. Parameters ---------- database_id : str @@ -390,7 +390,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.delete_table` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete_table` instead. Parameters ---------- database_id : str @@ -430,7 +430,7 @@ 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 `tablesDb.list_columns` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.list_columns` instead. Parameters ---------- database_id : str @@ -473,7 +473,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_boolean_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_boolean_column` instead. Parameters ---------- database_id : str @@ -531,7 +531,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_boolean_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_boolean_column` instead. Parameters ---------- database_id : str @@ -589,7 +589,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_datetime_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_datetime_column` instead. Parameters ---------- database_id : str @@ -647,7 +647,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_datetime_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_datetime_column` instead. Parameters ---------- database_id : str @@ -706,7 +706,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_email_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_email_column` instead. Parameters ---------- database_id : str @@ -765,7 +765,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_email_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_email_column` instead. Parameters ---------- database_id : str @@ -824,7 +824,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_enum_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_enum_column` instead. Parameters ---------- database_id : str @@ -889,7 +889,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_enum_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_enum_column` instead. Parameters ---------- database_id : str @@ -954,7 +954,7 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_float_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_float_column` instead. Parameters ---------- database_id : str @@ -1019,7 +1019,7 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_float_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_float_column` instead. Parameters ---------- database_id : str @@ -1084,7 +1084,7 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_integer_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_integer_column` instead. Parameters ---------- database_id : str @@ -1149,7 +1149,7 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_integer_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_integer_column` instead. Parameters ---------- database_id : str @@ -1214,7 +1214,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_ip_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_ip_column` instead. Parameters ---------- database_id : str @@ -1273,7 +1273,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_ip_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_ip_column` instead. Parameters ---------- database_id : str @@ -1332,7 +1332,7 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_relationship_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_relationship_column` instead. Parameters ---------- database_id : str @@ -1397,7 +1397,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_string_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_string_column` instead. Parameters ---------- database_id : str @@ -1465,7 +1465,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_string_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_string_column` instead. Parameters ---------- database_id : str @@ -1527,7 +1527,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_url_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_url_column` instead. Parameters ---------- database_id : str @@ -1586,7 +1586,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_url_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_url_column` instead. Parameters ---------- database_id : str @@ -1644,7 +1644,7 @@ 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 `tablesDb.get_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.get_column` instead. Parameters ---------- database_id : str @@ -1689,7 +1689,7 @@ 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 `tablesDb.delete_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete_column` instead. Parameters ---------- database_id : str @@ -1736,7 +1736,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_relationship_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_relationship_column` instead. Parameters ---------- database_id : str @@ -1788,7 +1788,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.list_rows` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.list_rows` instead. Parameters ---------- database_id : str @@ -1830,7 +1830,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_row` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_row` instead. Parameters ---------- database_id : str @@ -1885,7 +1885,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_rows` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_rows` instead. Parameters ---------- database_id : str @@ -1932,7 +1932,7 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.upsert_rows` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.upsert_rows` instead. Parameters ---------- database_id : str @@ -1978,7 +1978,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_rows` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_rows` instead. Parameters ---------- database_id : str @@ -2024,7 +2024,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.delete_rows` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete_rows` instead. Parameters ---------- database_id : str @@ -2067,7 +2067,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.get_row` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.get_row` instead. Parameters ---------- database_id : str @@ -2115,7 +2115,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.upsert_row` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.upsert_row` instead. Parameters ---------- database_id : str @@ -2170,7 +2170,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. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.update_row` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.update_row` instead. Parameters ---------- database_id : str @@ -2222,7 +2222,7 @@ 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 `tablesDb.delete_row` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete_row` instead. Parameters ---------- database_id : str @@ -2268,7 +2268,7 @@ 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 `tablesDb.decrement_row_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.decrement_row_column` instead. Parameters ---------- database_id : str @@ -2326,7 +2326,7 @@ 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 `tablesDb.increment_row_column` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.increment_row_column` instead. Parameters ---------- database_id : str @@ -2384,7 +2384,7 @@ 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 `tablesDb.list_indexes` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.list_indexes` instead. Parameters ---------- database_id : str @@ -2427,7 +2427,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Attributes can be `key`, `fulltext`, and `unique`. .. deprecated::1.8.0 - This API has been deprecated since 1.8.0. Please use `tablesDb.create_index` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.create_index` instead. Parameters ---------- database_id : str @@ -2491,7 +2491,7 @@ 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 `tablesDb.get_index` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.get_index` instead. Parameters ---------- database_id : str @@ -2536,7 +2536,7 @@ 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 `tablesDb.delete_index` instead. + This API has been deprecated since 1.8.0. Please use `tablesDB.delete_index` instead. Parameters ---------- database_id : str diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 639a820..731c581 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -354,6 +354,8 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us """ Create a new SMS message. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_sms` instead. Parameters ---------- message_id : str @@ -403,6 +405,112 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us '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) -> 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 = {} + if message_id is None: + raise AppwriteException('Missing required parameter: "message_id"') + + if content is None: + raise AppwriteException('Missing required parameter: "content"') + + + api_params['messageId'] = message_id + api_params['content'] = content + api_params['topics'] = topics + api_params['users'] = users + api_params['targets'] = targets + api_params['draft'] = draft + api_params['scheduledAt'] = scheduled_at + + return self.client.call('post', api_path, { + '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) -> 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. + + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_sms` instead. + 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 = {} + if message_id is None: + raise AppwriteException('Missing required parameter: "message_id"') + + api_path = api_path.replace('{messageId}', message_id) + + api_params['topics'] = topics + api_params['users'] = users + api_params['targets'] = targets + api_params['content'] = content + api_params['draft'] = draft + api_params['scheduledAt'] = scheduled_at + + return self.client.call('patch', api_path, { + '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) -> 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. @@ -617,6 +725,64 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ return self.client.call('get', api_path, { }, 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]: + """ + Create a new Apple Push Notification service provider. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_apns_provider` instead. + 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + + api_params['providerId'] = provider_id + api_params['name'] = name + api_params['authKey'] = auth_key + api_params['authKeyId'] = auth_key_id + api_params['teamId'] = team_id + api_params['bundleId'] = bundle_id + api_params['sandbox'] = sandbox + api_params['enabled'] = enabled + + return self.client.call('post', 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]: """ Create a new Apple Push Notification service provider. @@ -677,6 +843,8 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Apple Push Notification service provider by its unique ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_apns_provider` instead. Parameters ---------- provider_id : str @@ -726,6 +894,105 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool '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) -> 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + api_path = api_path.replace('{providerId}', provider_id) + + api_params['name'] = name + api_params['enabled'] = enabled + api_params['authKey'] = auth_key + api_params['authKeyId'] = auth_key_id + api_params['teamId'] = team_id + api_params['bundleId'] = bundle_id + api_params['sandbox'] = sandbox + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_fcm_provider` instead. + 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + + api_params['providerId'] = provider_id + api_params['name'] = name + api_params['serviceAccountJSON'] = service_account_json + api_params['enabled'] = enabled + + return self.client.call('post', api_path, { + 'content-type': 'application/json', + }, api_params) + 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. @@ -770,6 +1037,49 @@ 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) -> Dict[str, Any]: + """ + Update a Firebase Cloud Messaging provider by its unique ID. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_fcm_provider` instead. + 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + api_path = api_path.replace('{providerId}', provider_id) + + api_params['name'] = name + api_params['enabled'] = enabled + api_params['serviceAccountJSON'] = service_account_json + + return self.client.call('patch', api_path, { + '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) -> Dict[str, Any]: """ Update a Firebase Cloud Messaging provider by its unique ID. @@ -1142,6 +1452,8 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo """ Create a new SMTP provider. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_smtp_provider` instead. Parameters ---------- provider_id : str @@ -1215,6 +1527,156 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo '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) -> 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + if name is None: + raise AppwriteException('Missing required parameter: "name"') + + if host is None: + raise AppwriteException('Missing required parameter: "host"') + + + api_params['providerId'] = provider_id + api_params['name'] = name + api_params['host'] = host + api_params['port'] = port + api_params['username'] = username + api_params['password'] = password + api_params['encryption'] = encryption + api_params['autoTLS'] = auto_tls + api_params['mailer'] = mailer + api_params['fromName'] = from_name + api_params['fromEmail'] = from_email + api_params['replyToName'] = reply_to_name + api_params['replyToEmail'] = reply_to_email + api_params['enabled'] = enabled + + return self.client.call('post', api_path, { + '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) -> Dict[str, Any]: + """ + Update a SMTP provider by its unique ID. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_smtp_provider` instead. + 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 = {} + if provider_id is None: + raise AppwriteException('Missing required parameter: "provider_id"') + + api_path = api_path.replace('{providerId}', provider_id) + + api_params['name'] = name + api_params['host'] = host + api_params['port'] = port + api_params['username'] = username + api_params['password'] = password + api_params['encryption'] = encryption + api_params['autoTLS'] = auto_tls + api_params['mailer'] = mailer + api_params['fromName'] = from_name + api_params['fromEmail'] = from_email + api_params['replyToName'] = reply_to_name + api_params['replyToEmail'] = reply_to_email + api_params['enabled'] = enabled + + return self.client.call('patch', api_path, { + '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) -> Dict[str, Any]: """ Update a SMTP provider by its unique ID. diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index 45844d0..a8c4690 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -5,10 +5,10 @@ from ..enums.relation_mutate import RelationMutate; from ..enums.index_type import IndexType; -class TablesDb(Service): +class TablesDB(Service): def __init__(self, client) -> None: - super(TablesDb, self).__init__(client) + super(TablesDB, self).__init__(client) def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ @@ -226,7 +226,7 @@ def list_tables(self, database_id: str, queries: List[str] = None, search: str = def create_table(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. + 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/tablesdb#tablesDBCreateTable) API or directly from your database console. Parameters ---------- @@ -455,7 +455,7 @@ def create_boolean_column(self, database_id: str, table_id: str, key: str, requi 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Column Key. required : bool @@ -511,7 +511,7 @@ def update_boolean_column(self, database_id: str, table_id: str, key: str, requi 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Column Key. required : bool @@ -1348,7 +1348,7 @@ def create_string_column(self, database_id: str, table_id: str, key: str, size: 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Column Key. size : float @@ -1414,7 +1414,7 @@ def update_string_column(self, database_id: str, table_id: str, key: str, requir 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Column Key. required : bool @@ -1725,7 +1725,7 @@ def list_indexes(self, database_id: str, table_id: str, queries: List[str] = Non 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). 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 @@ -1766,7 +1766,7 @@ def create_index(self, database_id: str, table_id: str, key: str, type: IndexTyp 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Index Key. type : IndexType @@ -1828,7 +1828,7 @@ def get_index(self, database_id: str, table_id: str, key: str) -> Dict[str, Any] 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Index Key. @@ -1871,7 +1871,7 @@ def delete_index(self, database_id: str, table_id: str, key: str) -> Dict[str, A 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). key : str Index Key. @@ -1915,7 +1915,7 @@ def list_rows(self, database_id: str, table_id: str, queries: List[str] = None) 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). + Table ID. You can create a new table using the TableDB service [server integration](https://appwrite.io/docs/server/tablesdbdb#tablesdbCreate). 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. @@ -1948,14 +1948,14 @@ def list_rows(self, database_id: str, table_id: str, queries: List[str] = None) 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. + 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/tablesdb#tablesDBCreateTable) 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. + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). 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 @@ -2001,14 +2001,14 @@ def create_row(self, database_id: str, table_id: str, row_id: str, data: dict, p 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. + Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable) 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. + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. rows : List[dict] Array of documents data as JSON objects. @@ -2045,7 +2045,7 @@ def create_rows(self, database_id: str, table_id: str, rows: List[dict]) -> Dict def upsert_rows(self, database_id: str, table_id: str, rows: List[dict]) -> 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. + 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/tablesdb#tablesDBCreateTable) API or directly from your database console. Parameters @@ -2141,7 +2141,7 @@ def delete_rows(self, database_id: str, table_id: str, queries: List[str] = None 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). 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. @@ -2182,7 +2182,7 @@ def get_row(self, database_id: str, table_id: str, row_id: str, queries: List[st 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). row_id : str Row ID. queries : List[str] @@ -2221,7 +2221,7 @@ def get_row(self, database_id: str, table_id: str, row_id: str, queries: List[st def upsert_row(self, database_id: str, table_id: str, row_id: str, data: dict = None, permissions: List[str] = None) -> 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. + 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/tablesdb#tablesDBCreateTable) API or directly from your database console. Parameters ---------- @@ -2328,7 +2328,7 @@ def delete_row(self, database_id: str, table_id: str, row_id: str) -> Dict[str, 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). + Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). row_id : str Row ID. diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 694657f..1f1892e 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -778,6 +778,46 @@ def list_memberships(self, user_id: str, queries: List[str] = None, search: str return self.client.call('get', api_path, { }, api_params) + def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: + """ + Enable or disable MFA on a user account. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_mfa` instead. + 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 = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + if mfa is None: + raise AppwriteException('Missing required parameter: "mfa"') + + api_path = api_path.replace('{userId}', user_id) + + api_params['mfa'] = mfa + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. @@ -820,6 +860,8 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic """ Delete an authenticator app. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `delete_mfa_authenticator` instead. Parameters ---------- user_id : str @@ -854,6 +896,77 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic 'content-type': 'application/json', }, api_params) + 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 = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + if type is None: + raise AppwriteException('Missing required parameter: "type"') + + api_path = api_path.replace('{userId}', user_id) + api_path = api_path.replace('{type}', type) + + + return self.client.call('delete', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `list_mfa_factors` 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}/mfa/factors' + api_params = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + api_path = api_path.replace('{userId}', user_id) + + + return self.client.call('get', api_path, { + }, api_params) + 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. @@ -882,6 +995,39 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: api_path = api_path.replace('{userId}', user_id) + return self.client.call('get', api_path, { + }, api_params) + + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `get_mfa_recovery_codes` 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}/mfa/recovery-codes' + api_params = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + api_path = api_path.replace('{userId}', user_id) + + return self.client.call('get', api_path, { }, api_params) @@ -920,6 +1066,8 @@ 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. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `update_mfa_recovery_codes` instead. Parameters ---------- user_id : str @@ -948,6 +1096,72 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) + 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 = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + api_path = api_path.replace('{userId}', user_id) + + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + + 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. + + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `create_mfa_recovery_codes` 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}/mfa/recovery-codes' + api_params = {} + if user_id is None: + raise AppwriteException('Missing required parameter: "user_id"') + + api_path = api_path.replace('{userId}', user_id) + + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + 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. diff --git a/docs/examples/account/create-m-f-a-authenticator.md b/docs/examples/account/create-m-f-a-authenticator.md new file mode 100644 index 0000000..70cee1d --- /dev/null +++ b/docs/examples/account/create-m-f-a-authenticator.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_mfa_authenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/account/create-m-f-a-challenge.md b/docs/examples/account/create-m-f-a-challenge.md new file mode 100644 index 0000000..abd746c --- /dev/null +++ b/docs/examples/account/create-m-f-a-challenge.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +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_project('') # Your project ID + +account = Account(client) + +result = account.create_mfa_challenge( + factor = AuthenticationFactor.EMAIL +) diff --git a/docs/examples/account/create-m-f-a-recovery-codes.md b/docs/examples/account/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..69aaa60 --- /dev/null +++ b/docs/examples/account/create-m-f-a-recovery-codes.md @@ -0,0 +1,11 @@ +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_mfa_recovery_codes() diff --git a/docs/examples/account/delete-m-f-a-authenticator.md b/docs/examples/account/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..83709c7 --- /dev/null +++ b/docs/examples/account/delete-m-f-a-authenticator.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.delete_mfa_authenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/account/get-m-f-a-recovery-codes.md b/docs/examples/account/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..c8fe494 --- /dev/null +++ b/docs/examples/account/get-m-f-a-recovery-codes.md @@ -0,0 +1,11 @@ +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.get_mfa_recovery_codes() diff --git a/docs/examples/account/list-m-f-a-factors.md b/docs/examples/account/list-m-f-a-factors.md new file mode 100644 index 0000000..72a3924 --- /dev/null +++ b/docs/examples/account/list-m-f-a-factors.md @@ -0,0 +1,11 @@ +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.list_mfa_factors() diff --git a/docs/examples/account/update-m-f-a-authenticator.md b/docs/examples/account/update-m-f-a-authenticator.md new file mode 100644 index 0000000..d53607f --- /dev/null +++ b/docs/examples/account/update-m-f-a-authenticator.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_authenticator( + type = AuthenticatorType.TOTP, + otp = '' +) diff --git a/docs/examples/account/update-m-f-a-challenge.md b/docs/examples/account/update-m-f-a-challenge.md new file mode 100644 index 0000000..cfc58c5 --- /dev/null +++ b/docs/examples/account/update-m-f-a-challenge.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_challenge( + challenge_id = '', + otp = '' +) diff --git a/docs/examples/account/update-m-f-a-recovery-codes.md b/docs/examples/account/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..51718eb --- /dev/null +++ b/docs/examples/account/update-m-f-a-recovery-codes.md @@ -0,0 +1,11 @@ +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_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_recovery_codes() diff --git a/docs/examples/messaging/create-a-p-n-s-provider.md b/docs/examples/messaging/create-a-p-n-s-provider.md new file mode 100644 index 0000000..b57fa00 --- /dev/null +++ b/docs/examples/messaging/create-a-p-n-s-provider.md @@ -0,0 +1,20 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_apns_provider( + provider_id = '', + name = '', + auth_key = '', # optional + auth_key_id = '', # optional + team_id = '', # optional + bundle_id = '', # optional + sandbox = False, # optional + enabled = False # optional +) diff --git a/docs/examples/messaging/create-f-c-m-provider.md b/docs/examples/messaging/create-f-c-m-provider.md new file mode 100644 index 0000000..9c40eb7 --- /dev/null +++ b/docs/examples/messaging/create-f-c-m-provider.md @@ -0,0 +1,16 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_fcm_provider( + provider_id = '', + name = '', + service_account_json = {}, # optional + enabled = False # optional +) diff --git a/docs/examples/messaging/create-s-m-s.md b/docs/examples/messaging/create-s-m-s.md new file mode 100644 index 0000000..d1c7b49 --- /dev/null +++ b/docs/examples/messaging/create-s-m-s.md @@ -0,0 +1,19 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_sms( + message_id = '', + content = '', + topics = [], # optional + users = [], # optional + targets = [], # optional + draft = False, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/messaging/create-s-m-t-p-provider.md b/docs/examples/messaging/create-s-m-t-p-provider.md new file mode 100644 index 0000000..99914f0 --- /dev/null +++ b/docs/examples/messaging/create-s-m-t-p-provider.md @@ -0,0 +1,26 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_smtp_provider( + provider_id = '', + name = '', + host = '', + port = 1, # optional + username = '', # optional + password = '', # optional + encryption = SmtpEncryption.NONE, # optional + auto_tls = False, # optional + mailer = '', # optional + from_name = '', # optional + from_email = 'email@example.com', # optional + reply_to_name = '', # optional + reply_to_email = 'email@example.com', # optional + enabled = False # optional +) diff --git a/docs/examples/messaging/update-a-p-n-s-provider.md b/docs/examples/messaging/update-a-p-n-s-provider.md new file mode 100644 index 0000000..f695b61 --- /dev/null +++ b/docs/examples/messaging/update-a-p-n-s-provider.md @@ -0,0 +1,20 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_apns_provider( + provider_id = '', + name = '', # optional + enabled = False, # optional + auth_key = '', # optional + auth_key_id = '', # optional + team_id = '', # optional + bundle_id = '', # optional + sandbox = False # optional +) diff --git a/docs/examples/messaging/update-f-c-m-provider.md b/docs/examples/messaging/update-f-c-m-provider.md new file mode 100644 index 0000000..0119d71 --- /dev/null +++ b/docs/examples/messaging/update-f-c-m-provider.md @@ -0,0 +1,16 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_fcm_provider( + provider_id = '', + name = '', # optional + enabled = False, # optional + service_account_json = {} # optional +) diff --git a/docs/examples/messaging/update-s-m-s.md b/docs/examples/messaging/update-s-m-s.md new file mode 100644 index 0000000..2eec4e2 --- /dev/null +++ b/docs/examples/messaging/update-s-m-s.md @@ -0,0 +1,19 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_sms( + message_id = '', + topics = [], # optional + users = [], # optional + targets = [], # optional + content = '', # optional + draft = False, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/messaging/update-s-m-t-p-provider.md b/docs/examples/messaging/update-s-m-t-p-provider.md new file mode 100644 index 0000000..80019aa --- /dev/null +++ b/docs/examples/messaging/update-s-m-t-p-provider.md @@ -0,0 +1,26 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_smtp_provider( + provider_id = '', + name = '', # optional + host = '', # optional + port = 1, # optional + username = '', # optional + password = '', # optional + encryption = SmtpEncryption.NONE, # optional + auto_tls = False, # optional + mailer = '', # optional + from_name = '', # optional + from_email = 'email@example.com', # optional + reply_to_name = '', # optional + reply_to_email = '', # optional + enabled = False # optional +) diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index bbcb275..84702b4 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_boolean_column( database_id = '', diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 291f6cf..d5d1590 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_datetime_column( database_id = '', diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 042ef85..0e2ccb4 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_email_column( database_id = '', diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index c60fad9..c2268cb 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_enum_column( database_id = '', diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index b84b79c..9e35e83 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_float_column( database_id = '', diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 59f8531..e4aaa83 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -1,5 +1,5 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB from appwrite.enums import IndexType client = Client() @@ -7,7 +7,7 @@ client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('') # Your project ID client.set_key('') # Your secret API key -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_index( database_id = '', diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index d0701cd..0cc20fc 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_integer_column( database_id = '', diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 0775c4a..50aa028 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_ip_column( database_id = '', diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index bf77f47..16acbf8 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,5 +1,5 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB from appwrite.enums import RelationshipType client = Client() @@ -7,7 +7,7 @@ client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint client.set_project('') # Your project ID client.set_key('') # Your secret API key -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_relationship_column( database_id = '', diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 5cdb569..69fee14 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_row( database_id = '', diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index e6ecd3a..656a47a 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_rows( database_id = '', diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 19e49f0..778a0b4 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_string_column( database_id = '', diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index 3b3e579..f258ed8 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_table( database_id = '', diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 32d5eba..b235cdf 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create_url_column( database_id = '', diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 043ed4b..9d64e9a 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.create( database_id = '', diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index 1d5a03f..096bc4d 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.decrement_row_column( database_id = '', diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index 1a134af..9014ccc 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete_column( database_id = '', diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 84045cf..e19de0e 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete_index( database_id = '', diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 30fc8dc..569b607 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete_row( database_id = '', diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index 05eb0fc..c3e836e 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete_rows( database_id = '', diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index b4728da..a91b7bf 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete_table( database_id = '', diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index a56ce6f..5bdc715 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.delete( database_id = '' diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index e3b76c6..57be1df 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.get_column( database_id = '', diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index 5b7e6ca..400bf71 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.get_index( database_id = '', diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index a18da4d..c806214 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.get_row( database_id = '', diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index 252df86..b28cd3d 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.get_table( database_id = '', diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index 93ce63c..6634350 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.get( database_id = '' diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index af93969..bcb88f7 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.increment_row_column( database_id = '', diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 207e367..a3179a9 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.list_columns( database_id = '', diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 9f9f3e6..fe69041 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.list_indexes( database_id = '', diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 2ad2448..9ae7549 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.list_rows( database_id = '', diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 8c61593..2fab0d3 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.list_tables( database_id = '', diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 27b2a36..43cee6a 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.list( queries = [], # optional diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index b343e67..abe6b97 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_boolean_column( database_id = '', diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index d6a8a7c..1c150b5 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_datetime_column( database_id = '', diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 6150f3e..96a56ec 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_email_column( database_id = '', diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index d856611..f07b628 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_enum_column( database_id = '', diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index c6791f5..1dfcccd 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_float_column( database_id = '', diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 368c8a6..a38c4da 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_integer_column( database_id = '', diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index 9cefab7..780a2b0 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_ip_column( database_id = '', diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index e0c1545..1cb93db 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_relationship_column( database_id = '', diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 74f6a29..86d0cf2 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_row( database_id = '', diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 20dd803..386ddf8 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_rows( database_id = '', diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index f2ec02e..f5106ae 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_string_column( database_id = '', diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index b1c8718..7e494f0 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_table( database_id = '', diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index bd684f4..6e6c722 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update_url_column( database_id = '', diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 7df2c02..15c4eb7 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.update( database_id = '', diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index a1717b3..068fded 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.upsert_row( database_id = '', diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index c4ee151..06436c0 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -1,12 +1,12 @@ from appwrite.client import Client -from appwrite.services.tables_db import TablesDb +from appwrite.services.tables_db import TablesDB 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 -tables_db = TablesDb(client) +tables_db = TablesDB(client) result = tables_db.upsert_rows( database_id = '', diff --git a/docs/examples/users/create-m-f-a-recovery-codes.md b/docs/examples/users/create-m-f-a-recovery-codes.md new file mode 100644 index 0000000..64a87c0 --- /dev/null +++ b/docs/examples/users/create-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.create_mfa_recovery_codes( + user_id = '' +) diff --git a/docs/examples/users/delete-m-f-a-authenticator.md b/docs/examples/users/delete-m-f-a-authenticator.md new file mode 100644 index 0000000..6472498 --- /dev/null +++ b/docs/examples/users/delete-m-f-a-authenticator.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +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_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.delete_mfa_authenticator( + user_id = '', + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/users/get-m-f-a-recovery-codes.md b/docs/examples/users/get-m-f-a-recovery-codes.md new file mode 100644 index 0000000..bca43b0 --- /dev/null +++ b/docs/examples/users/get-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.get_mfa_recovery_codes( + user_id = '' +) diff --git a/docs/examples/users/list-m-f-a-factors.md b/docs/examples/users/list-m-f-a-factors.md new file mode 100644 index 0000000..a2b5989 --- /dev/null +++ b/docs/examples/users/list-m-f-a-factors.md @@ -0,0 +1,13 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.list_mfa_factors( + user_id = '' +) diff --git a/docs/examples/users/update-m-f-a-recovery-codes.md b/docs/examples/users/update-m-f-a-recovery-codes.md new file mode 100644 index 0000000..c0990e1 --- /dev/null +++ b/docs/examples/users/update-m-f-a-recovery-codes.md @@ -0,0 +1,13 @@ +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_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.update_mfa_recovery_codes( + user_id = '' +) diff --git a/docs/examples/users/update-m-f-a.md b/docs/examples/users/update-m-f-a.md new file mode 100644 index 0000000..9b35701 --- /dev/null +++ b/docs/examples/users/update-m-f-a.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +users = Users(client) + +result = users.update_mfa( + user_id = '', + mfa = False +)