From 98810d7dae1170438930d089e3e11a123ec9ec76 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Wed, 11 Sep 2024 15:28:01 +0000 Subject: [PATCH] chore(scripts): improve release script with git diff [skip-bc] (generated) https://github.com/algolia/api-clients-automation/pull/3686 Co-authored-by: Pierre Millot --- .github/ISSUE_TEMPLATE/Bug_report.yml | 1 - algoliasearch/usage/__init__.py | 8 - algoliasearch/usage/client.py | 1407 ----------------- algoliasearch/usage/config.py | 35 - algoliasearch/usage/models/__init__.py | 8 - algoliasearch/usage/models/error_base.py | 82 - algoliasearch/usage/models/error_item.py | 77 - algoliasearch/usage/models/forbidden_error.py | 88 -- algoliasearch/usage/models/granularity.py | 33 - algoliasearch/usage/models/index_usage.py | 84 - .../usage/models/invalid_request_error.py | 88 -- algoliasearch/usage/models/statistic.py | 131 -- algoliasearch/usage/models/statistic_entry.py | 85 - algoliasearch/usage/models/statistic_value.py | 101 -- 14 files changed, 2228 deletions(-) delete mode 100644 algoliasearch/usage/__init__.py delete mode 100644 algoliasearch/usage/client.py delete mode 100644 algoliasearch/usage/config.py delete mode 100644 algoliasearch/usage/models/__init__.py delete mode 100644 algoliasearch/usage/models/error_base.py delete mode 100644 algoliasearch/usage/models/error_item.py delete mode 100644 algoliasearch/usage/models/forbidden_error.py delete mode 100644 algoliasearch/usage/models/granularity.py delete mode 100644 algoliasearch/usage/models/index_usage.py delete mode 100644 algoliasearch/usage/models/invalid_request_error.py delete mode 100644 algoliasearch/usage/models/statistic.py delete mode 100644 algoliasearch/usage/models/statistic_entry.py delete mode 100644 algoliasearch/usage/models/statistic_value.py diff --git a/.github/ISSUE_TEMPLATE/Bug_report.yml b/.github/ISSUE_TEMPLATE/Bug_report.yml index e919fd952..ecf2dfdbd 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.yml +++ b/.github/ISSUE_TEMPLATE/Bug_report.yml @@ -39,7 +39,6 @@ body: - Query-Suggestions - Recommend - Search - - Usage - Crawler validations: required: true diff --git a/algoliasearch/usage/__init__.py b/algoliasearch/usage/__init__.py deleted file mode 100644 index f117bc97a..000000000 --- a/algoliasearch/usage/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -# The version of the algoliasearch package -__version__ = "4.4.0" diff --git a/algoliasearch/usage/client.py b/algoliasearch/usage/client.py deleted file mode 100644 index 581473923..000000000 --- a/algoliasearch/usage/client.py +++ /dev/null @@ -1,1407 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import dumps -from sys import version_info -from typing import Any, Dict, List, Optional, Tuple, Union -from urllib.parse import quote - -from pydantic import Field, StrictStr - -if version_info >= (3, 11): - from typing import Annotated, Self -else: - from typing_extensions import Annotated, Self - -from algoliasearch.http.api_response import ApiResponse -from algoliasearch.http.request_options import RequestOptions -from algoliasearch.http.serializer import bodySerializer -from algoliasearch.http.transporter import Transporter -from algoliasearch.http.transporter_sync import TransporterSync -from algoliasearch.http.verb import Verb -from algoliasearch.usage.config import UsageConfig -from algoliasearch.usage.models.granularity import Granularity -from algoliasearch.usage.models.index_usage import IndexUsage -from algoliasearch.usage.models.statistic import Statistic - - -class UsageClient: - """The Algolia 'UsageClient' class. - - Args: - app_id (str): The Algolia application ID to retrieve information from. - api_key (str): The Algolia api key bound to the given `app_id`. - - - Returns: - The initialized API client. - - Example: - _client = UsageClient("YOUR_ALGOLIA_APP_ID", "YOUR_ALGOLIA_API_KEY") - _client_with_named_args = UsageClient(app_id="YOUR_ALGOLIA_APP_ID", api_key="YOUR_ALGOLIA_API_KEY") - - See `UsageClient.create_with_config` for advanced configuration. - """ - - _transporter: Transporter - _config: UsageConfig - _request_options: RequestOptions - - def __init__( - self, - app_id: Optional[str] = None, - api_key: Optional[str] = None, - transporter: Optional[Transporter] = None, - config: Optional[UsageConfig] = None, - ) -> None: - if transporter is not None and config is None: - config = transporter._config - - if config is None: - config = UsageConfig(app_id, api_key) - self._config = config - self._request_options = RequestOptions(config) - - if transporter is None: - transporter = Transporter(config) - self._transporter = transporter - - def create_with_config( - config: UsageConfig, transporter: Optional[Transporter] = None - ) -> Self: - """Allows creating a client with a customized `UsageConfig` and `Transporter`. If `transporter` is not provided, the default one will be initialized from the given `config`. - - Args: - config (UsageConfig): The config of the API client. - transporter (Transporter): The HTTP transporter, see `http/transporter.py` for implementation details. - - Returns: - The initialized API client. - - Example: - _client_with_custom_config = UsageClient.create_with_config(config=UsageConfig(...)) - _client_with_custom_config_and_transporter = UsageClient.create_with_config(config=UsageConfig(...), transporter=Transporter(...)) - """ - if transporter is None: - transporter = Transporter(config) - - return UsageClient( - app_id=config.app_id, - api_key=config.api_key, - transporter=transporter, - config=config, - ) - - async def __aenter__(self) -> None: - return self - - async def __aexit__(self, exc_type, exc_value, traceback) -> None: - """Closes the underlying `transporter` of the API client.""" - await self.close() - - async def close(self) -> None: - """Closes the underlying `transporter` of the API client.""" - return await self._transporter.close() - - async def set_client_api_key(self, api_key: str) -> None: - """Sets a new API key to authenticate requests.""" - self._transporter._config.set_client_api_key(api_key) - - async def custom_delete_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError( - "Parameter `path` is required when calling `custom_delete`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - return await self._transporter.request( - verb=Verb.DELETE, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def custom_delete( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - await self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) - - async def custom_get_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_get`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - return await self._transporter.request( - verb=Verb.GET, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def custom_get( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - await self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) - - async def custom_post_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_post`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - _data = {} - if body is not None: - _data = body - - return await self._transporter.request( - verb=Verb.POST, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - data=dumps(bodySerializer(_data)), - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def custom_post( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - await self.custom_post_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) - - async def custom_put_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_put`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - _data = {} - if body is not None: - _data = body - - return await self._transporter.request( - verb=Verb.PUT, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - data=dumps(bodySerializer(_data)), - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def custom_put( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - await self.custom_put_with_http_info( - path, parameters, body, request_options - ) - ).deserialize(object) - - async def get_index_usage_with_http_info( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - index_name: Annotated[ - StrictStr, - Field(description="Name of the index on which to perform the operation."), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - Retrieves the selected usage statistics for one index. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param index_name: Name of the index on which to perform the operation. (required) - :type index_name: str - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if statistic is None: - raise ValueError( - "Parameter `statistic` is required when calling `get_index_usage`." - ) - - if index_name is None: - raise ValueError( - "Parameter `index_name` is required when calling `get_index_usage`." - ) - - if start_date is None: - raise ValueError( - "Parameter `start_date` is required when calling `get_index_usage`." - ) - - if end_date is None: - raise ValueError( - "Parameter `end_date` is required when calling `get_index_usage`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if start_date is not None: - _query_parameters.append(("startDate", start_date)) - if end_date is not None: - _query_parameters.append(("endDate", end_date)) - if granularity is not None: - _query_parameters.append(("granularity", granularity)) - - return await self._transporter.request( - verb=Verb.GET, - path="/1/usage/{statistic}/{indexName}".replace( - "{statistic}", quote(str(statistic), safe="") - ).replace("{indexName}", quote(str(index_name), safe="")), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def get_index_usage( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - index_name: Annotated[ - StrictStr, - Field(description="Name of the index on which to perform the operation."), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> IndexUsage: - """ - Retrieves the selected usage statistics for one index. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param index_name: Name of the index on which to perform the operation. (required) - :type index_name: str - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'IndexUsage' result object. - """ - return ( - await self.get_index_usage_with_http_info( - statistic, - index_name, - start_date, - end_date, - granularity, - request_options, - ) - ).deserialize(IndexUsage) - - async def get_usage_with_http_info( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - Retrieves usage statistics evaluated over a specified period. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if statistic is None: - raise ValueError( - "Parameter `statistic` is required when calling `get_usage`." - ) - - if start_date is None: - raise ValueError( - "Parameter `start_date` is required when calling `get_usage`." - ) - - if end_date is None: - raise ValueError( - "Parameter `end_date` is required when calling `get_usage`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if start_date is not None: - _query_parameters.append(("startDate", start_date)) - if end_date is not None: - _query_parameters.append(("endDate", end_date)) - if granularity is not None: - _query_parameters.append(("granularity", granularity)) - - return await self._transporter.request( - verb=Verb.GET, - path="/1/usage/{statistic}".replace( - "{statistic}", quote(str(statistic), safe="") - ), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - async def get_usage( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> IndexUsage: - """ - Retrieves usage statistics evaluated over a specified period. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'IndexUsage' result object. - """ - return ( - await self.get_usage_with_http_info( - statistic, start_date, end_date, granularity, request_options - ) - ).deserialize(IndexUsage) - - -class UsageClientSync: - """The Algolia 'UsageClientSync' class. - - Args: - app_id (str): The Algolia application ID to retrieve information from. - api_key (str): The Algolia api key bound to the given `app_id`. - - - Returns: - The initialized API client. - - Example: - _client = UsageClientSync("YOUR_ALGOLIA_APP_ID", "YOUR_ALGOLIA_API_KEY") - _client_with_named_args = UsageClientSync(app_id="YOUR_ALGOLIA_APP_ID", api_key="YOUR_ALGOLIA_API_KEY") - - See `UsageClientSync.create_with_config` for advanced configuration. - """ - - _transporter: TransporterSync - _config: UsageConfig - _request_options: RequestOptions - - def __init__( - self, - app_id: Optional[str] = None, - api_key: Optional[str] = None, - transporter: Optional[TransporterSync] = None, - config: Optional[UsageConfig] = None, - ) -> None: - if transporter is not None and config is None: - config = transporter._config - - if config is None: - config = UsageConfig(app_id, api_key) - self._config = config - self._request_options = RequestOptions(config) - - if transporter is None: - transporter = TransporterSync(config) - self._transporter = transporter - - def create_with_config( - config: UsageConfig, transporter: Optional[TransporterSync] = None - ) -> Self: - """Allows creating a client with a customized `UsageConfig` and `TransporterSync`. If `transporter` is not provided, the default one will be initialized from the given `config`. - - Args: - config (UsageConfig): The config of the API client. - transporter (TransporterSync): The HTTP transporter, see `http/transporter.py` for implementation details. - - Returns: - The initialized API client. - - Example: - _client_with_custom_config = UsageClientSync.create_with_config(config=UsageConfig(...)) - _client_with_custom_config_and_transporter = UsageClientSync.create_with_config(config=UsageConfig(...), transporter=TransporterSync(...)) - """ - if transporter is None: - transporter = TransporterSync(config) - - return UsageClientSync( - app_id=config.app_id, - api_key=config.api_key, - transporter=transporter, - config=config, - ) - - def __enter__(self) -> Self: - return self - - def __exit__(self, exc_type, exc_value, traceback) -> None: - """Closes the underlying `transporter` of the API client.""" - self.close() - - def close(self) -> None: - return self._transporter.close() - - def set_client_api_key(self, api_key: str) -> None: - """Sets a new API key to authenticate requests.""" - self._transporter._config.set_client_api_key(api_key) - - def custom_delete_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError( - "Parameter `path` is required when calling `custom_delete`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - return self._transporter.request( - verb=Verb.DELETE, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def custom_delete( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - self.custom_delete_with_http_info(path, parameters, request_options) - ).deserialize(object) - - def custom_get_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_get`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - return self._transporter.request( - verb=Verb.GET, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def custom_get( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - self.custom_get_with_http_info(path, parameters, request_options) - ).deserialize(object) - - def custom_post_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_post`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - _data = {} - if body is not None: - _data = body - - return self._transporter.request( - verb=Verb.POST, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - data=dumps(bodySerializer(_data)), - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def custom_post( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - self.custom_post_with_http_info(path, parameters, body, request_options) - ).deserialize(object) - - def custom_put_with_http_info( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if path is None: - raise ValueError("Parameter `path` is required when calling `custom_put`.") - - _query_parameters: List[Tuple[str, str]] = [] - - if parameters is not None: - for _qpkey, _qpvalue in parameters.items(): - _query_parameters.append((_qpkey, _qpvalue)) - - _data = {} - if body is not None: - _data = body - - return self._transporter.request( - verb=Verb.PUT, - path="/{path}".replace("{path}", path), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - data=dumps(bodySerializer(_data)), - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def custom_put( - self, - path: Annotated[ - StrictStr, - Field( - description='Path of the endpoint, anything after "/1" must be specified.' - ), - ], - parameters: Annotated[ - Optional[Dict[str, Any]], - Field(description="Query parameters to apply to the current query."), - ] = None, - body: Annotated[ - Optional[Dict[str, Any]], - Field(description="Parameters to send with the custom request."), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> object: - """ - This method allow you to send requests to the Algolia REST API. - - - :param path: Path of the endpoint, anything after \"/1\" must be specified. (required) - :type path: str - :param parameters: Query parameters to apply to the current query. - :type parameters: Dict[str, object] - :param body: Parameters to send with the custom request. - :type body: object - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'object' result object. - """ - return ( - self.custom_put_with_http_info(path, parameters, body, request_options) - ).deserialize(object) - - def get_index_usage_with_http_info( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - index_name: Annotated[ - StrictStr, - Field(description="Name of the index on which to perform the operation."), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - Retrieves the selected usage statistics for one index. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param index_name: Name of the index on which to perform the operation. (required) - :type index_name: str - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if statistic is None: - raise ValueError( - "Parameter `statistic` is required when calling `get_index_usage`." - ) - - if index_name is None: - raise ValueError( - "Parameter `index_name` is required when calling `get_index_usage`." - ) - - if start_date is None: - raise ValueError( - "Parameter `start_date` is required when calling `get_index_usage`." - ) - - if end_date is None: - raise ValueError( - "Parameter `end_date` is required when calling `get_index_usage`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if start_date is not None: - _query_parameters.append(("startDate", start_date)) - if end_date is not None: - _query_parameters.append(("endDate", end_date)) - if granularity is not None: - _query_parameters.append(("granularity", granularity)) - - return self._transporter.request( - verb=Verb.GET, - path="/1/usage/{statistic}/{indexName}".replace( - "{statistic}", quote(str(statistic), safe="") - ).replace("{indexName}", quote(str(index_name), safe="")), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def get_index_usage( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - index_name: Annotated[ - StrictStr, - Field(description="Name of the index on which to perform the operation."), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> IndexUsage: - """ - Retrieves the selected usage statistics for one index. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param index_name: Name of the index on which to perform the operation. (required) - :type index_name: str - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'IndexUsage' result object. - """ - return ( - self.get_index_usage_with_http_info( - statistic, - index_name, - start_date, - end_date, - granularity, - request_options, - ) - ).deserialize(IndexUsage) - - def get_usage_with_http_info( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> ApiResponse[str]: - """ - Retrieves usage statistics evaluated over a specified period. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the raw algoliasearch 'APIResponse' object. - """ - - if statistic is None: - raise ValueError( - "Parameter `statistic` is required when calling `get_usage`." - ) - - if start_date is None: - raise ValueError( - "Parameter `start_date` is required when calling `get_usage`." - ) - - if end_date is None: - raise ValueError( - "Parameter `end_date` is required when calling `get_usage`." - ) - - _query_parameters: List[Tuple[str, str]] = [] - - if start_date is not None: - _query_parameters.append(("startDate", start_date)) - if end_date is not None: - _query_parameters.append(("endDate", end_date)) - if granularity is not None: - _query_parameters.append(("granularity", granularity)) - - return self._transporter.request( - verb=Verb.GET, - path="/1/usage/{statistic}".replace( - "{statistic}", quote(str(statistic), safe="") - ), - request_options=self._request_options.merge( - query_parameters=_query_parameters, - user_request_options=request_options, - ), - use_read_transporter=False, - ) - - def get_usage( - self, - statistic: Annotated[ - Statistic, - Field( - description="Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. " - ), - ], - start_date: Annotated[ - StrictStr, - Field( - description="Start date of the period to analyze, in RFC 3339 format." - ), - ], - end_date: Annotated[ - StrictStr, - Field(description="End date of the period to analyze, in RFC 3339 format."), - ], - granularity: Annotated[ - Optional[Granularity], - Field( - description="Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. " - ), - ] = None, - request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> IndexUsage: - """ - Retrieves usage statistics evaluated over a specified period. - - - :param statistic: Usage statistics to retrieve. Use `*` to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - `search_operations`. All search operations. - `total_search_operations`: Sum of all search operations. - `total_search_requests`: Sum of all [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus `querysuggestions_total_search_requests`. - `queries_operations`. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - `multi_queries_operations`. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - `acl_operations`. All ACL operations. - `total_acl_operations`. Sum of all ACL operations. - `get_api_keys_operations`. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - `get_api_key_operations`. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - `add_api_key_operations`. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - `update_api_key_operations`. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - `delete_api_key_operations`. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - `list_api_key_operations`. Number of list index API keys operations. **Indexing operations** - `indexing_operations`. All indexing operations. - `total_indexing_operations`. Sum of all indexing operations. - `browse_operations`. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - `clear_index_operations`. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - `copy_move_operations`. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - `delete_index_operations`. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - `get_log_operations`. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - `get_settings_operations`. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - `set_settings_operations`. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - `list_indices_operations`. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - `wait_task_operations`. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - `record_operations`. All record operations. - `total_records_operations`. Sum of all record operations. - `add_record_operations`. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - `batch_operations`. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - `delete_by_query_operations`. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - `delete_record_operations`. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - `get_record_operations`. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - `partial_update_record_operations`. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - `update_record_operations`. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - `synonym_operations`. All synonym operations. - `total_synonym_operations`. Sum of all synonym operations. - `batch_synonym_operations`. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - `clear_synonym_operations`. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - `delete_synonym_operations`. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - `get_synonym_operations`. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - `query_synonym_operations`. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - `update_synonym_operations`. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - `rule_operations`. All rule operations. - `total_rules_operations`. Sum of all rule operations. - `batch_rules_operations`. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - `clear_rules_operations`. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - `delete_rules_operations`. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - `get_rules_operations`. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - `save_rules_operations`. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - `search_rules_operations`. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - `total_recommend_requests`. Number of [Recommend requests](https://www.algolia.com/doc/guides/algolia-ai/recommend/) - `total_write_operations`. Number of Write operations - `total_read_operations`. Number of read operations - `total_operations`. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of `total_search_operations`. - `querysuggestions_total_search_operations`. Number of Query Suggestions search operations. - `querysuggestions_total_search_requests`. Number of Query Suggestions [search requests](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - `querysuggestions_total_acl_operations`. Sum of all Query Suggestions [ACL operations](#acl-operations). - `querysuggestions_total_indexing_operations`. Number of Query Suggestions [indexing operations](#indexing-operations). - `querysuggestions_total_records_operations`. Number of Query Suggestions [record operations](#record-operations). - `querysuggestions_total_synonym_operations`. Number of Query Suggestions [synonym operations](#synonym-operations). - `querysuggestions_total_rules_operations`. Number of Query Suggestions [Rule operations](#rule-operations). - `querysuggestions_total_write_operations`. Number of Query Suggestions Write operations. - `querysuggestions_total_read_operations`. Number of Query Suggestions Read operations. - `querysuggestions_total_operations`. Sum of all Query Suggestions operations. **Processing time** - `avg_processing_time`. Average processing time (in milliseconds). - `90p_processing_time`. 90th percentile of processing time (in milliseconds). - `99p_processing_time`. 99th percentile of processing time (in milliseconds). - `queries_above_last_ms_processing_time`. Number of queries that take one or more seconds to process. **Indices** - `records`. Number of records. - `data_size`. The size of the records (in bytes). - `file_size`. The size of the records _and_ index metadata (in bytes). **Maximum queries per second** - `max_qps`. [Maximum queries per second](https://support.algolia.com/hc/en-us/articles/4406975224721) per server. - `region_max_qps`. Maximum queries per second per region. - `total_max_qps`. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - `used_search_capacity`. Maximum search capacity used per server. - `avg_used_search_capacity`. Average search capacity used per server. - `region_used_search_capacity`. Maximum search capacity used per region. - `region_avg_used_search_capacity`. Average search capacity used per region. - `total_used_search_capacity`. Maximum search capacity used for all servers. - `total_avg_used_search_capacity`. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](https://support.algolia.com/hc/en-us/articles/4406981934481). - `degraded_queries_ssd_used_queries_impacted`. Percentage of degraded queries due to the Algolia search engine having to read from the server's SSD. - `degraded_queries_ssd_used_seconds_impacted`. Percentage of seconds affected by `ssd_used` degraded queries. - `degraded_queries_max_capacity_queries_impacted`. Percentage of degraded queries due to all search threads being used. - `degraded_queries_max_capacity_seconds_impacted`. Percentage of seconds affected by `max_capacity` degraded queries. (required) - :type statistic: Statistic - :param start_date: Start date of the period to analyze, in RFC 3339 format. (required) - :type start_date: str - :param end_date: End date of the period to analyze, in RFC 3339 format. (required) - :type end_date: str - :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. - :type granularity: Granularity - :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'IndexUsage' result object. - """ - return ( - self.get_usage_with_http_info( - statistic, start_date, end_date, granularity, request_options - ) - ).deserialize(IndexUsage) diff --git a/algoliasearch/usage/config.py b/algoliasearch/usage/config.py deleted file mode 100644 index e4f211231..000000000 --- a/algoliasearch/usage/config.py +++ /dev/null @@ -1,35 +0,0 @@ -from os import environ - -from algoliasearch.http.base_config import BaseConfig -from algoliasearch.http.hosts import Host, HostsCollection -from algoliasearch.http.user_agent import UserAgent - - -class UsageConfig(BaseConfig): - def __init__(self, app_id: str, api_key: str) -> None: - super().__init__(app_id, api_key) - - user_agent = UserAgent().add("Usage") - - self.headers = { - "x-algolia-application-id": app_id, - "x-algolia-api-key": api_key, - "user-agent": user_agent.get(), - "content-type": "application/json", - } - - http_proxy = environ.get("HTTP_PROXY") - https_proxy = environ.get("HTTPS_PROXY") - - self.proxies = {} - - if http_proxy is not None: - self.proxies["http"] = http_proxy - if https_proxy is not None: - self.proxies["https"] = https_proxy - - self.hosts = HostsCollection( - [ - Host("usage.algolia.com"), - ] - ) diff --git a/algoliasearch/usage/models/__init__.py b/algoliasearch/usage/models/__init__.py deleted file mode 100644 index f117bc97a..000000000 --- a/algoliasearch/usage/models/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -# The version of the algoliasearch package -__version__ = "4.4.0" diff --git a/algoliasearch/usage/models/error_base.py b/algoliasearch/usage/models/error_base.py deleted file mode 100644 index c06b0dc41..000000000 --- a/algoliasearch/usage/models/error_base.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, ClassVar, Dict, List, Optional - -from pydantic import BaseModel, ConfigDict, StrictStr - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -class ErrorBase(BaseModel): - """ - Error. - """ - - message: Optional[StrictStr] = None - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["message"] - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ErrorBase from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - * Fields in `self.additional_properties` are added to the output dict. - """ - _dict = self.model_dump( - by_alias=True, - exclude={ - "additional_properties", - }, - exclude_none=True, - ) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ErrorBase from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"message": obj.get("message")}) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj diff --git a/algoliasearch/usage/models/error_item.py b/algoliasearch/usage/models/error_item.py deleted file mode 100644 index a5830d8ec..000000000 --- a/algoliasearch/usage/models/error_item.py +++ /dev/null @@ -1,77 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, Dict, Optional - -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -class ErrorItem(BaseModel): - """ - ErrorItem - """ - - code: Optional[StrictStr] = None - message: StrictStr - line: Optional[StrictInt] = None - position: Optional[StrictInt] = None - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ErrorItem from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={}, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ErrorItem from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "code": obj.get("code"), - "message": obj.get("message"), - "line": obj.get("line"), - "position": obj.get("position"), - } - ) - return _obj diff --git a/algoliasearch/usage/models/forbidden_error.py b/algoliasearch/usage/models/forbidden_error.py deleted file mode 100644 index 81981e590..000000000 --- a/algoliasearch/usage/models/forbidden_error.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, Dict, List, Optional - -from pydantic import BaseModel, ConfigDict, StrictStr - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -from algoliasearch.usage.models.error_item import ErrorItem - - -class ForbiddenError(BaseModel): - """ - ForbiddenError - """ - - code: Optional[StrictStr] = None - message: Optional[StrictStr] = None - errors: Optional[List[ErrorItem]] = None - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of ForbiddenError from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={}, - exclude_none=True, - ) - _items = [] - if self.errors: - for _item in self.errors: - if _item: - _items.append(_item.to_dict()) - _dict["errors"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ForbiddenError from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "code": obj.get("code"), - "message": obj.get("message"), - "errors": ( - [ErrorItem.from_dict(_item) for _item in obj.get("errors")] - if obj.get("errors") is not None - else None - ), - } - ) - return _obj diff --git a/algoliasearch/usage/models/granularity.py b/algoliasearch/usage/models/granularity.py deleted file mode 100644 index 9a87d4e36..000000000 --- a/algoliasearch/usage/models/granularity.py +++ /dev/null @@ -1,33 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from enum import Enum -from json import loads -from sys import version_info - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -class Granularity(str, Enum): - """ - Granularity - """ - - """ - allowed enum values - """ - HOURLY = "hourly" - DAILY = "daily" - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Granularity from a JSON string""" - return cls(loads(json_str)) diff --git a/algoliasearch/usage/models/index_usage.py b/algoliasearch/usage/models/index_usage.py deleted file mode 100644 index 282236692..000000000 --- a/algoliasearch/usage/models/index_usage.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, Dict, List, Optional - -from pydantic import BaseModel, ConfigDict - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -from algoliasearch.usage.models.statistic_entry import StatisticEntry - - -class IndexUsage(BaseModel): - """ - IndexUsage - """ - - statistics: Optional[List[StatisticEntry]] = None - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of IndexUsage from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={}, - exclude_none=True, - ) - _items = [] - if self.statistics: - for _item in self.statistics: - if _item: - _items.append(_item.to_dict()) - _dict["statistics"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of IndexUsage from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "statistics": ( - [StatisticEntry.from_dict(_item) for _item in obj.get("statistics")] - if obj.get("statistics") is not None - else None - ) - } - ) - return _obj diff --git a/algoliasearch/usage/models/invalid_request_error.py b/algoliasearch/usage/models/invalid_request_error.py deleted file mode 100644 index 2f5e9c750..000000000 --- a/algoliasearch/usage/models/invalid_request_error.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, Dict, List, Optional - -from pydantic import BaseModel, ConfigDict, StrictStr - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -from algoliasearch.usage.models.error_item import ErrorItem - - -class InvalidRequestError(BaseModel): - """ - InvalidRequestError - """ - - code: Optional[StrictStr] = None - message: Optional[StrictStr] = None - errors: Optional[List[ErrorItem]] = None - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of InvalidRequestError from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={}, - exclude_none=True, - ) - _items = [] - if self.errors: - for _item in self.errors: - if _item: - _items.append(_item.to_dict()) - _dict["errors"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of InvalidRequestError from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "code": obj.get("code"), - "message": obj.get("message"), - "errors": ( - [ErrorItem.from_dict(_item) for _item in obj.get("errors")] - if obj.get("errors") is not None - else None - ), - } - ) - return _obj diff --git a/algoliasearch/usage/models/statistic.py b/algoliasearch/usage/models/statistic.py deleted file mode 100644 index 82ae80703..000000000 --- a/algoliasearch/usage/models/statistic.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from enum import Enum -from json import loads -from sys import version_info - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -class Statistic(str, Enum): - """ - Statistic - """ - - """ - allowed enum values - """ - STAR = "*" - SEARCH_OPERATIONS = "search_operations" - TOTAL_SEARCH_OPERATIONS = "total_search_operations" - TOTAL_SEARCH_REQUESTS = "total_search_requests" - QUERIES_OPERATIONS = "queries_operations" - MULTI_QUERIES_OPERATIONS = "multi_queries_operations" - ACL_OPERATIONS = "acl_operations" - TOTAL_ACL_OPERATIONS = "total_acl_operations" - GET_API_KEYS_OPERATIONS = "get_api_keys_operations" - GET_API_KEY_OPERATIONS = "get_api_key_operations" - ADD_API_KEY_OPERATIONS = "add_api_key_operations" - UPDATE_API_KEY_OPERATIONS = "update_api_key_operations" - DELETE_API_KEY_OPERATIONS = "delete_api_key_operations" - LIST_API_KEY_OPERATIONS = "list_api_key_operations" - INDEXING_OPERATIONS = "indexing_operations" - TOTAL_INDEXING_OPERATIONS = "total_indexing_operations" - BROWSE_OPERATIONS = "browse_operations" - CLEAR_INDEX_OPERATIONS = "clear_index_operations" - COPY_MOVE_OPERATIONS = "copy_move_operations" - DELETE_INDEX_OPERATIONS = "delete_index_operations" - GET_LOG_OPERATIONS = "get_log_operations" - GET_SETTINGS_OPERATIONS = "get_settings_operations" - SET_SETTINGS_OPERATIONS = "set_settings_operations" - LIST_INDICES_OPERATIONS = "list_indices_operations" - WAIT_TASK_OPERATIONS = "wait_task_operations" - RECORD_OPERATIONS = "record_operations" - TOTAL_RECORDS_OPERATIONS = "total_records_operations" - ADD_RECORD_OPERATIONS = "add_record_operations" - BATCH_OPERATIONS = "batch_operations" - DELETE_BY_QUERY_OPERATIONS = "delete_by_query_operations" - DELETE_RECORD_OPERATIONS = "delete_record_operations" - GET_RECORD_OPERATIONS = "get_record_operations" - PARTIAL_UPDATE_RECORD_OPERATIONS = "partial_update_record_operations" - UPDATE_RECORD_OPERATIONS = "update_record_operations" - SYNONYM_OPERATIONS = "synonym_operations" - TOTAL_SYNONYM_OPERATIONS = "total_synonym_operations" - BATCH_SYNONYM_OPERATIONS = "batch_synonym_operations" - CLEAR_SYNONYM_OPERATIONS = "clear_synonym_operations" - DELETE_SYNONYM_OPERATIONS = "delete_synonym_operations" - GET_SYNONYM_OPERATIONS = "get_synonym_operations" - QUERY_SYNONYM_OPERATIONS = "query_synonym_operations" - UPDATE_SYNONYM_OPERATIONS = "update_synonym_operations" - RULE_OPERATIONS = "rule_operations" - TOTAL_RULES_OPERATIONS = "total_rules_operations" - BATCH_RULES_OPERATIONS = "batch_rules_operations" - CLEAR_RULES_OPERATIONS = "clear_rules_operations" - DELETE_RULES_OPERATIONS = "delete_rules_operations" - GET_RULES_OPERATIONS = "get_rules_operations" - SAVE_RULES_OPERATIONS = "save_rules_operations" - SEARCH_RULES_OPERATIONS = "search_rules_operations" - TOTAL_RECOMMEND_REQUESTS = "total_recommend_requests" - TOTAL_WRITE_OPERATIONS = "total_write_operations" - TOTAL_READ_OPERATIONS = "total_read_operations" - TOTAL_OPERATIONS = "total_operations" - QUERYSUGGESTIONS_TOTAL_SEARCH_OPERATIONS = ( - "querysuggestions_total_search_operations" - ) - QUERYSUGGESTIONS_TOTAL_SEARCH_REQUESTS = "querysuggestions_total_search_requests" - QUERYSUGGESTIONS_TOTAL_ACL_OPERATIONS = "querysuggestions_total_acl_operations" - QUERYSUGGESTIONS_TOTAL_INDEXING_OPERATIONS = ( - "querysuggestions_total_indexing_operations" - ) - QUERYSUGGESTIONS_TOTAL_RECORDS_OPERATIONS = ( - "querysuggestions_total_records_operations" - ) - QUERYSUGGESTIONS_TOTAL_SYNONYM_OPERATIONS = ( - "querysuggestions_total_synonym_operations" - ) - QUERYSUGGESTIONS_TOTAL_RULES_OPERATIONS = "querysuggestions_total_rules_operations" - QUERYSUGGESTIONS_TOTAL_WRITE_OPERATIONS = "querysuggestions_total_write_operations" - QUERYSUGGESTIONS_TOTAL_READ_OPERATIONS = "querysuggestions_total_read_operations" - QUERYSUGGESTIONS_TOTAL_OPERATIONS = "querysuggestions_total_operations" - AVG_PROCESSING_TIME = "avg_processing_time" - ENUM_90P_PROCESSING_TIME = "90p_processing_time" - ENUM_99P_PROCESSING_TIME = "99p_processing_time" - QUERIES_ABOVE_LAST_MS_PROCESSING_TIME = "queries_above_last_ms_processing_time" - RECORDS = "records" - DATA_SIZE = "data_size" - FILE_SIZE = "file_size" - MAX_QPS = "max_qps" - REGION_MAX_QPS = "region_max_qps" - TOTAL_MAX_QPS = "total_max_qps" - USED_SEARCH_CAPACITY = "used_search_capacity" - AVG_USED_SEARCH_CAPACITY = "avg_used_search_capacity" - REGION_USED_SEARCH_CAPACITY = "region_used_search_capacity" - REGION_AVG_USED_SEARCH_CAPACITY = "region_avg_used_search_capacity" - TOTAL_USED_SEARCH_CAPACITY = "total_used_search_capacity" - TOTAL_AVG_USED_SEARCH_CAPACITY = "total_avg_used_search_capacity" - DEGRADED_QUERIES_SSD_USED_QUERIES_IMPACTED = ( - "degraded_queries_ssd_used_queries_impacted" - ) - DEGRADED_QUERIES_SSD_USED_SECONDS_IMPACTED = ( - "degraded_queries_ssd_used_seconds_impacted" - ) - DEGRADED_QUERIES_MAX_CAPACITY_QUERIES_IMPACTED = ( - "degraded_queries_max_capacity_queries_impacted" - ) - DEGRADED_QUERIES_MAX_CAPACITY_SECONDS_IMPACTED = ( - "degraded_queries_max_capacity_seconds_impacted" - ) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of Statistic from a JSON string""" - return cls(loads(json_str)) diff --git a/algoliasearch/usage/models/statistic_entry.py b/algoliasearch/usage/models/statistic_entry.py deleted file mode 100644 index d8ef41f67..000000000 --- a/algoliasearch/usage/models/statistic_entry.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import loads -from sys import version_info -from typing import Any, Dict, Optional - -from pydantic import BaseModel, ConfigDict, Field, StrictInt - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -from algoliasearch.usage.models.statistic_value import StatisticValue - - -class StatisticEntry(BaseModel): - """ - StatisticEntry - """ - - t: Optional[StrictInt] = Field( - default=None, - description="Timestamp, measured in milliseconds since the Unix epoch.", - ) - v: Optional[StatisticValue] = None - - model_config = ConfigDict( - use_enum_values=True, populate_by_name=True, validate_assignment=True - ) - - def to_json(self) -> str: - return self.model_dump_json(by_alias=True, exclude_unset=True) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of StatisticEntry from a JSON string""" - return cls.from_dict(loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - _dict = self.model_dump( - by_alias=True, - exclude={}, - exclude_none=True, - ) - if self.v: - _dict["v"] = self.v.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: Dict) -> Self: - """Create an instance of StatisticEntry from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "t": obj.get("t"), - "v": ( - StatisticValue.from_dict(obj.get("v")) - if obj.get("v") is not None - else None - ), - } - ) - return _obj diff --git a/algoliasearch/usage/models/statistic_value.py b/algoliasearch/usage/models/statistic_value.py deleted file mode 100644 index bd40325dc..000000000 --- a/algoliasearch/usage/models/statistic_value.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding: utf-8 - -""" -Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -""" - -from __future__ import annotations - -from json import dumps, loads -from sys import version_info -from typing import Dict, Optional, Union - -from pydantic import BaseModel, Field, StrictInt, ValidationError, model_serializer - -if version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self - - -class StatisticValue(BaseModel): - """ - StatisticValue - """ - - oneof_schema_1_validator: Optional[StrictInt] = Field( - default=None, description="Value of the metric." - ) - oneof_schema_2_validator: Optional[Dict[str, StrictInt]] = None - actual_instance: Optional[Union[Dict[str, int], int]] = None - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError( - "If a position argument is used, only 1 is allowed to set `actual_instance`" - ) - if kwargs: - raise ValueError( - "If a position argument is used, keyword arguments cannot be used." - ) - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @model_serializer - def unwrap_actual_instance(self) -> Optional[Union[Dict[str, int], int]]: - """ - Unwraps the `actual_instance` when calling the `to_json` method. - """ - return self.actual_instance if hasattr(self, "actual_instance") else self - - @classmethod - def from_dict(cls, obj: dict) -> Self: - return cls.from_json(dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Returns the object represented by the json string""" - instance = cls.model_construct() - error_messages = [] - - try: - instance.oneof_schema_1_validator = loads(json_str) - instance.actual_instance = instance.oneof_schema_1_validator - - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - try: - instance.oneof_schema_2_validator = loads(json_str) - instance.actual_instance = instance.oneof_schema_2_validator - - return instance - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - raise ValueError( - "No match found when deserializing the JSON string into StatisticValue with oneOf schemas: Dict[str, int], int. Details: " - + ", ".join(error_messages) - ) - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - if hasattr(self.actual_instance, "to_json"): - return self.actual_instance.to_json() - else: - return dumps(self.actual_instance) - - def to_dict(self) -> Dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - if hasattr(self.actual_instance, "to_dict"): - return self.actual_instance.to_dict() - else: - return self.actual_instance