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/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..1831b74 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,6 +264,39 @@ 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 `account.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. Parameters ---------- @@ -303,6 +330,45 @@ 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 `account.update_mfa_authenticator` instead. + 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 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 ---------- @@ -342,6 +408,39 @@ 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 `account.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. Parameters ---------- @@ -375,6 +474,39 @@ 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 `account.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. Parameters ---------- @@ -408,6 +540,45 @@ 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 `account.update_mfa_challenge` instead. + 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 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 ---------- @@ -464,6 +635,48 @@ def list_mfa_factors(self) -> Dict[str, Any]: 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. + + 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 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 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. @@ -507,6 +720,50 @@ def create_mfa_recovery_codes(self) -> Dict[str, Any]: '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. + + 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 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_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. @@ -533,7 +790,6 @@ def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. - Parameters ---------- name : str @@ -566,7 +822,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 +857,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 +916,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 +948,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 +988,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 +1099,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 +1137,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 +1177,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 +1217,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 +1255,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 +1286,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 +1318,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 @@ -1122,15 +1370,15 @@ def update_status(self) -> Dict[str, Any]: def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> Dict[str, Any]: """ - Sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. + Sends the user an email with a secret key for creating a session. If the email address has never been used, a **new account is created** using the provided `userId`. Otherwise, if the email address is already attached to an account, the **user ID is ignored**. Then, the user will receive an email with the one-time password. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes. A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). - + Parameters ---------- user_id : str - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. email : str User email. phrase : bool @@ -1171,11 +1419,10 @@ 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 - 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. + 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. If the email address has never been used, a new account is created using the provided userId. Otherwise, if the email address is already attached to an account, the user ID is ignored. email : str User email. url : str @@ -1220,7 +1467,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,11 +1509,10 @@ 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 - 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. + 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. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored. phone : str Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. @@ -1305,7 +1550,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 +1582,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 +1642,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..898bc41 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -14,7 +14,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] @@ -47,7 +48,8 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, 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 @@ -89,7 +91,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 +124,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 +167,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 +201,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 +240,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 +295,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 +334,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 +389,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 +429,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 +472,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 +530,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 +588,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 +646,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 +705,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 +764,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 +779,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 +820,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 +888,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 +953,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 +1018,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 +1083,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 +1148,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 +1213,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 +1272,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 +1331,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 +1396,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 +1464,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 +1481,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 +1526,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 +1585,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 +1600,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 +1643,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 +1688,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 +1735,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 +1787,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 +1829,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 +1882,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 +1928,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 +1975,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 +2021,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 +2066,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 +2112,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 +2169,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 +2221,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 +2267,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 +2280,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 +2325,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 +2383,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 +2426,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 +2490,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 +2535,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..1a4fa56 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,6 +354,60 @@ 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 `messaging.create_sms` instead. + 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 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 ---------- @@ -414,6 +463,58 @@ 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. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `messaging.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. + Parameters ---------- @@ -466,7 +567,6 @@ def get_message(self, message_id: str) -> Dict[str, Any]: Get a message by its unique ID. - Parameters ---------- message_id : str @@ -498,7 +598,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 +630,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 +664,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 +698,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,6 +729,63 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None """ Create a new Apple Push Notification service provider. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `messaging.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. Parameters ---------- @@ -690,6 +843,60 @@ 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 `messaging.update_apns_provider` instead. + 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 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 ---------- @@ -744,6 +951,51 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: """ Create a new Firebase Cloud Messaging provider. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `messaging.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. Parameters ---------- @@ -789,6 +1041,48 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool """ 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 `messaging.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. Parameters ---------- @@ -831,7 +1125,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 +1187,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 +1246,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 +1296,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 +1343,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 +1399,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,6 +1452,84 @@ 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 `messaging.create_smtp_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. + 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 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 ---------- @@ -1242,6 +1608,78 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N """ Update a SMTP provider by its unique ID. + .. deprecated::1.8.0 + This API has been deprecated since 1.8.0. Please use `messaging.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. Parameters ---------- @@ -1314,7 +1752,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 +1802,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 +1849,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 +1899,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 +1946,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 +1996,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 +2043,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 +2093,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 +2141,6 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: Get a provider by its unique ID. - Parameters ---------- provider_id : str @@ -1743,7 +2172,6 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. - Parameters ---------- provider_id : str @@ -1776,7 +2204,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 +2238,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 +2272,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 +2303,6 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> """ Create a new topic. - Parameters ---------- topic_id : str @@ -1921,7 +2345,6 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: Get a topic by its unique ID. - Parameters ---------- topic_id : str @@ -1954,7 +2377,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 +2415,6 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. - Parameters ---------- topic_id : str @@ -2026,7 +2447,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 +2481,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 +2518,6 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) - """ Create a new subscriber. - Parameters ---------- topic_id : str @@ -2145,7 +2563,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 +2600,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..578e880 --- /dev/null +++ b/appwrite/services/tables_db.py @@ -0,0 +1,2476 @@ +from ..service import Service +from typing import List, Dict, Any +from ..exception import AppwriteException +from ..enums.relationship_type import RelationshipType; +from ..enums.relation_mutate import RelationMutate; +from ..enums.index_type import IndexType; + +class 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 columns: 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) -> Dict[str, Any]: + """ + Create a new Database. + + + Parameters + ---------- + database_id : str + Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. + name : str + Database name. Max length: 128 chars. + enabled : bool + Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/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 + + 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 columns: 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/tablesdb#tablesDBCreateTable) 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 columns: 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/tablesdb#tablesDBCreate). + 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/tablesdb#tablesDBCreate). + 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/tablesdb#tablesDBCreate). + key : str + Column Key. + size : float + Column size for text columns, 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/tablesdb#tablesDBCreate). + 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 on the table. + + 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/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 columns: 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. + Type can be `key`, `fulltext`, or `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/tablesdb#tablesDBCreate). + 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/tablesdb#tablesDBCreate). + 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/tablesdb#tablesDBCreate). + 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 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. + + 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/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/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 + 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/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/tablesdb#tablesDBCreate). 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/tablesdb#tablesDBCreateTable) 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/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. + + 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/tablesdb#tablesDBCreate). + 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/tablesdb#tablesDBCreateTable) 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/tablesdb#tablesDBCreate). + 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..7886ff5 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,6 +782,45 @@ 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 `users.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. Parameters ---------- @@ -839,6 +860,45 @@ 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 `users.delete_mfa_authenticator` instead. + 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 delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dict[str, Any]: + """ + Delete an authenticator app. Parameters ---------- @@ -878,6 +938,38 @@ 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 `users.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. Parameters ---------- @@ -910,6 +1002,38 @@ 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 `users.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) + + 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 ---------- @@ -942,6 +1066,39 @@ 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 `users.update_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('put', api_path, { + '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 ---------- @@ -975,6 +1132,39 @@ 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 `users.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. Parameters ---------- @@ -1008,7 +1198,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 +1236,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 +1274,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 +1312,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 +1343,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 +1381,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 +1414,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 +1446,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 +1478,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 +1516,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 +1554,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 +1588,6 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr """ Create a messaging target. - Parameters ---------- user_id : str @@ -1466,7 +1644,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 +1681,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 +1728,6 @@ def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. - Parameters ---------- user_id : str @@ -1592,7 +1767,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 +1805,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 +1843,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/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/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/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/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 new file mode 100644 index 0000000..84702b4 --- /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..d5d1590 --- /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..0e2ccb4 --- /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..c2268cb --- /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..9e35e83 --- /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..e4aaa83 --- /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..0cc20fc --- /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..50aa028 --- /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..16acbf8 --- /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..69fee14 --- /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..656a47a --- /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..778a0b4 --- /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..f258ed8 --- /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..b235cdf --- /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..9d64e9a --- /dev/null +++ b/docs/examples/tablesdb/create.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( + database_id = '', + name = '', + enabled = False # 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..096bc4d --- /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_session('') # The user session to authenticate with + +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..9014ccc --- /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..e19de0e --- /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..569b607 --- /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..c3e836e --- /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..a91b7bf --- /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..5bdc715 --- /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..57be1df --- /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..400bf71 --- /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..c806214 --- /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..b28cd3d --- /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..6634350 --- /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..bcb88f7 --- /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_session('') # The user session to authenticate with + +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..a3179a9 --- /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..fe69041 --- /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..9ae7549 --- /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..2fab0d3 --- /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..43cee6a --- /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..abe6b97 --- /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..1c150b5 --- /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..96a56ec --- /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..f07b628 --- /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..1dfcccd --- /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..a38c4da --- /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..780a2b0 --- /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..1cb93db --- /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..86d0cf2 --- /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..386ddf8 --- /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..f5106ae --- /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..7e494f0 --- /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..6e6c722 --- /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..15c4eb7 --- /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..068fded --- /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..06436c0 --- /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/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 +) 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', ],