diff --git a/CHANGELOG.md b/CHANGELOG.md index fa4d35e..ff63134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,28 @@ -# Change Log \ No newline at end of file +# Change Log + +## 11.1.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Add `dart38` and `flutter332` support to runtime models +* Add `gif` support to `ImageFormat` enum +* Add `upsertDocument` support to `Databases` service + +## 11.0.0 + +* Add `` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Remove `search` param from `listExecutions` method + +## 10.0.0 + +* Fix requests failing by removing `Content-Type` header from `GET` and `HEAD` requests + +## 9.0.3 + +* Update sdk to use Numpy-style docstrings diff --git a/README.md b/README.md index 2efa745..a68a5ae 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Python SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.7.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) diff --git a/appwrite/client.py b/appwrite/client.py index b7ab483..ed4d4b5 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -14,11 +14,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/11.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/11.1.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', 'x-sdk-name': 'Python', 'x-sdk-platform': 'server', 'x-sdk-language': 'python', - 'x-sdk-version': '11.0.0', + 'x-sdk-version': '11.1.0', 'X-Appwrite-Response-Format' : '1.7.0', } diff --git a/appwrite/enums/build_runtime.py b/appwrite/enums/build_runtime.py index 9ba151b..aded697 100644 --- a/appwrite/enums/build_runtime.py +++ b/appwrite/enums/build_runtime.py @@ -38,6 +38,7 @@ class BuildRuntime(Enum): DART_3_1 = "dart-3.1" DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" + DART_3_8 = "dart-3.8" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -64,3 +65,4 @@ class BuildRuntime(Enum): FLUTTER_3_24 = "flutter-3.24" FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" + FLUTTER_3_32 = "flutter-3.32" diff --git a/appwrite/enums/image_format.py b/appwrite/enums/image_format.py index 33c6c99..332f646 100644 --- a/appwrite/enums/image_format.py +++ b/appwrite/enums/image_format.py @@ -7,3 +7,4 @@ class ImageFormat(Enum): WEBP = "webp" HEIC = "heic" AVIF = "avif" + GIF = "gif" diff --git a/appwrite/enums/runtime.py b/appwrite/enums/runtime.py index df2cb34..b0e307a 100644 --- a/appwrite/enums/runtime.py +++ b/appwrite/enums/runtime.py @@ -38,6 +38,7 @@ class Runtime(Enum): DART_3_1 = "dart-3.1" DART_3_3 = "dart-3.3" DART_3_5 = "dart-3.5" + DART_3_8 = "dart-3.8" DOTNET_6_0 = "dotnet-6.0" DOTNET_7_0 = "dotnet-7.0" DOTNET_8_0 = "dotnet-8.0" @@ -64,3 +65,4 @@ class Runtime(Enum): FLUTTER_3_24 = "flutter-3.24" FLUTTER_3_27 = "flutter-3.27" FLUTTER_3_29 = "flutter-3.29" + FLUTTER_3_32 = "flutter-3.32" diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 9dd3c5e..6062ad4 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -35,6 +35,7 @@ def create(self, user_id: str, email: str, password: str, name: str = None) -> D """ Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession). + Parameters ---------- user_id : str @@ -84,6 +85,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + Parameters ---------- email : str @@ -122,6 +124,7 @@ def list_identities(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. + Parameters ---------- queries : List[str] @@ -150,6 +153,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -204,6 +208,7 @@ def list_logs(self, queries: List[str] = None) -> Dict[str, Any]: """ Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log. + Parameters ---------- queries : List[str] @@ -232,6 +237,7 @@ def update_mfa(self, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on an account. + Parameters ---------- mfa : bool @@ -264,6 +270,7 @@ def create_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -296,6 +303,7 @@ def update_mfa_authenticator(self, type: AuthenticatorType, otp: str) -> Dict[st """ Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + Parameters ---------- type : AuthenticatorType @@ -334,6 +342,7 @@ def delete_mfa_authenticator(self, type: AuthenticatorType) -> Dict[str, Any]: """ Delete an authenticator for a user by ID. + Parameters ---------- type : AuthenticatorType @@ -366,6 +375,7 @@ def create_mfa_challenge(self, factor: AuthenticationFactor) -> Dict[str, Any]: """ Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + Parameters ---------- factor : AuthenticationFactor @@ -398,6 +408,7 @@ def update_mfa_challenge(self, challenge_id: str, otp: str) -> Dict[str, Any]: """ Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method. + Parameters ---------- challenge_id : str @@ -522,6 +533,7 @@ def update_name(self, name: str) -> Dict[str, Any]: """ Update currently logged in user account name. + Parameters ---------- name : str @@ -554,6 +566,7 @@ def update_password(self, password: str, old_password: str = None) -> Dict[str, """ Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional. + Parameters ---------- password : str @@ -589,6 +602,7 @@ def update_phone(self, phone: str, password: str) -> Dict[str, Any]: """ Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS. + Parameters ---------- phone : str @@ -648,6 +662,7 @@ def update_prefs(self, prefs: dict) -> Dict[str, Any]: """ Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- prefs : dict @@ -680,6 +695,7 @@ def create_recovery(self, email: str, url: str) -> Dict[str, Any]: """ Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. + Parameters ---------- email : str @@ -720,6 +736,7 @@ def update_recovery(self, user_id: str, secret: str, password: str) -> Dict[str, Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- user_id : str @@ -831,6 +848,7 @@ def create_email_password_session(self, email: str, password: str) -> Dict[str, A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- email : str @@ -869,6 +887,7 @@ def update_magic_url_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -907,6 +926,7 @@ def update_phone_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -945,6 +965,7 @@ def create_session(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login. + Parameters ---------- user_id : str @@ -983,6 +1004,7 @@ def get_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + Parameters ---------- session_id : str @@ -1014,6 +1036,7 @@ def update_session(self, session_id: str) -> Dict[str, Any]: """ Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider. + Parameters ---------- session_id : str @@ -1046,6 +1069,7 @@ def delete_session(self, session_id: str) -> Dict[str, Any]: """ Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead. + Parameters ---------- session_id : str @@ -1102,6 +1126,7 @@ def create_email_token(self, user_id: str, email: str, phrase: bool = None) -> D A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1146,6 +1171,7 @@ def create_magic_url_token(self, user_id: str, email: str, url: str = None, phra A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1194,6 +1220,7 @@ def create_o_auth2_token(self, provider: OAuthProvider, success: str = None, fai A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- provider : OAuthProvider @@ -1236,6 +1263,7 @@ def create_phone_token(self, user_id: str, phone: str) -> Dict[str, Any]: A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). + Parameters ---------- user_id : str @@ -1277,6 +1305,7 @@ def create_verification(self, url: str) -> Dict[str, Any]: Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. + Parameters ---------- url : str @@ -1309,6 +1338,7 @@ def update_verification(self, user_id: str, secret: str) -> Dict[str, Any]: """ Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str @@ -1369,6 +1399,7 @@ def update_phone_verification(self, user_id: str, secret: str) -> Dict[str, Any] """ Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code. + Parameters ---------- user_id : str diff --git a/appwrite/services/avatars.py b/appwrite/services/avatars.py index 6ee1d4f..2bd32f7 100644 --- a/appwrite/services/avatars.py +++ b/appwrite/services/avatars.py @@ -16,6 +16,7 @@ def get_browser(self, code: Browser, width: float = None, height: float = None, When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Browser @@ -59,6 +60,7 @@ def get_credit_card(self, code: CreditCard, width: float = None, height: float = When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : CreditCard @@ -101,6 +103,7 @@ def get_favicon(self, url: str) -> bytes: This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -135,6 +138,7 @@ def get_flag(self, code: Flag, width: float = None, height: float = None, qualit When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- code : Flag @@ -179,6 +183,7 @@ def get_image(self, url: str, width: float = None, height: float = None) -> byte This endpoint does not follow HTTP redirects. + Parameters ---------- url : str @@ -221,6 +226,7 @@ def get_initials(self, name: str = None, width: float = None, height: float = No When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + Parameters ---------- name : str @@ -259,6 +265,7 @@ def get_qr(self, text: str, size: float = None, margin: float = None, download: Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + Parameters ---------- text : str diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index b798f7c..40b7372 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, Create a new Database. + Parameters ---------- database_id : str @@ -87,6 +89,7 @@ def get(self, database_id: str) -> Dict[str, Any]: """ Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + Parameters ---------- database_id : str @@ -118,6 +121,7 @@ def update(self, database_id: str, name: str, enabled: bool = None) -> Dict[str, """ Update a database by its unique ID. + Parameters ---------- database_id : str @@ -159,6 +163,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: """ Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + Parameters ---------- database_id : str @@ -191,6 +196,7 @@ def list_collections(self, database_id: str, queries: List[str] = None, search: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + Parameters ---------- database_id : str @@ -228,6 +234,7 @@ def create_collection(self, database_id: str, collection_id: str, name: str, per """ Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -281,6 +288,7 @@ def get_collection(self, database_id: str, collection_id: str) -> Dict[str, Any] """ Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + Parameters ---------- database_id : str @@ -318,6 +326,7 @@ def update_collection(self, database_id: str, collection_id: str, name: str, per """ Update a collection by its unique ID. + Parameters ---------- database_id : str @@ -371,6 +380,7 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A """ Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- database_id : str @@ -409,6 +419,7 @@ def list_attributes(self, database_id: str, collection_id: str, queries: List[st """ List attributes in the collection. + Parameters ---------- database_id : str @@ -450,6 +461,7 @@ def create_boolean_attribute(self, database_id: str, collection_id: str, key: st Create a boolean attribute. + Parameters ---------- database_id : str @@ -506,6 +518,7 @@ def update_boolean_attribute(self, database_id: str, collection_id: str, key: st """ Update a boolean attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -562,6 +575,7 @@ def create_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Create a date time attribute according to the ISO 8601 standard. + Parameters ---------- database_id : str @@ -618,6 +632,7 @@ def update_datetime_attribute(self, database_id: str, collection_id: str, key: s """ Update a date time attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -675,6 +690,7 @@ def create_email_attribute(self, database_id: str, collection_id: str, key: str, Create an email attribute. + Parameters ---------- database_id : str @@ -732,6 +748,7 @@ def update_email_attribute(self, database_id: str, collection_id: str, key: str, Update an email attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -789,6 +806,7 @@ def create_enum_attribute(self, database_id: str, collection_id: str, key: str, Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute. + Parameters ---------- database_id : str @@ -852,6 +870,7 @@ def update_enum_attribute(self, database_id: str, collection_id: str, key: str, Update an enum attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -915,6 +934,7 @@ def create_float_attribute(self, database_id: str, collection_id: str, key: str, Create a float attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -978,6 +998,7 @@ def update_float_attribute(self, database_id: str, collection_id: str, key: str, Update a float attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1041,6 +1062,7 @@ def create_integer_attribute(self, database_id: str, collection_id: str, key: st Create an integer attribute. Optionally, minimum and maximum values can be provided. + Parameters ---------- database_id : str @@ -1104,6 +1126,7 @@ def update_integer_attribute(self, database_id: str, collection_id: str, key: st Update an integer attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1167,6 +1190,7 @@ def create_ip_attribute(self, database_id: str, collection_id: str, key: str, re Create IP address attribute. + Parameters ---------- database_id : str @@ -1224,6 +1248,7 @@ def update_ip_attribute(self, database_id: str, collection_id: str, key: str, re Update an ip attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1281,6 +1306,7 @@ def create_relationship_attribute(self, database_id: str, collection_id: str, re Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1344,6 +1370,7 @@ def create_string_attribute(self, database_id: str, collection_id: str, key: str Create a string attribute. + Parameters ---------- database_id : str @@ -1410,6 +1437,7 @@ def update_string_attribute(self, database_id: str, collection_id: str, key: str Update a string attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1470,6 +1498,7 @@ def create_url_attribute(self, database_id: str, collection_id: str, key: str, r Create a URL attribute. + Parameters ---------- database_id : str @@ -1527,6 +1556,7 @@ def update_url_attribute(self, database_id: str, collection_id: str, key: str, r Update an url attribute. Changing the `default` value will not update already existing documents. + Parameters ---------- database_id : str @@ -1583,6 +1613,7 @@ def get_attribute(self, database_id: str, collection_id: str, key: str) -> Dict[ """ Get attribute by ID. + Parameters ---------- database_id : str @@ -1626,6 +1657,7 @@ def delete_attribute(self, database_id: str, collection_id: str, key: str) -> Di """ Deletes an attribute. + Parameters ---------- database_id : str @@ -1671,6 +1703,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + Parameters ---------- database_id : str @@ -1721,6 +1754,7 @@ def list_documents(self, database_id: str, collection_id: str, queries: List[str """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + Parameters ---------- database_id : str @@ -1761,6 +1795,7 @@ def create_document(self, database_id: str, collection_id: str, document_id: str """ Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1812,8 +1847,11 @@ def create_document(self, database_id: str, collection_id: str, document_id: str def create_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1854,11 +1892,14 @@ def create_documents(self, database_id: str, collection_id: str, documents: List 'content-type': 'application/json', }, api_params) - def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict] = None) -> Dict[str, Any]: + def upsert_documents(self, database_id: str, collection_id: str, documents: List[dict]) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + Parameters ---------- database_id : str @@ -1887,6 +1928,9 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List if collection_id is None: raise AppwriteException('Missing required parameter: "collection_id"') + if documents is None: + raise AppwriteException('Missing required parameter: "documents"') + api_path = api_path.replace('{databaseId}', database_id) api_path = api_path.replace('{collectionId}', collection_id) @@ -1898,8 +1942,11 @@ def upsert_documents(self, database_id: str, collection_id: str, documents: List def update_documents(self, database_id: str, collection_id: str, data: dict = None, queries: List[str] = None) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + Parameters ---------- database_id : str @@ -1942,8 +1989,11 @@ def update_documents(self, database_id: str, collection_id: str, data: dict = No def delete_documents(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + Bulk delete documents using queries, if no queries are passed then all documents are deleted. + Parameters ---------- database_id : str @@ -1985,6 +2035,7 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q """ Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + Parameters ---------- database_id : str @@ -2027,10 +2078,67 @@ def get_document(self, database_id: str, collection_id: str, document_id: str, q return self.client.call('get', api_path, { }, api_params) + def upsert_document(self, database_id: str, collection_id: str, document_id: str, data: dict, permissions: List[str] = None) -> Dict[str, Any]: + """ + **WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. + + Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + data : dict + Document data as JSON object. Include all required attributes of the document to be created or updated. + permissions : List[str] + An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if data is None: + raise AppwriteException('Missing required parameter: "data"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + + api_params['data'] = data + api_params['permissions'] = permissions + + return self.client.call('put', api_path, { + 'content-type': 'application/json', + }, api_params) + def update_document(self, database_id: str, collection_id: str, document_id: str, data: dict = None, permissions: List[str] = None) -> Dict[str, Any]: """ Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + Parameters ---------- database_id : str @@ -2081,6 +2189,7 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str """ Delete a document by its unique ID. + Parameters ---------- database_id : str @@ -2121,10 +2230,125 @@ def delete_document(self, database_id: str, collection_id: str, document_id: str 'content-type': 'application/json', }, api_params) + def decrement_document_attribute(self, database_id: str, collection_id: str, document_id: str, attribute: str, value: float = None, min: float = None) -> Dict[str, Any]: + """ + Decrement a specific attribute of a document by a given value. + + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + attribute : str + Attribute key. + value : float + Value to decrement the attribute by. The value must be a number. + min : float + Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if attribute is None: + raise AppwriteException('Missing required parameter: "attribute"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + api_path = api_path.replace('{attribute}', attribute) + + api_params['value'] = value + api_params['min'] = min + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + + def increment_document_attribute(self, database_id: str, collection_id: str, document_id: str, attribute: str, value: float = None, max: float = None) -> Dict[str, Any]: + """ + Increment a specific attribute of a document by a given value. + + + Parameters + ---------- + database_id : str + Database ID. + collection_id : str + Collection ID. + document_id : str + Document ID. + attribute : str + Attribute key. + value : float + Value to increment the attribute by. The value must be a number. + max : float + Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + + Returns + ------- + Dict[str, Any] + API response as a dictionary + + Raises + ------ + AppwriteException + If API request fails + """ + + api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment' + api_params = {} + if database_id is None: + raise AppwriteException('Missing required parameter: "database_id"') + + if collection_id is None: + raise AppwriteException('Missing required parameter: "collection_id"') + + if document_id is None: + raise AppwriteException('Missing required parameter: "document_id"') + + if attribute is None: + raise AppwriteException('Missing required parameter: "attribute"') + + api_path = api_path.replace('{databaseId}', database_id) + api_path = api_path.replace('{collectionId}', collection_id) + api_path = api_path.replace('{documentId}', document_id) + api_path = api_path.replace('{attribute}', attribute) + + api_params['value'] = value + api_params['max'] = max + + return self.client.call('patch', api_path, { + 'content-type': 'application/json', + }, api_params) + def list_indexes(self, database_id: str, collection_id: str, queries: List[str] = None) -> Dict[str, Any]: """ List indexes in the collection. + Parameters ---------- database_id : str @@ -2166,6 +2390,7 @@ def create_index(self, database_id: str, collection_id: str, key: str, type: Ind Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. Attributes can be `key`, `fulltext`, and `unique`. + Parameters ---------- database_id : str @@ -2228,6 +2453,7 @@ def get_index(self, database_id: str, collection_id: str, key: str) -> Dict[str, """ Get index by ID. + Parameters ---------- database_id : str @@ -2271,6 +2497,7 @@ def delete_index(self, database_id: str, collection_id: str, key: str) -> Dict[s """ Delete an index. + Parameters ---------- database_id : str diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 9dce425..3dd2459 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -16,6 +16,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -47,6 +48,7 @@ def create(self, function_id: str, name: str, runtime: Runtime, execute: List[st """ Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + Parameters ---------- function_id : str @@ -178,6 +180,7 @@ def get(self, function_id: str) -> Dict[str, Any]: """ Get a function by its unique ID. + Parameters ---------- function_id : str @@ -209,6 +212,7 @@ def update(self, function_id: str, name: str, runtime: Runtime = None, execute: """ Update function by its unique ID. + Parameters ---------- function_id : str @@ -295,6 +299,7 @@ def delete(self, function_id: str) -> Dict[str, Any]: """ Delete a function by its unique ID. + Parameters ---------- function_id : str @@ -327,6 +332,7 @@ def update_function_deployment(self, function_id: str, deployment_id: str) -> Di """ Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + Parameters ---------- function_id : str @@ -365,6 +371,7 @@ def list_deployments(self, function_id: str, queries: List[str] = None, search: """ Get a list of all the function's code deployments. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -406,6 +413,7 @@ def create_deployment(self, function_id: str, code: InputFile, activate: bool, e Use the "command" param to set the entrypoint used to execute your code. + Parameters ---------- function_id : str @@ -463,6 +471,7 @@ def create_duplicate_deployment(self, function_id: str, deployment_id: str, buil """ Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- function_id : str @@ -506,6 +515,7 @@ def create_template_deployment(self, function_id: str, repository: str, owner: s Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + Parameters ---------- function_id : str @@ -567,6 +577,7 @@ def create_vcs_deployment(self, function_id: str, type: VCSDeploymentType, refer This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- function_id : str @@ -614,6 +625,7 @@ def get_deployment(self, function_id: str, deployment_id: str) -> Dict[str, Any] """ Get a function deployment by its unique ID. + Parameters ---------- function_id : str @@ -651,6 +663,7 @@ def delete_deployment(self, function_id: str, deployment_id: str) -> Dict[str, A """ Delete a code deployment by its unique ID. + Parameters ---------- function_id : str @@ -689,6 +702,7 @@ def get_deployment_download(self, function_id: str, deployment_id: str, type: De """ Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- function_id : str @@ -729,6 +743,7 @@ def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict """ Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- function_id : str @@ -767,6 +782,7 @@ def list_executions(self, function_id: str, queries: List[str] = None) -> Dict[s """ Get a list of all the current user function execution logs. You can use the query params to filter your results. + Parameters ---------- function_id : str @@ -801,6 +817,7 @@ def create_execution(self, function_id: str, body: str = None, xasync: bool = No """ Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + Parameters ---------- function_id : str @@ -851,6 +868,7 @@ def get_execution(self, function_id: str, execution_id: str) -> Dict[str, Any]: """ Get a function execution log by its unique ID. + Parameters ---------- function_id : str @@ -888,6 +906,7 @@ def delete_execution(self, function_id: str, execution_id: str) -> Dict[str, Any """ Delete a function execution by its unique ID. + Parameters ---------- function_id : str @@ -926,6 +945,7 @@ def list_variables(self, function_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific function. + Parameters ---------- function_id : str @@ -957,6 +977,7 @@ def create_variable(self, function_id: str, key: str, value: str, secret: bool = """ Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + Parameters ---------- function_id : str @@ -1004,6 +1025,7 @@ def get_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- function_id : str @@ -1041,6 +1063,7 @@ def update_variable(self, function_id: str, variable_id: str, key: str, value: s """ Update variable by its unique ID. + Parameters ---------- function_id : str @@ -1091,6 +1114,7 @@ def delete_variable(self, function_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- function_id : str diff --git a/appwrite/services/graphql.py b/appwrite/services/graphql.py index 22ca3aa..69ad4e0 100644 --- a/appwrite/services/graphql.py +++ b/appwrite/services/graphql.py @@ -11,6 +11,7 @@ def query(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict @@ -44,6 +45,7 @@ def mutation(self, query: dict) -> Dict[str, Any]: """ Execute a GraphQL mutation. + Parameters ---------- query : dict diff --git a/appwrite/services/health.py b/appwrite/services/health.py index dd1d183..665fd1e 100644 --- a/appwrite/services/health.py +++ b/appwrite/services/health.py @@ -75,6 +75,7 @@ def get_certificate(self, domain: str = None) -> Dict[str, Any]: """ Get the SSL certificate for a domain + Parameters ---------- domain : str @@ -145,6 +146,7 @@ def get_queue_builds(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -173,6 +175,7 @@ def get_queue_certificates(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -201,6 +204,7 @@ def get_queue_databases(self, name: str = None, threshold: float = None) -> Dict """ Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- name : str @@ -232,6 +236,7 @@ def get_queue_deletes(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -261,6 +266,7 @@ def get_failed_jobs(self, name: Name, threshold: float = None) -> Dict[str, Any] Returns the amount of failed jobs in a given queue. + Parameters ---------- name : Name @@ -295,6 +301,7 @@ def get_queue_functions(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -323,6 +330,7 @@ def get_queue_logs(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -351,6 +359,7 @@ def get_queue_mails(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -379,6 +388,7 @@ def get_queue_messaging(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -407,6 +417,7 @@ def get_queue_migrations(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -435,6 +446,7 @@ def get_queue_stats_resources(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + Parameters ---------- threshold : float @@ -463,6 +475,7 @@ def get_queue_usage(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float @@ -491,6 +504,7 @@ def get_queue_webhooks(self, threshold: float = None) -> Dict[str, Any]: """ Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + Parameters ---------- threshold : float diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 639a820..153a1f7 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -13,6 +13,7 @@ def list_messages(self, queries: List[str] = None, search: str = None) -> Dict[s """ Get a list of all messages from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -44,6 +45,7 @@ def create_email(self, message_id: str, subject: str, content: str, topics: List """ Create a new email message. + Parameters ---------- message_id : str @@ -116,6 +118,7 @@ def update_email(self, message_id: str, topics: List[str] = None, users: List[st Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -181,6 +184,7 @@ def create_push(self, message_id: str, title: str = None, body: str = None, topi """ Create a new push notification. + Parameters ---------- message_id : str @@ -268,6 +272,7 @@ def update_push(self, message_id: str, topics: List[str] = None, users: List[str Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -354,6 +359,7 @@ def create_sms(self, message_id: str, content: str, topics: List[str] = None, us """ Create a new SMS message. + Parameters ---------- message_id : str @@ -408,6 +414,7 @@ def update_sms(self, message_id: str, topics: List[str] = None, users: List[str] Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + Parameters ---------- message_id : str @@ -459,6 +466,7 @@ def get_message(self, message_id: str) -> Dict[str, Any]: Get a message by its unique ID. + Parameters ---------- message_id : str @@ -490,6 +498,7 @@ def delete(self, message_id: str) -> Dict[str, Any]: """ Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + Parameters ---------- message_id : str @@ -522,6 +531,7 @@ def list_message_logs(self, message_id: str, queries: List[str] = None) -> Dict[ """ Get the message activity logs listed by its unique ID. + Parameters ---------- message_id : str @@ -556,6 +566,7 @@ def list_targets(self, message_id: str, queries: List[str] = None) -> Dict[str, """ Get a list of the targets associated with a message. + Parameters ---------- message_id : str @@ -590,6 +601,7 @@ def list_providers(self, queries: List[str] = None, search: str = None) -> Dict[ """ Get a list of all providers from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -621,6 +633,7 @@ def create_apns_provider(self, provider_id: str, name: str, auth_key: str = None """ Create a new Apple Push Notification service provider. + Parameters ---------- provider_id : str @@ -677,6 +690,7 @@ def update_apns_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Apple Push Notification service provider by its unique ID. + Parameters ---------- provider_id : str @@ -730,6 +744,7 @@ def create_fcm_provider(self, provider_id: str, name: str, service_account_json: """ Create a new Firebase Cloud Messaging provider. + Parameters ---------- provider_id : str @@ -774,6 +789,7 @@ def update_fcm_provider(self, provider_id: str, name: str = None, enabled: bool """ Update a Firebase Cloud Messaging provider by its unique ID. + Parameters ---------- provider_id : str @@ -815,6 +831,7 @@ def create_mailgun_provider(self, provider_id: str, name: str, api_key: str = No """ Create a new Mailgun provider. + Parameters ---------- provider_id : str @@ -877,6 +894,7 @@ def update_mailgun_provider(self, provider_id: str, name: str = None, api_key: s """ Update a Mailgun provider by its unique ID. + Parameters ---------- provider_id : str @@ -936,6 +954,7 @@ def create_msg91_provider(self, provider_id: str, name: str, template_id: str = """ Create a new MSG91 provider. + Parameters ---------- provider_id : str @@ -986,6 +1005,7 @@ def update_msg91_provider(self, provider_id: str, name: str = None, enabled: boo """ Update a MSG91 provider by its unique ID. + Parameters ---------- provider_id : str @@ -1033,6 +1053,7 @@ def create_sendgrid_provider(self, provider_id: str, name: str, api_key: str = N """ Create a new Sendgrid provider. + Parameters ---------- provider_id : str @@ -1089,6 +1110,7 @@ def update_sendgrid_provider(self, provider_id: str, name: str = None, enabled: """ Update a Sendgrid provider by its unique ID. + Parameters ---------- provider_id : str @@ -1142,6 +1164,7 @@ def create_smtp_provider(self, provider_id: str, name: str, host: str, port: flo """ Create a new SMTP provider. + Parameters ---------- provider_id : str @@ -1219,6 +1242,7 @@ def update_smtp_provider(self, provider_id: str, name: str = None, host: str = N """ Update a SMTP provider by its unique ID. + Parameters ---------- provider_id : str @@ -1290,6 +1314,7 @@ def create_telesign_provider(self, provider_id: str, name: str, xfrom: str = Non """ Create a new Telesign provider. + Parameters ---------- provider_id : str @@ -1340,6 +1365,7 @@ def update_telesign_provider(self, provider_id: str, name: str = None, enabled: """ Update a Telesign provider by its unique ID. + Parameters ---------- provider_id : str @@ -1387,6 +1413,7 @@ def create_textmagic_provider(self, provider_id: str, name: str, xfrom: str = No """ Create a new Textmagic provider. + Parameters ---------- provider_id : str @@ -1437,6 +1464,7 @@ def update_textmagic_provider(self, provider_id: str, name: str = None, enabled: """ Update a Textmagic provider by its unique ID. + Parameters ---------- provider_id : str @@ -1484,6 +1512,7 @@ def create_twilio_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Twilio provider. + Parameters ---------- provider_id : str @@ -1534,6 +1563,7 @@ def update_twilio_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Twilio provider by its unique ID. + Parameters ---------- provider_id : str @@ -1581,6 +1611,7 @@ def create_vonage_provider(self, provider_id: str, name: str, xfrom: str = None, """ Create a new Vonage provider. + Parameters ---------- provider_id : str @@ -1631,6 +1662,7 @@ def update_vonage_provider(self, provider_id: str, name: str = None, enabled: bo """ Update a Vonage provider by its unique ID. + Parameters ---------- provider_id : str @@ -1679,6 +1711,7 @@ def get_provider(self, provider_id: str) -> Dict[str, Any]: Get a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1710,6 +1743,7 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: """ Delete a provider by its unique ID. + Parameters ---------- provider_id : str @@ -1742,6 +1776,7 @@ def list_provider_logs(self, provider_id: str, queries: List[str] = None) -> Dic """ Get the provider activity logs listed by its unique ID. + Parameters ---------- provider_id : str @@ -1776,6 +1811,7 @@ def list_subscriber_logs(self, subscriber_id: str, queries: List[str] = None) -> """ Get the subscriber activity logs listed by its unique ID. + Parameters ---------- subscriber_id : str @@ -1810,6 +1846,7 @@ def list_topics(self, queries: List[str] = None, search: str = None) -> Dict[str """ Get a list of all topics from the current Appwrite project. + Parameters ---------- queries : List[str] @@ -1841,6 +1878,7 @@ def create_topic(self, topic_id: str, name: str, subscribe: List[str] = None) -> """ Create a new topic. + Parameters ---------- topic_id : str @@ -1883,6 +1921,7 @@ def get_topic(self, topic_id: str) -> Dict[str, Any]: Get a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1915,6 +1954,7 @@ def update_topic(self, topic_id: str, name: str = None, subscribe: List[str] = N Update a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1953,6 +1993,7 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: """ Delete a topic by its unique ID. + Parameters ---------- topic_id : str @@ -1985,6 +2026,7 @@ def list_topic_logs(self, topic_id: str, queries: List[str] = None) -> Dict[str, """ Get the topic activity logs listed by its unique ID. + Parameters ---------- topic_id : str @@ -2019,6 +2061,7 @@ def list_subscribers(self, topic_id: str, queries: List[str] = None, search: str """ Get a list of all subscribers from the current Appwrite project. + Parameters ---------- topic_id : str @@ -2056,6 +2099,7 @@ def create_subscriber(self, topic_id: str, subscriber_id: str, target_id: str) - """ Create a new subscriber. + Parameters ---------- topic_id : str @@ -2101,6 +2145,7 @@ def get_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any]: Get a subscriber by its unique ID. + Parameters ---------- topic_id : str @@ -2138,6 +2183,7 @@ def delete_subscriber(self, topic_id: str, subscriber_id: str) -> Dict[str, Any] """ Delete a subscriber by its unique ID. + Parameters ---------- topic_id : str diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index bcb7597..857cabe 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -17,6 +17,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's sites. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -48,6 +49,7 @@ def create(self, site_id: str, name: str, framework: Framework, build_runtime: B """ Create a new site. + Parameters ---------- site_id : str @@ -182,6 +184,7 @@ def get(self, site_id: str) -> Dict[str, Any]: """ Get a site by its unique ID. + Parameters ---------- site_id : str @@ -213,6 +216,7 @@ def update(self, site_id: str, name: str, framework: Framework, enabled: bool = """ Update site by its unique ID. + Parameters ---------- site_id : str @@ -302,6 +306,7 @@ def delete(self, site_id: str) -> Dict[str, Any]: """ Delete a site by its unique ID. + Parameters ---------- site_id : str @@ -334,6 +339,7 @@ def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, """ Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + Parameters ---------- site_id : str @@ -372,6 +378,7 @@ def list_deployments(self, site_id: str, queries: List[str] = None, search: str """ Get a list of all the site's code deployments. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -409,6 +416,7 @@ def create_deployment(self, site_id: str, code: InputFile, activate: bool, insta """ Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + Parameters ---------- site_id : str @@ -469,6 +477,7 @@ def create_duplicate_deployment(self, site_id: str, deployment_id: str) -> Dict[ """ Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + Parameters ---------- site_id : str @@ -509,6 +518,7 @@ def create_template_deployment(self, site_id: str, repository: str, owner: str, Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + Parameters ---------- site_id : str @@ -570,6 +580,7 @@ def create_vcs_deployment(self, site_id: str, type: VCSDeploymentType, reference This endpoint lets you create deployment from a branch, commit, or a tag. + Parameters ---------- site_id : str @@ -617,6 +628,7 @@ def get_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Get a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -654,6 +666,7 @@ def delete_deployment(self, site_id: str, deployment_id: str) -> Dict[str, Any]: """ Delete a site deployment by its unique ID. + Parameters ---------- site_id : str @@ -692,6 +705,7 @@ def get_deployment_download(self, site_id: str, deployment_id: str, type: Deploy """ Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- site_id : str @@ -732,6 +746,7 @@ def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str """ Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + Parameters ---------- site_id : str @@ -770,6 +785,7 @@ def list_logs(self, site_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get a list of all site logs. You can use the query params to filter your results. + Parameters ---------- site_id : str @@ -804,6 +820,7 @@ def get_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Get a site request log by its unique ID. + Parameters ---------- site_id : str @@ -841,6 +858,7 @@ def delete_log(self, site_id: str, log_id: str) -> Dict[str, Any]: """ Delete a site log by its unique ID. + Parameters ---------- site_id : str @@ -879,6 +897,7 @@ def list_variables(self, site_id: str) -> Dict[str, Any]: """ Get a list of all variables of a specific site. + Parameters ---------- site_id : str @@ -910,6 +929,7 @@ def create_variable(self, site_id: str, key: str, value: str, secret: bool = Non """ Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + Parameters ---------- site_id : str @@ -957,6 +977,7 @@ def get_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Get a variable by its unique ID. + Parameters ---------- site_id : str @@ -994,6 +1015,7 @@ def update_variable(self, site_id: str, variable_id: str, key: str, value: str = """ Update variable by its unique ID. + Parameters ---------- site_id : str @@ -1044,6 +1066,7 @@ def delete_variable(self, site_id: str, variable_id: str) -> Dict[str, Any]: """ Delete a variable by its unique ID. + Parameters ---------- site_id : str diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 22198eb..e970187 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -15,6 +15,7 @@ def list_buckets(self, queries: List[str] = None, search: str = None) -> Dict[st """ Get a list of all the storage buckets. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -46,6 +47,7 @@ def create_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Create a new storage bucket. + Parameters ---------- bucket_id : str @@ -108,6 +110,7 @@ def get_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + Parameters ---------- bucket_id : str @@ -139,6 +142,7 @@ def update_bucket(self, bucket_id: str, name: str, permissions: List[str] = None """ Update a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -201,6 +205,7 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: """ Delete a storage bucket by its unique ID. + Parameters ---------- bucket_id : str @@ -233,6 +238,7 @@ def list_files(self, bucket_id: str, queries: List[str] = None, search: str = No """ Get a list of all the user files. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -277,6 +283,7 @@ def create_file(self, bucket_id: str, file_id: str, file: InputFile, permissions If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + Parameters ---------- bucket_id : str @@ -332,6 +339,7 @@ def get_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + Parameters ---------- bucket_id : str @@ -369,6 +377,7 @@ def update_file(self, bucket_id: str, file_id: str, name: str = None, permission """ Update a file by its unique ID. Only users with write permissions have access to update this resource. + Parameters ---------- bucket_id : str @@ -413,6 +422,7 @@ def delete_file(self, bucket_id: str, file_id: str) -> Dict[str, Any]: """ Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + Parameters ---------- bucket_id : str @@ -451,6 +461,7 @@ def get_file_download(self, bucket_id: str, file_id: str, token: str = None) -> """ Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + Parameters ---------- bucket_id : str @@ -491,6 +502,7 @@ def get_file_preview(self, bucket_id: str, file_id: str, width: float = None, he """ Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + Parameters ---------- bucket_id : str @@ -564,6 +576,7 @@ def get_file_view(self, bucket_id: str, file_id: str, token: str = None) -> byte """ Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + Parameters ---------- bucket_id : str diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index 808dc2a..50e0297 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -11,6 +11,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + Parameters ---------- queries : List[str] @@ -42,6 +43,7 @@ def create(self, team_id: str, name: str, roles: List[str] = None) -> Dict[str, """ Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + Parameters ---------- team_id : str @@ -83,6 +85,7 @@ def get(self, team_id: str) -> Dict[str, Any]: """ Get a team by its ID. All team members have read access for this resource. + Parameters ---------- team_id : str @@ -114,6 +117,7 @@ def update_name(self, team_id: str, name: str) -> Dict[str, Any]: """ Update the team's name by its unique ID. + Parameters ---------- team_id : str @@ -152,6 +156,7 @@ def delete(self, team_id: str) -> Dict[str, Any]: """ Delete a team using its ID. Only team members with the owner role can delete the team. + Parameters ---------- team_id : str @@ -184,6 +189,7 @@ def list_memberships(self, team_id: str, queries: List[str] = None, search: str """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -228,6 +234,7 @@ def create_membership(self, team_id: str, roles: List[str], email: str = None, u Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + Parameters ---------- team_id : str @@ -281,6 +288,7 @@ def get_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + Parameters ---------- team_id : str @@ -319,6 +327,7 @@ def update_membership(self, team_id: str, membership_id: str, roles: List[str]) Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + Parameters ---------- team_id : str @@ -363,6 +372,7 @@ def delete_membership(self, team_id: str, membership_id: str) -> Dict[str, Any]: """ This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + Parameters ---------- team_id : str @@ -404,6 +414,7 @@ def update_membership_status(self, team_id: str, membership_id: str, user_id: st If the request is successful, a session for the user is automatically created. + Parameters ---------- team_id : str @@ -454,6 +465,7 @@ def get_prefs(self, team_id: str) -> Dict[str, Any]: """ Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + Parameters ---------- team_id : str @@ -485,6 +497,7 @@ def update_prefs(self, team_id: str, prefs: dict) -> Dict[str, Any]: """ Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + Parameters ---------- team_id : str diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 01f1177..93ba739 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -11,6 +11,7 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ """ List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + Parameters ---------- bucket_id : str @@ -49,7 +50,8 @@ def list(self, bucket_id: str, file_id: str, queries: List[str] = None) -> Dict[ def create_file_token(self, bucket_id: str, file_id: str, expire: str = None) -> Dict[str, Any]: """ - Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. + Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + Parameters ---------- @@ -92,6 +94,7 @@ def get(self, token_id: str) -> Dict[str, Any]: """ Get a token by its unique ID. + Parameters ---------- token_id : str @@ -123,6 +126,7 @@ def update(self, token_id: str, expire: str = None) -> Dict[str, Any]: """ Update a token by its unique ID. Use this endpoint to update a token's expiry date. + Parameters ---------- token_id : str @@ -158,6 +162,7 @@ def delete(self, token_id: str) -> Dict[str, Any]: """ Delete a token by its unique ID. + Parameters ---------- token_id : str diff --git a/appwrite/services/users.py b/appwrite/services/users.py index 703a6bf..1af4e41 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -14,6 +14,7 @@ def list(self, queries: List[str] = None, search: str = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. + Parameters ---------- queries : List[str] @@ -45,6 +46,7 @@ def create(self, user_id: str, email: str = None, phone: str = None, password: s """ Create a new user. + Parameters ---------- user_id : str @@ -89,6 +91,7 @@ def create_argon2_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -136,6 +139,7 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -183,6 +187,7 @@ def list_identities(self, queries: List[str] = None, search: str = None) -> Dict """ Get identities for all users. + Parameters ---------- queries : List[str] @@ -214,6 +219,7 @@ def delete_identity(self, identity_id: str) -> Dict[str, Any]: """ Delete an identity by its unique ID. + Parameters ---------- identity_id : str @@ -246,6 +252,7 @@ def create_md5_user(self, user_id: str, email: str, password: str, name: str = N """ Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -293,6 +300,7 @@ def create_ph_pass_user(self, user_id: str, email: str, password: str, name: str """ Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -340,6 +348,7 @@ def create_scrypt_user(self, user_id: str, email: str, password: str, password_s """ Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -417,6 +426,7 @@ def create_scrypt_modified_user(self, user_id: str, email: str, password: str, p """ Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -482,6 +492,7 @@ def create_sha_user(self, user_id: str, email: str, password: str, password_vers """ Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + Parameters ---------- user_id : str @@ -532,6 +543,7 @@ def get(self, user_id: str) -> Dict[str, Any]: """ Get a user by its unique ID. + Parameters ---------- user_id : str @@ -563,6 +575,7 @@ def delete(self, user_id: str) -> Dict[str, Any]: """ Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + Parameters ---------- user_id : str @@ -595,6 +608,7 @@ def update_email(self, user_id: str, email: str) -> Dict[str, Any]: """ Update the user email by its unique ID. + Parameters ---------- user_id : str @@ -633,6 +647,7 @@ def create_jwt(self, user_id: str, session_id: str = None, duration: float = Non """ Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + Parameters ---------- user_id : str @@ -673,6 +688,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + Parameters ---------- user_id : str @@ -711,6 +727,7 @@ def list_logs(self, user_id: str, queries: List[str] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. + Parameters ---------- user_id : str @@ -745,6 +762,7 @@ def list_memberships(self, user_id: str, queries: List[str] = None, search: str """ Get the user membership list by its unique ID. + Parameters ---------- user_id : str @@ -782,6 +800,7 @@ def update_mfa(self, user_id: str, mfa: bool) -> Dict[str, Any]: """ Enable or disable MFA on a user account. + Parameters ---------- user_id : str @@ -820,6 +839,7 @@ def delete_mfa_authenticator(self, user_id: str, type: AuthenticatorType) -> Dic """ Delete an authenticator app. + Parameters ---------- user_id : str @@ -858,6 +878,7 @@ def list_mfa_factors(self, user_id: str) -> Dict[str, Any]: """ List the factors available on the account to be used as a MFA challange. + Parameters ---------- user_id : str @@ -889,6 +910,7 @@ def get_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -920,6 +942,7 @@ def update_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + Parameters ---------- user_id : str @@ -952,6 +975,7 @@ def create_mfa_recovery_codes(self, user_id: str) -> Dict[str, Any]: """ Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + Parameters ---------- user_id : str @@ -984,6 +1008,7 @@ def update_name(self, user_id: str, name: str) -> Dict[str, Any]: """ Update the user name by its unique ID. + Parameters ---------- user_id : str @@ -1022,6 +1047,7 @@ def update_password(self, user_id: str, password: str) -> Dict[str, Any]: """ Update the user password by its unique ID. + Parameters ---------- user_id : str @@ -1060,6 +1086,7 @@ def update_phone(self, user_id: str, number: str) -> Dict[str, Any]: """ Update the user phone by its unique ID. + Parameters ---------- user_id : str @@ -1098,6 +1125,7 @@ def get_prefs(self, user_id: str) -> Dict[str, Any]: """ Get the user preferences by its unique ID. + Parameters ---------- user_id : str @@ -1129,6 +1157,7 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: """ Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + Parameters ---------- user_id : str @@ -1167,6 +1196,7 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. + Parameters ---------- user_id : str @@ -1200,6 +1230,7 @@ def create_session(self, user_id: str) -> Dict[str, Any]: If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + Parameters ---------- user_id : str @@ -1232,6 +1263,7 @@ def delete_sessions(self, user_id: str) -> Dict[str, Any]: """ Delete all user's sessions by using the user's unique ID. + Parameters ---------- user_id : str @@ -1264,6 +1296,7 @@ def delete_session(self, user_id: str, session_id: str) -> Dict[str, Any]: """ Delete a user sessions by its unique ID. + Parameters ---------- user_id : str @@ -1302,6 +1335,7 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: """ Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + Parameters ---------- user_id : str @@ -1340,12 +1374,13 @@ def list_targets(self, user_id: str, queries: List[str] = None) -> Dict[str, Any """ List the messaging targets that are associated with a user. + Parameters ---------- user_id : str User ID. queries : List[str] - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels + Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType Returns ------- @@ -1374,6 +1409,7 @@ def create_target(self, user_id: str, target_id: str, provider_type: MessagingPr """ Create a messaging target. + Parameters ---------- user_id : str @@ -1430,6 +1466,7 @@ def get_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Get a user's push notification target by ID. + Parameters ---------- user_id : str @@ -1467,6 +1504,7 @@ def update_target(self, user_id: str, target_id: str, identifier: str = None, pr """ Update a messaging target. + Parameters ---------- user_id : str @@ -1514,6 +1552,7 @@ def delete_target(self, user_id: str, target_id: str) -> Dict[str, Any]: """ Delete a messaging target. + Parameters ---------- user_id : str @@ -1553,6 +1592,7 @@ def create_token(self, user_id: str, length: float = None, expire: float = None) Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + Parameters ---------- user_id : str @@ -1591,6 +1631,7 @@ def update_email_verification(self, user_id: str, email_verification: bool) -> D """ Update the user email verification status by its unique ID. + Parameters ---------- user_id : str @@ -1629,6 +1670,7 @@ def update_phone_verification(self, user_id: str, phone_verification: bool) -> D """ Update the user phone verification status by its unique ID. + Parameters ---------- user_id : str diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 1a8500b..1eaf024 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -3,9 +3,8 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID client.set_session('') # The user session to authenticate with -client.set_key('') # Your secret API key -client.set_jwt('') # Your secret JSON Web Token databases = Databases(client) diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 7c6ef24..1b94e51 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -3,6 +3,7 @@ from appwrite.services.databases import Databases client = Client() client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID client.set_key('') # Your secret API key databases = Databases(client) diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 0000000..397bdd4 --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +databases = Databases(client) + +result = databases.decrement_document_attribute( + database_id = '', + collection_id = '', + document_id = '', + attribute = '', + value = None, # optional + min = None # optional +) diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 0000000..d5700e0 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_key('') # Your secret API key + +databases = Databases(client) + +result = databases.increment_document_attribute( + database_id = '', + collection_id = '', + document_id = '', + attribute = '', + value = None, # optional + max = None # optional +) diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md new file mode 100644 index 0000000..c491ea4 --- /dev/null +++ b/docs/examples/databases/upsert-document.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.upsert_document( + database_id = '', + collection_id = '', + document_id = '', + data = {}, + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index 9972064..5136d5f 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -11,5 +11,5 @@ databases = Databases(client) result = databases.upsert_documents( database_id = '', collection_id = '', - documents = [] # optional + documents = [] ) diff --git a/setup.py b/setup.py index 5c6270f..18c78cc 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'appwrite/encoders', 'appwrite/enums', ], - version = '11.0.0', + version = '11.1.0', license='BSD-3-Clause', description = 'Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API', long_description = long_description, @@ -23,7 +23,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/11.0.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/11.1.0.tar.gz', install_requires=[ 'requests', ],