diff --git a/CHANGELOG.md b/CHANGELOG.md index cb7f47d..4d0c81a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 13.6.0 + +* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance +* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations + ## 13.5.0 * Add `create_resend_provider` and `update_resend_provider` methods to `Messaging` service diff --git a/appwrite/client.py b/appwrite/client.py index b25cfa2..a4b7310 100644 --- a/appwrite/client.py +++ b/appwrite/client.py @@ -15,11 +15,11 @@ def __init__(self): self._endpoint = 'https://cloud.appwrite.io/v1' self._global_headers = { 'content-type': '', - 'user-agent' : f'AppwritePythonSDK/13.5.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})', + 'user-agent' : f'AppwritePythonSDK/13.6.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': '13.5.0', + 'x-sdk-version': '13.6.0', 'X-Appwrite-Response-Format' : '1.8.0', } diff --git a/appwrite/operator.py b/appwrite/operator.py new file mode 100644 index 0000000..f4ced58 --- /dev/null +++ b/appwrite/operator.py @@ -0,0 +1,152 @@ +import json +import math +from enum import Enum + + +class Condition(Enum): + EQUAL = "equal" + NOT_EQUAL = "notEqual" + GREATER_THAN = "greaterThan" + GREATER_THAN_EQUAL = "greaterThanEqual" + LESS_THAN = "lessThan" + LESS_THAN_EQUAL = "lessThanEqual" + CONTAINS = "contains" + IS_NULL = "isNull" + IS_NOT_NULL = "isNotNull" + + +class Operator(): + def __init__(self, method, values=None): + self.method = method + + if values is not None: + self.values = values if isinstance(values, list) else [values] + + def __str__(self): + return json.dumps( + self.__dict__, + separators=(",", ":"), + default=lambda obj: obj.__dict__ + ) + + @staticmethod + def increment(value=1, max=None): + if isinstance(value, float) and (math.isnan(value) or math.isinf(value)): + raise ValueError("Value cannot be NaN or Infinity") + if max is not None and isinstance(max, float) and (math.isnan(max) or math.isinf(max)): + raise ValueError("Max cannot be NaN or Infinity") + values = [value] + if max is not None: + values.append(max) + return str(Operator("increment", values)) + + @staticmethod + def decrement(value=1, min=None): + if isinstance(value, float) and (math.isnan(value) or math.isinf(value)): + raise ValueError("Value cannot be NaN or Infinity") + if min is not None and isinstance(min, float) and (math.isnan(min) or math.isinf(min)): + raise ValueError("Min cannot be NaN or Infinity") + values = [value] + if min is not None: + values.append(min) + return str(Operator("decrement", values)) + + @staticmethod + def multiply(factor, max=None): + if isinstance(factor, float) and (math.isnan(factor) or math.isinf(factor)): + raise ValueError("Factor cannot be NaN or Infinity") + if max is not None and isinstance(max, float) and (math.isnan(max) or math.isinf(max)): + raise ValueError("Max cannot be NaN or Infinity") + values = [factor] + if max is not None: + values.append(max) + return str(Operator("multiply", values)) + + @staticmethod + def divide(divisor, min=None): + if isinstance(divisor, float) and (math.isnan(divisor) or math.isinf(divisor)): + raise ValueError("Divisor cannot be NaN or Infinity") + if min is not None and isinstance(min, float) and (math.isnan(min) or math.isinf(min)): + raise ValueError("Min cannot be NaN or Infinity") + if divisor == 0: + raise ValueError("Divisor cannot be zero") + values = [divisor] + if min is not None: + values.append(min) + return str(Operator("divide", values)) + + @staticmethod + def modulo(divisor): + if isinstance(divisor, float) and (math.isnan(divisor) or math.isinf(divisor)): + raise ValueError("Divisor cannot be NaN or Infinity") + if divisor == 0: + raise ValueError("Divisor cannot be zero") + return str(Operator("modulo", [divisor])) + + @staticmethod + def power(exponent, max=None): + if isinstance(exponent, float) and (math.isnan(exponent) or math.isinf(exponent)): + raise ValueError("Exponent cannot be NaN or Infinity") + if max is not None and isinstance(max, float) and (math.isnan(max) or math.isinf(max)): + raise ValueError("Max cannot be NaN or Infinity") + values = [exponent] + if max is not None: + values.append(max) + return str(Operator("power", values)) + + @staticmethod + def array_append(values): + return str(Operator("arrayAppend", values)) + + @staticmethod + def array_prepend(values): + return str(Operator("arrayPrepend", values)) + + @staticmethod + def array_insert(index, value): + return str(Operator("arrayInsert", [index, value])) + + @staticmethod + def array_remove(value): + return str(Operator("arrayRemove", [value])) + + @staticmethod + def array_unique(): + return str(Operator("arrayUnique", [])) + + @staticmethod + def array_intersect(values): + return str(Operator("arrayIntersect", values)) + + @staticmethod + def array_diff(values): + return str(Operator("arrayDiff", values)) + + @staticmethod + def array_filter(condition, value=None): + values = [condition.value if isinstance(condition, Condition) else condition, value] + return str(Operator("arrayFilter", values)) + + @staticmethod + def string_concat(value): + return str(Operator("stringConcat", [value])) + + @staticmethod + def string_replace(search, replace): + return str(Operator("stringReplace", [search, replace])) + + @staticmethod + def toggle(): + return str(Operator("toggle", [])) + + @staticmethod + def date_add_days(days): + return str(Operator("dateAddDays", [days])) + + @staticmethod + def date_sub_days(days): + return str(Operator("dateSubDays", [days])) + + @staticmethod + def date_set_now(): + return str(Operator("dateSetNow", [])) diff --git a/appwrite/query.py b/appwrite/query.py index a601eec..b989a76 100644 --- a/appwrite/query.py +++ b/appwrite/query.py @@ -125,27 +125,27 @@ def not_ends_with(attribute, value): @staticmethod def created_before(value): - return str(Query("createdBefore", None, value)) + return Query.less_than("$createdAt", value) @staticmethod def created_after(value): - return str(Query("createdAfter", None, value)) + return Query.greater_than("$createdAt", value) @staticmethod def created_between(start, end): - return str(Query("createdBetween", None, [start, end])) + return Query.between("$createdAt", start, end) @staticmethod def updated_before(value): - return str(Query("updatedBefore", None, value)) + return Query.less_than("$updatedAt", value) @staticmethod def updated_after(value): - return str(Query("updatedAfter", None, value)) + return Query.greater_than("$updatedAt", value) @staticmethod def updated_between(start, end): - return str(Query("updatedBetween", None, [start, end])) + return Query.between("$updatedAt", start, end) @staticmethod def or_queries(queries): diff --git a/appwrite/services/account.py b/appwrite/services/account.py index 3b79f43..c1c3d49 100644 --- a/appwrite/services/account.py +++ b/appwrite/services/account.py @@ -119,7 +119,7 @@ def update_email(self, email: str, password: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_identities(self, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the list of identities for the currently logged in user. @@ -127,6 +127,8 @@ def list_identities(self, queries: Optional[List[str]] = None) -> Dict[str, Any] ---------- queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -143,6 +145,7 @@ def list_identities(self, queries: Optional[List[str]] = None) -> Dict[str, Any] api_params = {} api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -201,7 +204,7 @@ def create_jwt(self) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_logs(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_logs(self, queries: Optional[List[str]] = None, total: Optional[bool] = 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. @@ -209,6 +212,8 @@ def list_logs(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: ---------- queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -225,6 +230,7 @@ def list_logs(self, queries: Optional[List[str]] = None) -> Dict[str, Any]: api_params = {} api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/databases.py b/appwrite/services/databases.py index d3fc85c..2e0853a 100644 --- a/appwrite/services/databases.py +++ b/appwrite/services/databases.py @@ -12,7 +12,7 @@ def __init__(self, client) -> None: super(Databases, self).__init__(client) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.list` instead.") - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = 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. @@ -24,6 +24,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -41,6 +43,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -397,7 +400,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: }, api_params) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.list_tables` instead.") - def list_collections(self, database_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_collections(self, database_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. @@ -411,6 +414,8 @@ def list_collections(self, database_id: str, queries: Optional[List[str]] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -432,6 +437,7 @@ def list_collections(self, database_id: str, queries: Optional[List[str]] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -630,7 +636,7 @@ def delete_collection(self, database_id: str, collection_id: str) -> Dict[str, A }, api_params) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.list_columns` instead.") - def list_attributes(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_attributes(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List attributes in the collection. @@ -644,6 +650,8 @@ def list_attributes(self, database_id: str, collection_id: str, queries: Optiona Collection ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -668,6 +676,7 @@ def list_attributes(self, database_id: str, collection_id: str, queries: Optiona api_path = api_path.replace('{collectionId}', collection_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -2356,7 +2365,7 @@ def update_relationship_attribute(self, database_id: str, collection_id: str, ke }, api_params) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.list_rows` instead.") - def list_documents(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None, transaction_id: Optional[str] = None) -> Dict[str, Any]: + def list_documents(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None, transaction_id: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the user's documents in a given collection. You can use the query params to filter your results. @@ -2372,6 +2381,8 @@ def list_documents(self, database_id: str, collection_id: str, queries: Optional 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. transaction_id : Optional[str] Transaction ID to read uncommitted changes within the transaction. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -2397,6 +2408,7 @@ def list_documents(self, database_id: str, collection_id: str, queries: Optional api_params['queries'] = queries api_params['transactionId'] = transaction_id + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -3000,7 +3012,7 @@ def increment_document_attribute(self, database_id: str, collection_id: str, doc }, api_params) @deprecated("This API has been deprecated since 1.8.0. Please use `tablesDB.list_indexes` instead.") - def list_indexes(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_indexes(self, database_id: str, collection_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List indexes in the collection. @@ -3014,6 +3026,8 @@ def list_indexes(self, database_id: str, collection_id: str, queries: Optional[L Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -3038,6 +3052,7 @@ def list_indexes(self, database_id: str, collection_id: str, queries: Optional[L api_path = api_path.replace('{collectionId}', collection_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/functions.py b/appwrite/services/functions.py index 9ffae50..e6621a7 100644 --- a/appwrite/services/functions.py +++ b/appwrite/services/functions.py @@ -13,7 +13,7 @@ class Functions(Service): def __init__(self, client) -> None: super(Functions, self).__init__(client) - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the project's functions. You can use the query params to filter your results. @@ -23,6 +23,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -40,6 +42,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -362,7 +365,7 @@ def update_function_deployment(self, function_id: str, deployment_id: str) -> Di 'content-type': 'application/json', }, api_params) - def list_deployments(self, function_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_deployments(self, function_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the function's code deployments. You can use the query params to filter your results. @@ -374,6 +377,8 @@ def list_deployments(self, function_id: str, queries: Optional[List[str]] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -395,6 +400,7 @@ def list_deployments(self, function_id: str, queries: Optional[List[str]] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -764,7 +770,7 @@ def update_deployment_status(self, function_id: str, deployment_id: str) -> Dict 'content-type': 'application/json', }, api_params) - def list_executions(self, function_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_executions(self, function_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the current user function execution logs. You can use the query params to filter your results. @@ -774,6 +780,8 @@ def list_executions(self, function_id: str, queries: Optional[List[str]] = None) Function ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -794,6 +802,7 @@ def list_executions(self, function_id: str, queries: Optional[List[str]] = None) api_path = api_path.replace('{functionId}', function_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/messaging.py b/appwrite/services/messaging.py index 5af193a..2480c2c 100644 --- a/appwrite/services/messaging.py +++ b/appwrite/services/messaging.py @@ -10,7 +10,7 @@ class Messaging(Service): def __init__(self, client) -> None: super(Messaging, self).__init__(client) - def list_messages(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_messages(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all messages from the current Appwrite project. @@ -20,6 +20,8 @@ def list_messages(self, queries: Optional[List[str]] = None, search: Optional[st Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -37,6 +39,7 @@ def list_messages(self, queries: Optional[List[str]] = None, search: Optional[st api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -519,7 +522,7 @@ def delete(self, message_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_message_logs(self, message_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_message_logs(self, message_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the message activity logs listed by its unique ID. @@ -529,6 +532,8 @@ def list_message_logs(self, message_id: str, queries: Optional[List[str]] = None Message ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -549,11 +554,12 @@ def list_message_logs(self, message_id: str, queries: Optional[List[str]] = None api_path = api_path.replace('{messageId}', message_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_targets(self, message_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_targets(self, message_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of the targets associated with a message. @@ -563,6 +569,8 @@ def list_targets(self, message_id: str, queries: Optional[List[str]] = None) -> Message ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -583,11 +591,12 @@ def list_targets(self, message_id: str, queries: Optional[List[str]] = None) -> api_path = api_path.replace('{messageId}', message_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_providers(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_providers(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all providers from the current Appwrite project. @@ -597,6 +606,8 @@ def list_providers(self, queries: Optional[List[str]] = None, search: Optional[s Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -614,6 +625,7 @@ def list_providers(self, queries: Optional[List[str]] = None, search: Optional[s api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -1848,7 +1860,7 @@ def delete_provider(self, provider_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_provider_logs(self, provider_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_provider_logs(self, provider_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the provider activity logs listed by its unique ID. @@ -1858,6 +1870,8 @@ def list_provider_logs(self, provider_id: str, queries: Optional[List[str]] = No Provider ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -1878,11 +1892,12 @@ def list_provider_logs(self, provider_id: str, queries: Optional[List[str]] = No api_path = api_path.replace('{providerId}', provider_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_subscriber_logs(self, subscriber_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_subscriber_logs(self, subscriber_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the subscriber activity logs listed by its unique ID. @@ -1892,6 +1907,8 @@ def list_subscriber_logs(self, subscriber_id: str, queries: Optional[List[str]] Subscriber ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -1912,11 +1929,12 @@ def list_subscriber_logs(self, subscriber_id: str, queries: Optional[List[str]] api_path = api_path.replace('{subscriberId}', subscriber_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_topics(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_topics(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all topics from the current Appwrite project. @@ -1926,6 +1944,8 @@ def list_topics(self, queries: Optional[List[str]] = None, search: Optional[str] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -1943,6 +1963,7 @@ def list_topics(self, queries: Optional[List[str]] = None, search: Optional[str] api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -2091,7 +2112,7 @@ def delete_topic(self, topic_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_topic_logs(self, topic_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_topic_logs(self, topic_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the topic activity logs listed by its unique ID. @@ -2101,6 +2122,8 @@ def list_topic_logs(self, topic_id: str, queries: Optional[List[str]] = None) -> Topic ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -2121,11 +2144,12 @@ def list_topic_logs(self, topic_id: str, queries: Optional[List[str]] = None) -> api_path = api_path.replace('{topicId}', topic_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_subscribers(self, topic_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_subscribers(self, topic_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all subscribers from the current Appwrite project. @@ -2137,6 +2161,8 @@ def list_subscribers(self, topic_id: str, queries: Optional[List[str]] = None, s Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -2158,6 +2184,7 @@ def list_subscribers(self, topic_id: str, queries: Optional[List[str]] = None, s api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/sites.py b/appwrite/services/sites.py index f1563cc..b8644b7 100644 --- a/appwrite/services/sites.py +++ b/appwrite/services/sites.py @@ -14,7 +14,7 @@ class Sites(Service): def __init__(self, client) -> None: super(Sites, self).__init__(client) - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the project's sites. You can use the query params to filter your results. @@ -24,6 +24,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -41,6 +43,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -369,7 +372,7 @@ def update_site_deployment(self, site_id: str, deployment_id: str) -> Dict[str, 'content-type': 'application/json', }, api_params) - def list_deployments(self, site_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_deployments(self, site_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the site's code deployments. You can use the query params to filter your results. @@ -381,6 +384,8 @@ def list_deployments(self, site_id: str, queries: Optional[List[str]] = None, se Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -402,6 +407,7 @@ def list_deployments(self, site_id: str, queries: Optional[List[str]] = None, se api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -767,7 +773,7 @@ def update_deployment_status(self, site_id: str, deployment_id: str) -> Dict[str 'content-type': 'application/json', }, api_params) - def list_logs(self, site_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_logs(self, site_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all site logs. You can use the query params to filter your results. @@ -777,6 +783,8 @@ def list_logs(self, site_id: str, queries: Optional[List[str]] = None) -> Dict[s Site ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -797,6 +805,7 @@ def list_logs(self, site_id: str, queries: Optional[List[str]] = None) -> Dict[s api_path = api_path.replace('{siteId}', site_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/storage.py b/appwrite/services/storage.py index 3fe708c..d00b1a0 100644 --- a/appwrite/services/storage.py +++ b/appwrite/services/storage.py @@ -12,7 +12,7 @@ class Storage(Service): def __init__(self, client) -> None: super(Storage, self).__init__(client) - def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the storage buckets. You can use the query params to filter your results. @@ -22,6 +22,8 @@ def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -39,6 +41,7 @@ def list_buckets(self, queries: Optional[List[str]] = None, search: Optional[str api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -230,7 +233,7 @@ def delete_bucket(self, bucket_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_files(self, bucket_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_files(self, bucket_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the user files. You can use the query params to filter your results. @@ -242,6 +245,8 @@ def list_files(self, bucket_id: str, queries: Optional[List[str]] = None, search Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -263,6 +268,7 @@ def list_files(self, bucket_id: str, queries: Optional[List[str]] = None, search api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/tables_db.py b/appwrite/services/tables_db.py index 20331b9..edd7645 100644 --- a/appwrite/services/tables_db.py +++ b/appwrite/services/tables_db.py @@ -11,7 +11,7 @@ class TablesDB(Service): def __init__(self, client) -> None: super(TablesDB, self).__init__(client) - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = 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. @@ -21,6 +21,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None 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 : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -38,6 +40,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -381,7 +384,7 @@ def delete(self, database_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_tables(self, database_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_tables(self, database_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = 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. @@ -393,6 +396,8 @@ def list_tables(self, database_id: str, queries: Optional[List[str]] = None, sea 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 : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -414,6 +419,7 @@ def list_tables(self, database_id: str, queries: Optional[List[str]] = None, sea api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -599,7 +605,7 @@ def delete_table(self, database_id: str, table_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_columns(self, database_id: str, table_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_columns(self, database_id: str, table_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List columns in the table. @@ -611,6 +617,8 @@ def list_columns(self, database_id: str, table_id: str, queries: Optional[List[s Table ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, size, required, array, status, error + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -635,6 +643,7 @@ def list_columns(self, database_id: str, table_id: str, queries: Optional[List[s api_path = api_path.replace('{tableId}', table_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -2237,7 +2246,7 @@ def update_relationship_column(self, database_id: str, table_id: str, key: str, 'content-type': 'application/json', }, api_params) - def list_indexes(self, database_id: str, table_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_indexes(self, database_id: str, table_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List indexes on the table. @@ -2249,6 +2258,8 @@ def list_indexes(self, database_id: str, table_id: str, queries: Optional[List[s Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following columns: key, type, status, attributes, error + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -2273,6 +2284,7 @@ def list_indexes(self, database_id: str, table_id: str, queries: Optional[List[s api_path = api_path.replace('{tableId}', table_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -2427,7 +2439,7 @@ def delete_index(self, database_id: str, table_id: str, key: str) -> Dict[str, A 'content-type': 'application/json', }, api_params) - def list_rows(self, database_id: str, table_id: str, queries: Optional[List[str]] = None, transaction_id: Optional[str] = None) -> Dict[str, Any]: + def list_rows(self, database_id: str, table_id: str, queries: Optional[List[str]] = None, transaction_id: Optional[str] = None, total: Optional[bool] = 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. @@ -2441,6 +2453,8 @@ def list_rows(self, database_id: str, table_id: str, queries: Optional[List[str] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. transaction_id : Optional[str] Transaction ID to read uncommitted changes within the transaction. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -2466,6 +2480,7 @@ def list_rows(self, database_id: str, table_id: str, queries: Optional[List[str] api_params['queries'] = queries api_params['transactionId'] = transaction_id + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/teams.py b/appwrite/services/teams.py index bad146b..cd456d9 100644 --- a/appwrite/services/teams.py +++ b/appwrite/services/teams.py @@ -8,7 +8,7 @@ class Teams(Service): def __init__(self, client) -> None: super(Teams, self).__init__(client) - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = 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. @@ -18,6 +18,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, total, billingPlan search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -35,6 +37,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -181,7 +184,7 @@ def delete(self, team_id: str) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_memberships(self, team_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_memberships(self, team_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. @@ -193,6 +196,8 @@ def list_memberships(self, team_id: str, queries: Optional[List[str]] = None, se Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -214,6 +219,7 @@ def list_memberships(self, team_id: str, queries: Optional[List[str]] = None, se api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/tokens.py b/appwrite/services/tokens.py index 85700f0..6aa51af 100644 --- a/appwrite/services/tokens.py +++ b/appwrite/services/tokens.py @@ -8,7 +8,7 @@ class Tokens(Service): def __init__(self, client) -> None: super(Tokens, self).__init__(client) - def list(self, bucket_id: str, file_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list(self, bucket_id: str, file_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List all the tokens created for a specific file or bucket. You can use the query params to filter your results. @@ -20,6 +20,8 @@ def list(self, bucket_id: str, file_id: str, queries: Optional[List[str]] = None File unique ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -44,6 +46,7 @@ def list(self, bucket_id: str, file_id: str, queries: Optional[List[str]] = None api_path = api_path.replace('{fileId}', file_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/appwrite/services/users.py b/appwrite/services/users.py index bb1b9fa..1a65600 100644 --- a/appwrite/services/users.py +++ b/appwrite/services/users.py @@ -11,7 +11,7 @@ class Users(Service): def __init__(self, client) -> None: super(Users, self).__init__(client) - def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get a list of all the project's users. You can use the query params to filter your results. @@ -21,6 +21,8 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -38,6 +40,7 @@ def list(self, queries: Optional[List[str]] = None, search: Optional[str] = None api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -180,7 +183,7 @@ def create_bcrypt_user(self, user_id: str, email: str, password: str, name: Opti 'content-type': 'application/json', }, api_params) - def list_identities(self, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_identities(self, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get identities for all users. @@ -190,6 +193,8 @@ def list_identities(self, queries: Optional[List[str]] = None, search: Optional[ Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -207,6 +212,7 @@ def list_identities(self, queries: Optional[List[str]] = None, search: Optional[ api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -708,7 +714,7 @@ def update_labels(self, user_id: str, labels: List[str]) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_logs(self, user_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_logs(self, user_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the user activity logs list by its unique ID. @@ -718,6 +724,8 @@ def list_logs(self, user_id: str, queries: Optional[List[str]] = None) -> Dict[s User ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -738,11 +746,12 @@ def list_logs(self, user_id: str, queries: Optional[List[str]] = None) -> Dict[s api_path = api_path.replace('{userId}', user_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) - def list_memberships(self, user_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None) -> Dict[str, Any]: + def list_memberships(self, user_id: str, queries: Optional[List[str]] = None, search: Optional[str] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the user membership list by its unique ID. @@ -754,6 +763,8 @@ def list_memberships(self, user_id: str, queries: Optional[List[str]] = None, se Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, teamId, invited, joined, confirm, roles search : Optional[str] Search term to filter your list results. Max length: 256 chars. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -775,6 +786,7 @@ def list_memberships(self, user_id: str, queries: Optional[List[str]] = None, se api_params['queries'] = queries api_params['search'] = search + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -1164,7 +1176,7 @@ def update_prefs(self, user_id: str, prefs: dict) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_sessions(self, user_id: str) -> Dict[str, Any]: + def list_sessions(self, user_id: str, total: Optional[bool] = None) -> Dict[str, Any]: """ Get the user sessions list by its unique ID. @@ -1172,6 +1184,8 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: ---------- user_id : str User ID. + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -1191,6 +1205,7 @@ def list_sessions(self, user_id: str) -> Dict[str, Any]: api_path = api_path.replace('{userId}', user_id) + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) @@ -1337,7 +1352,7 @@ def update_status(self, user_id: str, status: bool) -> Dict[str, Any]: 'content-type': 'application/json', }, api_params) - def list_targets(self, user_id: str, queries: Optional[List[str]] = None) -> Dict[str, Any]: + def list_targets(self, user_id: str, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]: """ List the messaging targets that are associated with a user. @@ -1347,6 +1362,8 @@ def list_targets(self, user_id: str, queries: Optional[List[str]] = None) -> Dic User ID. queries : Optional[List[str]] Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType + total : Optional[bool] + When set to false, the total count returned will be 0 and will not be calculated. Returns ------- @@ -1367,6 +1384,7 @@ def list_targets(self, user_id: str, queries: Optional[List[str]] = None) -> Dic api_path = api_path.replace('{userId}', user_id) api_params['queries'] = queries + api_params['total'] = total return self.client.call('get', api_path, { }, api_params) diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index aeb23be..78eef4b 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -9,5 +9,6 @@ client.set_session('') # The user session to authenticate with account = Account(client) result = account.list_identities( - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 67d193d..ae70fcb 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -9,5 +9,6 @@ client.set_session('') # The user session to authenticate with account = Account(client) result = account.list_logs( - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index c97a5ce..85eb199 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -11,5 +11,6 @@ databases = Databases(client) result = databases.list_attributes( database_id = '', collection_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 17d0a3d..ebb6c6e 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -11,5 +11,6 @@ databases = Databases(client) result = databases.list_collections( database_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index cecac30..2e63315 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -12,5 +12,6 @@ result = databases.list_documents( database_id = '', collection_id = '', queries = [], # optional - transaction_id = '' # optional + transaction_id = '', # optional + total = False # optional ) diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index 1457151..d1b99b8 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -11,5 +11,6 @@ databases = Databases(client) result = databases.list_indexes( database_id = '', collection_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index 58336c9..01dfd76 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -10,5 +10,6 @@ databases = Databases(client) result = databases.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 4eb92f6..26d3613 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -11,5 +11,6 @@ functions = Functions(client) result = functions.list_deployments( function_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 300fc0e..60fe38e 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -10,5 +10,6 @@ functions = Functions(client) result = functions.list_executions( function_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index b1d696d..99a5467 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -10,5 +10,6 @@ functions = Functions(client) result = functions.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index f28c3e5..a689ae9 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_message_logs( message_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index 211649d..9a47613 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_messages( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index da87e59..7e4dc96 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_provider_logs( provider_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 03e5c4e..db2d2b8 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_providers( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index df8ec72..41bb5b4 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_subscriber_logs( subscriber_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index f949b40..6666830 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -11,5 +11,6 @@ messaging = Messaging(client) result = messaging.list_subscribers( topic_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index 786ee42..b4f619f 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_targets( message_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index f8a3995..33fcff0 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_topic_logs( topic_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 1c2cefc..ad07146 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -10,5 +10,6 @@ messaging = Messaging(client) result = messaging.list_topics( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index 15ec24d..4739de9 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -11,5 +11,6 @@ sites = Sites(client) result = sites.list_deployments( site_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index d3a9a19..4dbbf7a 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -10,5 +10,6 @@ sites = Sites(client) result = sites.list_logs( site_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index 1b344e1..9c8c67b 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -10,5 +10,6 @@ sites = Sites(client) result = sites.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index 51a1ae6..7a2e9de 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -10,5 +10,6 @@ storage = Storage(client) result = storage.list_buckets( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 4034bd4..88e948c 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -11,5 +11,6 @@ storage = Storage(client) result = storage.list_files( bucket_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index a3179a9..944e53a 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -11,5 +11,6 @@ tables_db = TablesDB(client) result = tables_db.list_columns( database_id = '', table_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index fe69041..cc6f4d2 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -11,5 +11,6 @@ tables_db = TablesDB(client) result = tables_db.list_indexes( database_id = '', table_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index eb0a4ed..179ec90 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -12,5 +12,6 @@ result = tables_db.list_rows( database_id = '', table_id = '', queries = [], # optional - transaction_id = '' # optional + transaction_id = '', # optional + total = False # optional ) diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index 2fab0d3..3bb484a 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -11,5 +11,6 @@ tables_db = TablesDB(client) result = tables_db.list_tables( database_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 43cee6a..594e8cb 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -10,5 +10,6 @@ tables_db = TablesDB(client) result = tables_db.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 6e6f15a..f0e9d31 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -11,5 +11,6 @@ teams = Teams(client) result = teams.list_memberships( team_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index bf91a50..293ed24 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -10,5 +10,6 @@ teams = Teams(client) result = teams.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index 2694650..5309203 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -11,5 +11,6 @@ tokens = Tokens(client) result = tokens.list( bucket_id = '', file_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index 0fc7811..664d32e 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -10,5 +10,6 @@ users = Users(client) result = users.list_identities( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 6cbbe49..6b2393f 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -10,5 +10,6 @@ users = Users(client) result = users.list_logs( user_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index c0d2f2a..907df80 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -11,5 +11,6 @@ users = Users(client) result = users.list_memberships( user_id = '', queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index 77b04c9..b84fbbf 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -9,5 +9,6 @@ client.set_key('') # Your secret API key users = Users(client) result = users.list_sessions( - user_id = '' + user_id = '', + total = False # optional ) diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 14107fa..a8e68de 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -10,5 +10,6 @@ users = Users(client) result = users.list_targets( user_id = '', - queries = [] # optional + queries = [], # optional + total = False # optional ) diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 778f339..7ff8602 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -10,5 +10,6 @@ users = Users(client) result = users.list( queries = [], # optional - search = '' # optional + search = '', # optional + total = False # optional ) diff --git a/setup.py b/setup.py index dd814cd..4fe9b23 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name = 'appwrite', packages = setuptools.find_packages(), - version = '13.5.0', + version = '13.6.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, @@ -18,7 +18,7 @@ maintainer = 'Appwrite Team', maintainer_email = 'team@appwrite.io', url = 'https://appwrite.io/support', - download_url='https://github.com/appwrite/sdk-for-python/archive/13.5.0.tar.gz', + download_url='https://github.com/appwrite/sdk-for-python/archive/13.6.0.tar.gz', install_requires=[ 'requests', ],