-
-## ✨ Features
-
-- Thin & **minimal low-level HTTP client** to interact with Algolia's API
-- Works both on the **browser** and **node.js**
-- **UMD and ESM compatible**, you can use it with any module loader
-- Built with TypeScript
-
-## 💡 Getting Started
-
-To get started, you first need to install @algolia/client-usage (or any other available API client package).
-
-All of our clients comes with type definition, and are available for both browser and node environments.
-
-```bash
-yarn add @algolia/client-usage
-# or
-npm install @algolia/client-usage
-```
-
-Without a package manager
-
-Add the following JavaScript snippet to the of your website:
-
-```html
-
-```
-
-You can now import the Algolia API client in your project and play with it.
-
-```js
-import { usageClient } from '@algolia/client-usage';
-
-const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-```
-
-For full documentation, visit the **[Algolia JavaScript API Client](https://www.algolia.com/doc/libraries/javascript/)**.
-
-## ❓ Troubleshooting
-
-Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/libraries/javascript/v5/) where you will find answers for the most common issues and gotchas with the client. You can also open [a GitHub issue](https://github.com/algolia/api-clients-automation/issues/new?assignees=&labels=&projects=&template=Bug_report.md)
-
-## 📄 License
-
-The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
\ No newline at end of file
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/builds/browser.ts b/clients/algoliasearch-client-javascript/packages/client-usage/builds/browser.ts
deleted file mode 100644
index e29efe755f..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/builds/browser.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.
-
-import type { ClientOptions } from '@algolia/client-common';
-import {
- createMemoryCache,
- createFallbackableCache,
- createBrowserLocalStorageCache,
- DEFAULT_CONNECT_TIMEOUT_BROWSER,
- DEFAULT_READ_TIMEOUT_BROWSER,
- DEFAULT_WRITE_TIMEOUT_BROWSER,
-} from '@algolia/client-common';
-import { createXhrRequester } from '@algolia/requester-browser-xhr';
-
-import { createUsageClient, apiClientVersion } from '../src/usageClient';
-
-export type UsageClient = ReturnType;
-
-export { apiClientVersion } from '../src/usageClient';
-export * from '../model';
-
-export function usageClient(appId: string, apiKey: string, options?: ClientOptions): UsageClient {
- if (!appId || typeof appId !== 'string') {
- throw new Error('`appId` is missing.');
- }
-
- if (!apiKey || typeof apiKey !== 'string') {
- throw new Error('`apiKey` is missing.');
- }
-
- return createUsageClient({
- appId,
- apiKey,
- timeouts: {
- connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
- read: DEFAULT_READ_TIMEOUT_BROWSER,
- write: DEFAULT_WRITE_TIMEOUT_BROWSER,
- },
- requester: createXhrRequester(),
- algoliaAgents: [{ segment: 'Browser' }],
- authMode: 'WithinQueryParameters',
- responsesCache: createMemoryCache(),
- requestsCache: createMemoryCache({ serializable: false }),
- hostsCache: createFallbackableCache({
- caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
- }),
- ...options,
- });
-}
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/builds/fetch.ts b/clients/algoliasearch-client-javascript/packages/client-usage/builds/fetch.ts
deleted file mode 100644
index 57a1e679f0..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/builds/fetch.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.
-
-import type { ClientOptions } from '@algolia/client-common';
-import {
- createMemoryCache,
- createNullCache,
- DEFAULT_CONNECT_TIMEOUT_NODE,
- DEFAULT_READ_TIMEOUT_NODE,
- DEFAULT_WRITE_TIMEOUT_NODE,
-} from '@algolia/client-common';
-import { createFetchRequester } from '@algolia/requester-fetch';
-
-import { createUsageClient } from '../src/usageClient';
-
-export type UsageClient = ReturnType;
-
-export { apiClientVersion } from '../src/usageClient';
-export * from '../model';
-
-export function usageClient(appId: string, apiKey: string, options?: ClientOptions): UsageClient {
- if (!appId || typeof appId !== 'string') {
- throw new Error('`appId` is missing.');
- }
-
- if (!apiKey || typeof apiKey !== 'string') {
- throw new Error('`apiKey` is missing.');
- }
-
- return {
- ...createUsageClient({
- appId,
- apiKey,
- timeouts: {
- connect: DEFAULT_CONNECT_TIMEOUT_NODE,
- read: DEFAULT_READ_TIMEOUT_NODE,
- write: DEFAULT_WRITE_TIMEOUT_NODE,
- },
- algoliaAgents: [{ segment: 'Fetch' }],
- requester: createFetchRequester(),
- responsesCache: createNullCache(),
- requestsCache: createNullCache(),
- hostsCache: createMemoryCache(),
- ...options,
- }),
- };
-}
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/builds/node.ts b/clients/algoliasearch-client-javascript/packages/client-usage/builds/node.ts
deleted file mode 100644
index a94eef922f..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/builds/node.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.
-
-import type { ClientOptions } from '@algolia/client-common';
-import {
- createMemoryCache,
- createNullCache,
- DEFAULT_CONNECT_TIMEOUT_NODE,
- DEFAULT_READ_TIMEOUT_NODE,
- DEFAULT_WRITE_TIMEOUT_NODE,
-} from '@algolia/client-common';
-import { createHttpRequester } from '@algolia/requester-node-http';
-
-import { createUsageClient } from '../src/usageClient';
-
-export type UsageClient = ReturnType;
-
-export { apiClientVersion } from '../src/usageClient';
-export * from '../model';
-
-export function usageClient(appId: string, apiKey: string, options?: ClientOptions): UsageClient {
- if (!appId || typeof appId !== 'string') {
- throw new Error('`appId` is missing.');
- }
-
- if (!apiKey || typeof apiKey !== 'string') {
- throw new Error('`apiKey` is missing.');
- }
-
- return {
- ...createUsageClient({
- appId,
- apiKey,
- timeouts: {
- connect: DEFAULT_CONNECT_TIMEOUT_NODE,
- read: DEFAULT_READ_TIMEOUT_NODE,
- write: DEFAULT_WRITE_TIMEOUT_NODE,
- },
- requester: createHttpRequester(),
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
- responsesCache: createNullCache(),
- requestsCache: createNullCache(),
- hostsCache: createMemoryCache(),
- ...options,
- }),
- };
-}
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/index.d.ts b/clients/algoliasearch-client-javascript/packages/client-usage/index.d.ts
deleted file mode 100644
index 23eac31bdc..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/index.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line import/no-unresolved
-export * from './dist/node';
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/index.js b/clients/algoliasearch-client-javascript/packages/client-usage/index.js
deleted file mode 100644
index 5ae95ae019..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// eslint-disable-next-line import/no-commonjs,import/extensions
-module.exports = require('./dist/builds/node.cjs');
\ No newline at end of file
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/clientMethodProps.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/clientMethodProps.ts
deleted file mode 100644
index 349aa8ee07..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/clientMethodProps.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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.
-
-import type { Granularity } from './granularity';
-import type { Statistic } from './statistic';
-
-/**
- * Properties for the `customDelete` method.
- */
-export type CustomDeleteProps = {
- /**
- * Path of the endpoint, anything after \"/1\" must be specified.
- */
- path: string;
- /**
- * Query parameters to apply to the current query.
- */
- parameters?: Record;
-};
-
-/**
- * Properties for the `customGet` method.
- */
-export type CustomGetProps = {
- /**
- * Path of the endpoint, anything after \"/1\" must be specified.
- */
- path: string;
- /**
- * Query parameters to apply to the current query.
- */
- parameters?: Record;
-};
-
-/**
- * Properties for the `customPost` method.
- */
-export type CustomPostProps = {
- /**
- * Path of the endpoint, anything after \"/1\" must be specified.
- */
- path: string;
- /**
- * Query parameters to apply to the current query.
- */
- parameters?: Record;
- /**
- * Parameters to send with the custom request.
- */
- body?: Record;
-};
-
-/**
- * Properties for the `customPut` method.
- */
-export type CustomPutProps = {
- /**
- * Path of the endpoint, anything after \"/1\" must be specified.
- */
- path: string;
- /**
- * Query parameters to apply to the current query.
- */
- parameters?: Record;
- /**
- * Parameters to send with the custom request.
- */
- body?: Record;
-};
-
-/**
- * Properties for the `getIndexUsage` method.
- */
-export type GetIndexUsageProps = {
- /**
- * 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.
- */
- statistic: Statistic;
- /**
- * Name of the index on which to perform the operation.
- */
- indexName: string;
- /**
- * Start date of the period to analyze, in RFC 3339 format.
- */
- startDate: string;
- /**
- * End date of the period to analyze, in RFC 3339 format.
- */
- endDate: string;
- /**
- * 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.
- */
- granularity?: Granularity;
-};
-
-/**
- * Properties for the `getUsage` method.
- */
-export type GetUsageProps = {
- /**
- * 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.
- */
- statistic: Statistic;
- /**
- * Start date of the period to analyze, in RFC 3339 format.
- */
- startDate: string;
- /**
- * End date of the period to analyze, in RFC 3339 format.
- */
- endDate: string;
- /**
- * 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.
- */
- granularity?: Granularity;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/errorBase.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/errorBase.ts
deleted file mode 100644
index 960e509cb7..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/errorBase.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-// 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.
-
-/**
- * Error.
- */
-export type ErrorBase = Record & {
- message?: string;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/errorItem.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/errorItem.ts
deleted file mode 100644
index b53f82dec3..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/errorItem.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-export type ErrorItem = {
- code?: string;
-
- message: string;
-
- line?: number;
-
- position?: number;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/forbidden.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/forbidden.ts
deleted file mode 100644
index 5ff3b64e65..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/forbidden.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// 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.
-
-import type { ForbiddenError } from './forbiddenError';
-
-export type Forbidden = {
- error: ForbiddenError;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/forbiddenError.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/forbiddenError.ts
deleted file mode 100644
index 0100f73759..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/forbiddenError.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-import type { ErrorItem } from './errorItem';
-
-export type ForbiddenError = {
- code?: string;
-
- message?: string;
-
- errors?: ErrorItem[];
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/granularity.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/granularity.ts
deleted file mode 100644
index 4bdf841d2c..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/granularity.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-// 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.
-
-export type Granularity = 'daily' | 'hourly';
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/index.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/index.ts
deleted file mode 100644
index 3bae42d10c..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/index.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.
-
-export * from './errorBase';
-export * from './errorItem';
-export * from './forbidden';
-export * from './forbiddenError';
-export * from './granularity';
-export * from './indexUsage';
-export * from './invalidRequest';
-export * from './invalidRequestError';
-export * from './statistic';
-export * from './statisticEntry';
-export * from './statisticValue';
-export * from './clientMethodProps';
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/indexUsage.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/indexUsage.ts
deleted file mode 100644
index d1bb3c81f0..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/indexUsage.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// 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.
-
-import type { StatisticEntry } from './statisticEntry';
-
-export type IndexUsage = {
- statistics?: StatisticEntry[];
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequest.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequest.ts
deleted file mode 100644
index 4f39387b32..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequest.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// 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.
-
-import type { InvalidRequestError } from './invalidRequestError';
-
-export type InvalidRequest = {
- error: InvalidRequestError;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequestError.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequestError.ts
deleted file mode 100644
index 6f96df12eb..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequestError.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-import type { ErrorItem } from './errorItem';
-
-export type InvalidRequestError = {
- code?: string;
-
- message?: string;
-
- errors?: ErrorItem[];
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/statistic.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/statistic.ts
deleted file mode 100644
index f9a6e18552..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/statistic.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-// 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.
-
-export type Statistic =
- | '*'
- | '90p_processing_time'
- | '99p_processing_time'
- | 'acl_operations'
- | 'add_api_key_operations'
- | 'add_record_operations'
- | 'avg_processing_time'
- | 'avg_used_search_capacity'
- | 'batch_operations'
- | 'batch_rules_operations'
- | 'batch_synonym_operations'
- | 'browse_operations'
- | 'clear_index_operations'
- | 'clear_rules_operations'
- | 'clear_synonym_operations'
- | 'copy_move_operations'
- | 'data_size'
- | 'degraded_queries_max_capacity_queries_impacted'
- | 'degraded_queries_max_capacity_seconds_impacted'
- | 'degraded_queries_ssd_used_queries_impacted'
- | 'degraded_queries_ssd_used_seconds_impacted'
- | 'delete_api_key_operations'
- | 'delete_by_query_operations'
- | 'delete_index_operations'
- | 'delete_record_operations'
- | 'delete_rules_operations'
- | 'delete_synonym_operations'
- | 'file_size'
- | 'get_api_key_operations'
- | 'get_api_keys_operations'
- | 'get_log_operations'
- | 'get_record_operations'
- | 'get_rules_operations'
- | 'get_settings_operations'
- | 'get_synonym_operations'
- | 'indexing_operations'
- | 'list_api_key_operations'
- | 'list_indices_operations'
- | 'max_qps'
- | 'multi_queries_operations'
- | 'partial_update_record_operations'
- | 'queries_above_last_ms_processing_time'
- | 'queries_operations'
- | 'query_synonym_operations'
- | 'querysuggestions_total_acl_operations'
- | 'querysuggestions_total_indexing_operations'
- | 'querysuggestions_total_operations'
- | 'querysuggestions_total_read_operations'
- | 'querysuggestions_total_records_operations'
- | 'querysuggestions_total_rules_operations'
- | 'querysuggestions_total_search_operations'
- | 'querysuggestions_total_search_requests'
- | 'querysuggestions_total_synonym_operations'
- | 'querysuggestions_total_write_operations'
- | 'record_operations'
- | 'records'
- | 'region_avg_used_search_capacity'
- | 'region_max_qps'
- | 'region_used_search_capacity'
- | 'rule_operations'
- | 'save_rules_operations'
- | 'search_operations'
- | 'search_rules_operations'
- | 'set_settings_operations'
- | 'synonym_operations'
- | 'total_acl_operations'
- | 'total_avg_used_search_capacity'
- | 'total_indexing_operations'
- | 'total_max_qps'
- | 'total_operations'
- | 'total_read_operations'
- | 'total_recommend_requests'
- | 'total_records_operations'
- | 'total_rules_operations'
- | 'total_search_operations'
- | 'total_search_requests'
- | 'total_synonym_operations'
- | 'total_used_search_capacity'
- | 'total_write_operations'
- | 'update_api_key_operations'
- | 'update_record_operations'
- | 'update_synonym_operations'
- | 'used_search_capacity'
- | 'wait_task_operations';
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticEntry.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticEntry.ts
deleted file mode 100644
index 5ed9a04769..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticEntry.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.
-
-import type { StatisticValue } from './statisticValue';
-
-export type StatisticEntry = {
- /**
- * Timestamp, measured in milliseconds since the Unix epoch.
- */
- t?: number;
-
- v?: StatisticValue;
-};
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticValue.ts b/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticValue.ts
deleted file mode 100644
index a4280d0659..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/model/statisticValue.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-// 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.
-
-export type StatisticValue = Record | number;
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/package.json b/clients/algoliasearch-client-javascript/packages/client-usage/package.json
deleted file mode 100644
index 3b09ca1b0b..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/package.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "version": "1.4.0",
- "repository": {
- "type": "git",
- "url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
- },
- "type": "module",
- "license": "MIT",
- "author": "Algolia",
- "scripts": {
- "build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
- "clean": "rm -rf ./dist || true",
- "test:bundle": "publint . && attw --pack ."
- },
- "name": "@algolia/client-usage",
- "description": "JavaScript client for client-usage",
- "exports": {
- ".": {
- "node": {
- "types": {
- "import": "./dist/node.d.ts",
- "module": "./dist/node.d.ts",
- "require": "./dist/node.d.cts"
- },
- "import": "./dist/builds/node.js",
- "module": "./dist/builds/node.js",
- "require": "./dist/builds/node.cjs"
- },
- "worker": {
- "types": "./dist/fetch.d.ts",
- "default": "./dist/builds/fetch.js"
- },
- "default": {
- "types": "./dist/browser.d.ts",
- "module": "./dist/builds/browser.js",
- "import": "./dist/builds/browser.js",
- "default": "./dist/builds/browser.umd.js"
- }
- },
- "./src/*": "./src/*.ts"
- },
- "jsdelivr": "./dist/builds/browser.umd.js",
- "unpkg": "./dist/builds/browser.umd.js",
- "files": [
- "dist",
- "model",
- "index.js",
- "index.d.ts"
- ],
- "dependencies": {
- "@algolia/client-common": "5.4.0",
- "@algolia/requester-browser-xhr": "5.4.0",
- "@algolia/requester-fetch": "5.4.0",
- "@algolia/requester-node-http": "5.4.0"
- },
- "devDependencies": {
- "@arethetypeswrong/cli": "0.15.4",
- "@types/node": "22.5.1",
- "publint": "0.2.10",
- "rollup": "4.21.2",
- "tsup": "8.2.4",
- "typescript": "5.5.4"
- },
- "engines": {
- "node": ">= 14.0.0"
- }
-}
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/rollup.config.js b/clients/algoliasearch-client-javascript/packages/client-usage/rollup.config.js
deleted file mode 100644
index 5d6d945baa..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/rollup.config.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export default [
- {
- input: 'dist/builds/browser.min.js',
- external: ['dom'],
- output: {
- esModule: false,
- file: 'dist/builds/browser.umd.js',
- name: 'usageClient',
- format: 'umd',
- sourcemap: false,
- globals: {
- ['usageClient']: 'usageClient',
- },
- },
- },
-]
\ No newline at end of file
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/src/usageClient.ts b/clients/algoliasearch-client-javascript/packages/client-usage/src/usageClient.ts
deleted file mode 100644
index a35a09dffd..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/src/usageClient.ts
+++ /dev/null
@@ -1,330 +0,0 @@
-// 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.
-
-import { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';
-import type {
- CreateClientOptions,
- Headers,
- Host,
- QueryParameters,
- Request,
- RequestOptions,
-} from '@algolia/client-common';
-
-import type {
- CustomDeleteProps,
- CustomGetProps,
- CustomPostProps,
- CustomPutProps,
- GetIndexUsageProps,
- GetUsageProps,
-} from '../model/clientMethodProps';
-import type { IndexUsage } from '../model/indexUsage';
-
-export const apiClientVersion = '1.4.0';
-
-function getDefaultHosts(): Host[] {
- return [{ url: 'usage.algolia.com', accept: 'readWrite', protocol: 'https' }];
-}
-
-// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
-export function createUsageClient({
- appId: appIdOption,
- apiKey: apiKeyOption,
- authMode,
- algoliaAgents,
- ...options
-}: CreateClientOptions) {
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
- const transporter = createTransporter({
- hosts: getDefaultHosts(),
- ...options,
- algoliaAgent: getAlgoliaAgent({
- algoliaAgents,
- client: 'Usage',
- version: apiClientVersion,
- }),
- baseHeaders: {
- 'content-type': 'text/plain',
- ...auth.headers(),
- ...options.baseHeaders,
- },
- baseQueryParameters: {
- ...auth.queryParameters(),
- ...options.baseQueryParameters,
- },
- });
-
- return {
- transporter,
-
- /**
- * The `appId` currently in use.
- */
- appId: appIdOption,
-
- /**
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
- */
- clearCache(): Promise {
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
- },
-
- /**
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
- */
- get _ua(): string {
- return transporter.algoliaAgent.value;
- },
-
- /**
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
- *
- * @param segment - The algolia agent (user-agent) segment to add.
- * @param version - The version of the agent.
- */
- addAlgoliaAgent(segment: string, version?: string): void {
- transporter.algoliaAgent.add({ segment, version });
- },
-
- /**
- * Helper method to switch the API key used to authenticate the requests.
- *
- * @param params - Method params.
- * @param params.apiKey - The new API Key to use.
- */
- setClientApiKey({ apiKey }: { apiKey: string }): void {
- if (!authMode || authMode === 'WithinHeaders') {
- transporter.baseHeaders['x-algolia-api-key'] = apiKey;
- } else {
- transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
- }
- },
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param customDelete - The customDelete object.
- * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
- * @param customDelete.parameters - Query parameters to apply to the current query.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- customDelete(
- { path, parameters }: CustomDeleteProps,
- requestOptions?: RequestOptions,
- ): Promise> {
- if (!path) {
- throw new Error('Parameter `path` is required when calling `customDelete`.');
- }
-
- const requestPath = '/{path}'.replace('{path}', path);
- const headers: Headers = {};
- const queryParameters: QueryParameters = parameters ? parameters : {};
-
- const request: Request = {
- method: 'DELETE',
- path: requestPath,
- queryParameters,
- headers,
- };
-
- return transporter.request(request, requestOptions);
- },
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param customGet - The customGet object.
- * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
- * @param customGet.parameters - Query parameters to apply to the current query.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise> {
- if (!path) {
- throw new Error('Parameter `path` is required when calling `customGet`.');
- }
-
- const requestPath = '/{path}'.replace('{path}', path);
- const headers: Headers = {};
- const queryParameters: QueryParameters = parameters ? parameters : {};
-
- const request: Request = {
- method: 'GET',
- path: requestPath,
- queryParameters,
- headers,
- };
-
- return transporter.request(request, requestOptions);
- },
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param customPost - The customPost object.
- * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
- * @param customPost.parameters - Query parameters to apply to the current query.
- * @param customPost.body - Parameters to send with the custom request.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- customPost(
- { path, parameters, body }: CustomPostProps,
- requestOptions?: RequestOptions,
- ): Promise> {
- if (!path) {
- throw new Error('Parameter `path` is required when calling `customPost`.');
- }
-
- const requestPath = '/{path}'.replace('{path}', path);
- const headers: Headers = {};
- const queryParameters: QueryParameters = parameters ? parameters : {};
-
- const request: Request = {
- method: 'POST',
- path: requestPath,
- queryParameters,
- headers,
- data: body ? body : {},
- };
-
- return transporter.request(request, requestOptions);
- },
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param customPut - The customPut object.
- * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
- * @param customPut.parameters - Query parameters to apply to the current query.
- * @param customPut.body - Parameters to send with the custom request.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- customPut(
- { path, parameters, body }: CustomPutProps,
- requestOptions?: RequestOptions,
- ): Promise> {
- if (!path) {
- throw new Error('Parameter `path` is required when calling `customPut`.');
- }
-
- const requestPath = '/{path}'.replace('{path}', path);
- const headers: Headers = {};
- const queryParameters: QueryParameters = parameters ? parameters : {};
-
- const request: Request = {
- method: 'PUT',
- path: requestPath,
- queryParameters,
- headers,
- data: body ? body : {},
- };
-
- return transporter.request(request, requestOptions);
- },
-
- /**
- * Retrieves the selected usage statistics for one index.
- *
- * @param getIndexUsage - The getIndexUsage object.
- * @param getIndexUsage.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.
- * @param getIndexUsage.indexName - Name of the index on which to perform the operation.
- * @param getIndexUsage.startDate - Start date of the period to analyze, in RFC 3339 format.
- * @param getIndexUsage.endDate - End date of the period to analyze, in RFC 3339 format.
- * @param getIndexUsage.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.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- getIndexUsage(
- { statistic, indexName, startDate, endDate, granularity }: GetIndexUsageProps,
- requestOptions?: RequestOptions,
- ): Promise {
- if (!statistic) {
- throw new Error('Parameter `statistic` is required when calling `getIndexUsage`.');
- }
-
- if (!indexName) {
- throw new Error('Parameter `indexName` is required when calling `getIndexUsage`.');
- }
-
- if (!startDate) {
- throw new Error('Parameter `startDate` is required when calling `getIndexUsage`.');
- }
-
- if (!endDate) {
- throw new Error('Parameter `endDate` is required when calling `getIndexUsage`.');
- }
-
- const requestPath = '/1/usage/{statistic}/{indexName}'
- .replace('{statistic}', encodeURIComponent(statistic))
- .replace('{indexName}', encodeURIComponent(indexName));
- const headers: Headers = {};
- const queryParameters: QueryParameters = {};
- if (startDate !== undefined) {
- queryParameters.startDate = startDate.toString();
- }
- if (endDate !== undefined) {
- queryParameters.endDate = endDate.toString();
- }
- if (granularity !== undefined) {
- queryParameters.granularity = granularity.toString();
- }
-
- const request: Request = {
- method: 'GET',
- path: requestPath,
- queryParameters,
- headers,
- };
-
- return transporter.request(request, requestOptions);
- },
-
- /**
- * Retrieves usage statistics evaluated over a specified period.
- *
- * @param getUsage - The getUsage object.
- * @param getUsage.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.
- * @param getUsage.startDate - Start date of the period to analyze, in RFC 3339 format.
- * @param getUsage.endDate - End date of the period to analyze, in RFC 3339 format.
- * @param getUsage.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.
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
- */
- getUsage(
- { statistic, startDate, endDate, granularity }: GetUsageProps,
- requestOptions?: RequestOptions,
- ): Promise {
- if (!statistic) {
- throw new Error('Parameter `statistic` is required when calling `getUsage`.');
- }
-
- if (!startDate) {
- throw new Error('Parameter `startDate` is required when calling `getUsage`.');
- }
-
- if (!endDate) {
- throw new Error('Parameter `endDate` is required when calling `getUsage`.');
- }
-
- const requestPath = '/1/usage/{statistic}'.replace('{statistic}', encodeURIComponent(statistic));
- const headers: Headers = {};
- const queryParameters: QueryParameters = {};
-
- if (startDate !== undefined) {
- queryParameters.startDate = startDate.toString();
- }
- if (endDate !== undefined) {
- queryParameters.endDate = endDate.toString();
- }
- if (granularity !== undefined) {
- queryParameters.granularity = granularity.toString();
- }
-
- const request: Request = {
- method: 'GET',
- path: requestPath,
- queryParameters,
- headers,
- };
-
- return transporter.request(request, requestOptions);
- },
- };
-}
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/tsconfig.json b/clients/algoliasearch-client-javascript/packages/client-usage/tsconfig.json
deleted file mode 100644
index 37a747f620..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "outDir": "dist"
- },
- "include": ["src", "model", "builds"],
- "exclude": ["dist", "node_modules"]
-}
\ No newline at end of file
diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/tsup.config.ts b/clients/algoliasearch-client-javascript/packages/client-usage/tsup.config.ts
deleted file mode 100644
index 664853a004..0000000000
--- a/clients/algoliasearch-client-javascript/packages/client-usage/tsup.config.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import type { Options } from 'tsup';
-import { defineConfig } from 'tsup';
-
-import { getBaseNodeOptions, getBaseBrowserOptions, getDependencies } from '../../base.tsup.config';
-
-import pkg from './package.json' with { type: 'json' };
-
-const nodeOptions: Options = {
- ...getBaseNodeOptions(pkg, __dirname),
- dts: { entry: { node: 'builds/node.ts' } },
- entry: ['builds/node.ts', 'src/*.ts'],
-};
-
-const nodeConfigs: Options[] = [
- {
- ...nodeOptions,
- format: 'cjs',
- name: `node ${pkg.name} cjs`,
- },
- {
- ...nodeOptions,
- format: 'esm',
- name: `node ${pkg.name} esm`,
- },
- {
- ...nodeOptions,
- format: 'esm',
- name: `fetch ${pkg.name} esm`,
- dts: { entry: { fetch: 'builds/fetch.ts' } },
- external: getDependencies(pkg, 'fetch'),
- entry: ['builds/fetch.ts', 'src/*.ts'],
- },
-];
-
-const browserOptions: Options = {
- ...getBaseBrowserOptions(pkg, __dirname),
- globalName: 'usageClient',
-};
-
-const browserConfigs: Options[] = [
- {
- ...browserOptions,
- minify: false,
- name: `browser ${pkg.name} esm`,
- dts: { entry: { browser: 'builds/browser.ts' } },
- entry: ['builds/browser.ts', 'src/*.ts'],
- },
- {
- ...browserOptions,
- dts: false,
- minify: true,
- name: `browser ${pkg.name} min esm`,
- entry: { 'builds/browser.min': 'builds/browser.ts' },
- external: [],
- noExternal: getDependencies(pkg, 'xhr'),
- },
-];
-
-export default defineConfig([...nodeConfigs, ...browserConfigs]);
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorBase.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorBase.kt
deleted file mode 100644
index bdf62a1ba4..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorBase.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import com.algolia.client.extensions.internal.*
-import kotlinx.serialization.*
-import kotlinx.serialization.descriptors.*
-import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
-
-/**
- * Error.
- *
- * @param message
- */
-@Serializable(ErrorBaseSerializer::class)
-public data class ErrorBase(
-
- val message: String? = null,
-
- val additionalProperties: Map? = null,
-)
-
-internal object ErrorBaseSerializer : KSerializer {
-
- override val descriptor: SerialDescriptor = buildClassSerialDescriptor("ErrorBase") {
- element("message", isOptional = true)
- }
-
- override fun deserialize(decoder: Decoder): ErrorBase {
- val input = decoder.asJsonDecoder()
- val tree = input.decodeJsonObject()
- return ErrorBase(
- message = tree["message"]?.let { input.json.decodeFromJsonElement(it) },
- additionalProperties = tree.filterKeys { it !in descriptor.elementNames },
- )
- }
-
- override fun serialize(encoder: Encoder, value: ErrorBase) {
- val output = encoder.asJsonEncoder()
- val json = buildJsonObject {
- value.message?.let { put("message", output.json.encodeToJsonElement(it)) }
- value.additionalProperties?.onEach { (key, element) -> put(key, element) }
- }
- (encoder as JsonEncoder).encodeJsonElement(json)
- }
-}
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorItem.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorItem.kt
deleted file mode 100644
index b8195fc936..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorItem.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-import kotlinx.serialization.json.*
-
-/**
- * ErrorItem
- *
- * @param message
- * @param code
- * @param line
- * @param position
- */
-@Serializable
-public data class ErrorItem(
-
- @SerialName(value = "message") val message: String,
-
- @SerialName(value = "code") val code: String? = null,
-
- @SerialName(value = "line") val line: Int? = null,
-
- @SerialName(value = "position") val position: Int? = null,
-)
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ForbiddenError.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ForbiddenError.kt
deleted file mode 100644
index 26977b4225..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ForbiddenError.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-import kotlinx.serialization.json.*
-
-/**
- * ForbiddenError
- *
- * @param code
- * @param message
- * @param errors
- */
-@Serializable
-public data class ForbiddenError(
-
- @SerialName(value = "code") val code: String? = null,
-
- @SerialName(value = "message") val message: String? = null,
-
- @SerialName(value = "errors") val errors: List? = null,
-)
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Granularity.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Granularity.kt
deleted file mode 100644
index 2b7e1c4330..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Granularity.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-
-@Serializable
-public enum class Granularity(public val value: kotlin.String) {
-
- @SerialName(value = "hourly")
- Hourly("hourly"),
-
- @SerialName(value = "daily")
- Daily("daily");
-
- override fun toString(): kotlin.String = value
-}
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/IndexUsage.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/IndexUsage.kt
deleted file mode 100644
index 688f5f13bb..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/IndexUsage.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-import kotlinx.serialization.json.*
-
-/**
- * IndexUsage
- *
- * @param statistics
- */
-@Serializable
-public data class IndexUsage(
-
- @SerialName(value = "statistics") val statistics: List? = null,
-)
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/InvalidRequestError.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/InvalidRequestError.kt
deleted file mode 100644
index e24128bf58..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/InvalidRequestError.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-import kotlinx.serialization.json.*
-
-/**
- * InvalidRequestError
- *
- * @param code
- * @param message
- * @param errors
- */
-@Serializable
-public data class InvalidRequestError(
-
- @SerialName(value = "code") val code: String? = null,
-
- @SerialName(value = "message") val message: String? = null,
-
- @SerialName(value = "errors") val errors: List? = null,
-)
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Statistic.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Statistic.kt
deleted file mode 100644
index f6fdccad7b..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Statistic.kt
+++ /dev/null
@@ -1,262 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-
-@Serializable
-public enum class Statistic(public val value: kotlin.String) {
-
- @SerialName(value = "*")
- Star("*"),
-
- @SerialName(value = "search_operations")
- SearchOperations("search_operations"),
-
- @SerialName(value = "total_search_operations")
- TotalSearchOperations("total_search_operations"),
-
- @SerialName(value = "total_search_requests")
- TotalSearchRequests("total_search_requests"),
-
- @SerialName(value = "queries_operations")
- QueriesOperations("queries_operations"),
-
- @SerialName(value = "multi_queries_operations")
- MultiQueriesOperations("multi_queries_operations"),
-
- @SerialName(value = "acl_operations")
- AclOperations("acl_operations"),
-
- @SerialName(value = "total_acl_operations")
- TotalAclOperations("total_acl_operations"),
-
- @SerialName(value = "get_api_keys_operations")
- GetApiKeysOperations("get_api_keys_operations"),
-
- @SerialName(value = "get_api_key_operations")
- GetApiKeyOperations("get_api_key_operations"),
-
- @SerialName(value = "add_api_key_operations")
- AddApiKeyOperations("add_api_key_operations"),
-
- @SerialName(value = "update_api_key_operations")
- UpdateApiKeyOperations("update_api_key_operations"),
-
- @SerialName(value = "delete_api_key_operations")
- DeleteApiKeyOperations("delete_api_key_operations"),
-
- @SerialName(value = "list_api_key_operations")
- ListApiKeyOperations("list_api_key_operations"),
-
- @SerialName(value = "indexing_operations")
- IndexingOperations("indexing_operations"),
-
- @SerialName(value = "total_indexing_operations")
- TotalIndexingOperations("total_indexing_operations"),
-
- @SerialName(value = "browse_operations")
- BrowseOperations("browse_operations"),
-
- @SerialName(value = "clear_index_operations")
- ClearIndexOperations("clear_index_operations"),
-
- @SerialName(value = "copy_move_operations")
- CopyMoveOperations("copy_move_operations"),
-
- @SerialName(value = "delete_index_operations")
- DeleteIndexOperations("delete_index_operations"),
-
- @SerialName(value = "get_log_operations")
- GetLogOperations("get_log_operations"),
-
- @SerialName(value = "get_settings_operations")
- GetSettingsOperations("get_settings_operations"),
-
- @SerialName(value = "set_settings_operations")
- SetSettingsOperations("set_settings_operations"),
-
- @SerialName(value = "list_indices_operations")
- ListIndicesOperations("list_indices_operations"),
-
- @SerialName(value = "wait_task_operations")
- WaitTaskOperations("wait_task_operations"),
-
- @SerialName(value = "record_operations")
- RecordOperations("record_operations"),
-
- @SerialName(value = "total_records_operations")
- TotalRecordsOperations("total_records_operations"),
-
- @SerialName(value = "add_record_operations")
- AddRecordOperations("add_record_operations"),
-
- @SerialName(value = "batch_operations")
- BatchOperations("batch_operations"),
-
- @SerialName(value = "delete_by_query_operations")
- DeleteByQueryOperations("delete_by_query_operations"),
-
- @SerialName(value = "delete_record_operations")
- DeleteRecordOperations("delete_record_operations"),
-
- @SerialName(value = "get_record_operations")
- GetRecordOperations("get_record_operations"),
-
- @SerialName(value = "partial_update_record_operations")
- PartialUpdateRecordOperations("partial_update_record_operations"),
-
- @SerialName(value = "update_record_operations")
- UpdateRecordOperations("update_record_operations"),
-
- @SerialName(value = "synonym_operations")
- SynonymOperations("synonym_operations"),
-
- @SerialName(value = "total_synonym_operations")
- TotalSynonymOperations("total_synonym_operations"),
-
- @SerialName(value = "batch_synonym_operations")
- BatchSynonymOperations("batch_synonym_operations"),
-
- @SerialName(value = "clear_synonym_operations")
- ClearSynonymOperations("clear_synonym_operations"),
-
- @SerialName(value = "delete_synonym_operations")
- DeleteSynonymOperations("delete_synonym_operations"),
-
- @SerialName(value = "get_synonym_operations")
- GetSynonymOperations("get_synonym_operations"),
-
- @SerialName(value = "query_synonym_operations")
- QuerySynonymOperations("query_synonym_operations"),
-
- @SerialName(value = "update_synonym_operations")
- UpdateSynonymOperations("update_synonym_operations"),
-
- @SerialName(value = "rule_operations")
- RuleOperations("rule_operations"),
-
- @SerialName(value = "total_rules_operations")
- TotalRulesOperations("total_rules_operations"),
-
- @SerialName(value = "batch_rules_operations")
- BatchRulesOperations("batch_rules_operations"),
-
- @SerialName(value = "clear_rules_operations")
- ClearRulesOperations("clear_rules_operations"),
-
- @SerialName(value = "delete_rules_operations")
- DeleteRulesOperations("delete_rules_operations"),
-
- @SerialName(value = "get_rules_operations")
- GetRulesOperations("get_rules_operations"),
-
- @SerialName(value = "save_rules_operations")
- SaveRulesOperations("save_rules_operations"),
-
- @SerialName(value = "search_rules_operations")
- SearchRulesOperations("search_rules_operations"),
-
- @SerialName(value = "total_recommend_requests")
- TotalRecommendRequests("total_recommend_requests"),
-
- @SerialName(value = "total_write_operations")
- TotalWriteOperations("total_write_operations"),
-
- @SerialName(value = "total_read_operations")
- TotalReadOperations("total_read_operations"),
-
- @SerialName(value = "total_operations")
- TotalOperations("total_operations"),
-
- @SerialName(value = "querysuggestions_total_search_operations")
- QuerysuggestionsTotalSearchOperations("querysuggestions_total_search_operations"),
-
- @SerialName(value = "querysuggestions_total_search_requests")
- QuerysuggestionsTotalSearchRequests("querysuggestions_total_search_requests"),
-
- @SerialName(value = "querysuggestions_total_acl_operations")
- QuerysuggestionsTotalAclOperations("querysuggestions_total_acl_operations"),
-
- @SerialName(value = "querysuggestions_total_indexing_operations")
- QuerysuggestionsTotalIndexingOperations("querysuggestions_total_indexing_operations"),
-
- @SerialName(value = "querysuggestions_total_records_operations")
- QuerysuggestionsTotalRecordsOperations("querysuggestions_total_records_operations"),
-
- @SerialName(value = "querysuggestions_total_synonym_operations")
- QuerysuggestionsTotalSynonymOperations("querysuggestions_total_synonym_operations"),
-
- @SerialName(value = "querysuggestions_total_rules_operations")
- QuerysuggestionsTotalRulesOperations("querysuggestions_total_rules_operations"),
-
- @SerialName(value = "querysuggestions_total_write_operations")
- QuerysuggestionsTotalWriteOperations("querysuggestions_total_write_operations"),
-
- @SerialName(value = "querysuggestions_total_read_operations")
- QuerysuggestionsTotalReadOperations("querysuggestions_total_read_operations"),
-
- @SerialName(value = "querysuggestions_total_operations")
- QuerysuggestionsTotalOperations("querysuggestions_total_operations"),
-
- @SerialName(value = "avg_processing_time")
- AvgProcessingTime("avg_processing_time"),
-
- @SerialName(value = "90p_processing_time")
- NinetyPProcessingTime("90p_processing_time"),
-
- @SerialName(value = "99p_processing_time")
- NinetyNinePProcessingTime("99p_processing_time"),
-
- @SerialName(value = "queries_above_last_ms_processing_time")
- QueriesAboveLastMsProcessingTime("queries_above_last_ms_processing_time"),
-
- @SerialName(value = "records")
- Records("records"),
-
- @SerialName(value = "data_size")
- DataSize("data_size"),
-
- @SerialName(value = "file_size")
- FileSize("file_size"),
-
- @SerialName(value = "max_qps")
- MaxQps("max_qps"),
-
- @SerialName(value = "region_max_qps")
- RegionMaxQps("region_max_qps"),
-
- @SerialName(value = "total_max_qps")
- TotalMaxQps("total_max_qps"),
-
- @SerialName(value = "used_search_capacity")
- UsedSearchCapacity("used_search_capacity"),
-
- @SerialName(value = "avg_used_search_capacity")
- AvgUsedSearchCapacity("avg_used_search_capacity"),
-
- @SerialName(value = "region_used_search_capacity")
- RegionUsedSearchCapacity("region_used_search_capacity"),
-
- @SerialName(value = "region_avg_used_search_capacity")
- RegionAvgUsedSearchCapacity("region_avg_used_search_capacity"),
-
- @SerialName(value = "total_used_search_capacity")
- TotalUsedSearchCapacity("total_used_search_capacity"),
-
- @SerialName(value = "total_avg_used_search_capacity")
- TotalAvgUsedSearchCapacity("total_avg_used_search_capacity"),
-
- @SerialName(value = "degraded_queries_ssd_used_queries_impacted")
- DegradedQueriesSsdUsedQueriesImpacted("degraded_queries_ssd_used_queries_impacted"),
-
- @SerialName(value = "degraded_queries_ssd_used_seconds_impacted")
- DegradedQueriesSsdUsedSecondsImpacted("degraded_queries_ssd_used_seconds_impacted"),
-
- @SerialName(value = "degraded_queries_max_capacity_queries_impacted")
- DegradedQueriesMaxCapacityQueriesImpacted("degraded_queries_max_capacity_queries_impacted"),
-
- @SerialName(value = "degraded_queries_max_capacity_seconds_impacted")
- DegradedQueriesMaxCapacitySecondsImpacted("degraded_queries_max_capacity_seconds_impacted");
-
- override fun toString(): kotlin.String = value
-}
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticEntry.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticEntry.kt
deleted file mode 100644
index 55e11d1e66..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticEntry.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import kotlinx.serialization.*
-import kotlinx.serialization.json.*
-
-/**
- * StatisticEntry
- *
- * @param t Timestamp, measured in milliseconds since the Unix epoch.
- * @param v
- */
-@Serializable
-public data class StatisticEntry(
-
- /** Timestamp, measured in milliseconds since the Unix epoch. */
- @SerialName(value = "t") val t: Int? = null,
-
- @SerialName(value = "v") val v: StatisticValue? = null,
-)
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticValue.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticValue.kt
deleted file mode 100644
index 4c80dc9e89..0000000000
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticValue.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-/** 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. */
-package com.algolia.client.model.usage
-
-import com.algolia.client.exception.AlgoliaClientException
-import com.algolia.client.extensions.internal.*
-import kotlinx.serialization.*
-import kotlinx.serialization.builtins.*
-import kotlinx.serialization.descriptors.*
-import kotlinx.serialization.encoding.*
-import kotlinx.serialization.json.*
-import kotlin.jvm.JvmInline
-
-/**
- * StatisticValue
- *
- * Implementations:
- * - [Int] - *[StatisticValue.of]*
- * - [Map] - *[StatisticValue.of]*
- */
-@Serializable(StatisticValueSerializer::class)
-public sealed interface StatisticValue {
- @Serializable
- @JvmInline
- public value class IntValue(public val value: Int) : StatisticValue
-
- @Serializable
- @JvmInline
- public value class MapOfkotlinStringIntValue(public val value: Map) : StatisticValue
-
- public companion object {
-
- public fun of(value: Int): StatisticValue {
- return IntValue(value)
- }
- public fun of(value: Map): StatisticValue {
- return MapOfkotlinStringIntValue(value)
- }
- }
-}
-
-internal class StatisticValueSerializer : JsonContentPolymorphicSerializer(StatisticValue::class) {
- override fun selectDeserializer(element: JsonElement): DeserializationStrategy {
- return when {
- element.isInt -> StatisticValue.IntValue.serializer()
- element is JsonObject -> StatisticValue.MapOfkotlinStringIntValue.serializer()
- else -> throw AlgoliaClientException("Failed to deserialize json element: $element")
- }
- }
-}
diff --git a/clients/algoliasearch-client-php/lib/Api/UsageClient.php b/clients/algoliasearch-client-php/lib/Api/UsageClient.php
deleted file mode 100644
index ed03352a54..0000000000
--- a/clients/algoliasearch-client-php/lib/Api/UsageClient.php
+++ /dev/null
@@ -1,423 +0,0 @@
-config = $config;
- $this->api = $apiWrapper;
- }
-
- /**
- * Instantiate the client with basic credentials.
- *
- * @param string $appId Application ID
- * @param string $apiKey Algolia API Key
- */
- public static function create($appId = null, $apiKey = null)
- {
- return static::createWithConfig(UsageConfig::create($appId, $apiKey));
- }
-
- /**
- * Instantiate the client with configuration.
- *
- * @param UsageConfig $config Configuration
- */
- public static function createWithConfig(UsageConfig $config)
- {
- $config = clone $config;
-
- $apiWrapper = new ApiWrapper(
- Algolia::getHttpClient(),
- $config,
- self::getClusterHosts($config)
- );
-
- return new static($apiWrapper, $config);
- }
-
- /**
- * Gets the cluster hosts depending on the config.
- *
- * @return ClusterHosts
- */
- public static function getClusterHosts(UsageConfig $config)
- {
- if ($hosts = $config->getHosts()) {
- // If a list of hosts was passed, we ignore the cache
- $clusterHosts = ClusterHosts::create($hosts);
- } else {
- $clusterHosts = ClusterHosts::create([
- 'usage.algolia.com',
- ]);
- }
-
- return $clusterHosts;
- }
-
- /**
- * @return UsageConfig
- */
- public function getClientConfig()
- {
- return $this->config;
- }
-
- /**
- * Stub method setting a new API key to authenticate requests.
- *
- * @param string $apiKey
- */
- public function setClientApiKey($apiKey)
- {
- $this->config->setClientApiKey($apiKey);
- }
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param string $path Path of the endpoint, anything after \"/1\" must be specified. (required)
- * @param array $parameters Query parameters to apply to the current query. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return array|object
- */
- public function customDelete($path, $parameters = null, $requestOptions = [])
- {
- // verify the required parameter 'path' is set
- if (!isset($path)) {
- throw new \InvalidArgumentException(
- 'Parameter `path` is required when calling `customDelete`.'
- );
- }
-
- $resourcePath = '/{path}';
- $queryParameters = [];
- $headers = [];
- $httpBody = null;
-
- if (null !== $parameters) {
- $queryParameters = $parameters;
- }
-
- // path params
- if (null !== $path) {
- $resourcePath = str_replace(
- '{path}',
- $path,
- $resourcePath
- );
- }
-
- return $this->sendRequest('DELETE', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param string $path Path of the endpoint, anything after \"/1\" must be specified. (required)
- * @param array $parameters Query parameters to apply to the current query. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return array|object
- */
- public function customGet($path, $parameters = null, $requestOptions = [])
- {
- // verify the required parameter 'path' is set
- if (!isset($path)) {
- throw new \InvalidArgumentException(
- 'Parameter `path` is required when calling `customGet`.'
- );
- }
-
- $resourcePath = '/{path}';
- $queryParameters = [];
- $headers = [];
- $httpBody = null;
-
- if (null !== $parameters) {
- $queryParameters = $parameters;
- }
-
- // path params
- if (null !== $path) {
- $resourcePath = str_replace(
- '{path}',
- $path,
- $resourcePath
- );
- }
-
- return $this->sendRequest('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param string $path Path of the endpoint, anything after \"/1\" must be specified. (required)
- * @param array $parameters Query parameters to apply to the current query. (optional)
- * @param array $body Parameters to send with the custom request. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return array|object
- */
- public function customPost($path, $parameters = null, $body = null, $requestOptions = [])
- {
- // verify the required parameter 'path' is set
- if (!isset($path)) {
- throw new \InvalidArgumentException(
- 'Parameter `path` is required when calling `customPost`.'
- );
- }
-
- $resourcePath = '/{path}';
- $queryParameters = [];
- $headers = [];
- $httpBody = isset($body) ? $body : [];
-
- if (null !== $parameters) {
- $queryParameters = $parameters;
- }
-
- // path params
- if (null !== $path) {
- $resourcePath = str_replace(
- '{path}',
- $path,
- $resourcePath
- );
- }
-
- return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- /**
- * This method allow you to send requests to the Algolia REST API.
- *
- * @param string $path Path of the endpoint, anything after \"/1\" must be specified. (required)
- * @param array $parameters Query parameters to apply to the current query. (optional)
- * @param array $body Parameters to send with the custom request. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return array|object
- */
- public function customPut($path, $parameters = null, $body = null, $requestOptions = [])
- {
- // verify the required parameter 'path' is set
- if (!isset($path)) {
- throw new \InvalidArgumentException(
- 'Parameter `path` is required when calling `customPut`.'
- );
- }
-
- $resourcePath = '/{path}';
- $queryParameters = [];
- $headers = [];
- $httpBody = isset($body) ? $body : [];
-
- if (null !== $parameters) {
- $queryParameters = $parameters;
- }
-
- // path params
- if (null !== $path) {
- $resourcePath = str_replace(
- '{path}',
- $path,
- $resourcePath
- );
- }
-
- return $this->sendRequest('PUT', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- /**
- * Retrieves the selected usage statistics for one index.
- *
- * @param array $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)
- * @param string $indexName Name of the index on which to perform the operation. (required)
- * @param string $startDate Start date of the period to analyze, in RFC 3339 format. (required)
- * @param string $endDate End date of the period to analyze, in RFC 3339 format. (required)
- * @param array $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. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return \Algolia\AlgoliaSearch\Model\Usage\IndexUsage|array
- */
- public function getIndexUsage($statistic, $indexName, $startDate, $endDate, $granularity = null, $requestOptions = [])
- {
- // verify the required parameter 'statistic' is set
- if (!isset($statistic)) {
- throw new \InvalidArgumentException(
- 'Parameter `statistic` is required when calling `getIndexUsage`.'
- );
- }
- // verify the required parameter 'indexName' is set
- if (!isset($indexName)) {
- throw new \InvalidArgumentException(
- 'Parameter `indexName` is required when calling `getIndexUsage`.'
- );
- }
- // verify the required parameter 'startDate' is set
- if (!isset($startDate)) {
- throw new \InvalidArgumentException(
- 'Parameter `startDate` is required when calling `getIndexUsage`.'
- );
- }
- // verify the required parameter 'endDate' is set
- if (!isset($endDate)) {
- throw new \InvalidArgumentException(
- 'Parameter `endDate` is required when calling `getIndexUsage`.'
- );
- }
-
- $resourcePath = '/1/usage/{statistic}/{indexName}';
- $queryParameters = [];
- $headers = [];
- $httpBody = null;
-
- if (null !== $startDate) {
- $queryParameters['startDate'] = $startDate;
- }
-
- if (null !== $endDate) {
- $queryParameters['endDate'] = $endDate;
- }
-
- if (null !== $granularity) {
- $queryParameters['granularity'] = $granularity;
- }
-
- // path params
- if (null !== $statistic) {
- $resourcePath = str_replace(
- '{statistic}',
- ObjectSerializer::toPathValue($statistic),
- $resourcePath
- );
- }
-
- // path params
- if (null !== $indexName) {
- $resourcePath = str_replace(
- '{indexName}',
- ObjectSerializer::toPathValue($indexName),
- $resourcePath
- );
- }
-
- return $this->sendRequest('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- /**
- * Retrieves usage statistics evaluated over a specified period.
- *
- * @param array $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)
- * @param string $startDate Start date of the period to analyze, in RFC 3339 format. (required)
- * @param string $endDate End date of the period to analyze, in RFC 3339 format. (required)
- * @param array $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. (optional)
- * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
- *
- * @return \Algolia\AlgoliaSearch\Model\Usage\IndexUsage|array
- */
- public function getUsage($statistic, $startDate, $endDate, $granularity = null, $requestOptions = [])
- {
- // verify the required parameter 'statistic' is set
- if (!isset($statistic)) {
- throw new \InvalidArgumentException(
- 'Parameter `statistic` is required when calling `getUsage`.'
- );
- }
- // verify the required parameter 'startDate' is set
- if (!isset($startDate)) {
- throw new \InvalidArgumentException(
- 'Parameter `startDate` is required when calling `getUsage`.'
- );
- }
- // verify the required parameter 'endDate' is set
- if (!isset($endDate)) {
- throw new \InvalidArgumentException(
- 'Parameter `endDate` is required when calling `getUsage`.'
- );
- }
-
- $resourcePath = '/1/usage/{statistic}';
- $queryParameters = [];
- $headers = [];
- $httpBody = null;
-
- if (null !== $startDate) {
- $queryParameters['startDate'] = $startDate;
- }
-
- if (null !== $endDate) {
- $queryParameters['endDate'] = $endDate;
- }
-
- if (null !== $granularity) {
- $queryParameters['granularity'] = $granularity;
- }
-
- // path params
- if (null !== $statistic) {
- $resourcePath = str_replace(
- '{statistic}',
- ObjectSerializer::toPathValue($statistic),
- $resourcePath
- );
- }
-
- return $this->sendRequest('GET', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
- }
-
- private function sendRequest($method, $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions, $useReadTransporter = false)
- {
- if (!isset($requestOptions['headers'])) {
- $requestOptions['headers'] = [];
- }
- if (!isset($requestOptions['queryParameters'])) {
- $requestOptions['queryParameters'] = [];
- }
-
- $requestOptions['headers'] = array_merge($headers, $requestOptions['headers']);
- $requestOptions['queryParameters'] = array_merge($queryParameters, $requestOptions['queryParameters']);
- $query = Query::build($requestOptions['queryParameters']);
-
- return $this->api->sendRequest(
- $method,
- $resourcePath.($query ? "?{$query}" : ''),
- $httpBody,
- $requestOptions,
- $useReadTransporter
- );
- }
-}
diff --git a/clients/algoliasearch-client-python/algoliasearch/usage/__init__.py b/clients/algoliasearch-client-python/algoliasearch/usage/__init__.py
deleted file mode 100644
index f117bc97a8..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/client.py b/clients/algoliasearch-client-python/algoliasearch/usage/client.py
deleted file mode 100644
index 5814739231..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/config.py b/clients/algoliasearch-client-python/algoliasearch/usage/config.py
deleted file mode 100644
index e4f2112312..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/__init__.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/__init__.py
deleted file mode 100644
index f117bc97a8..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/error_base.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/error_base.py
deleted file mode 100644
index c06b0dc41c..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/error_item.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/error_item.py
deleted file mode 100644
index a5830d8ec4..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/forbidden_error.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/forbidden_error.py
deleted file mode 100644
index 81981e5907..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/granularity.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/granularity.py
deleted file mode 100644
index 9a87d4e36b..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/index_usage.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/index_usage.py
deleted file mode 100644
index 2822366926..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/invalid_request_error.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/invalid_request_error.py
deleted file mode 100644
index 2f5e9c750f..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic.py
deleted file mode 100644
index 82ae807038..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_entry.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_entry.py
deleted file mode 100644
index d8ef41f678..0000000000
--- a/clients/algoliasearch-client-python/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/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_value.py b/clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_value.py
deleted file mode 100644
index bd40325dc7..0000000000
--- a/clients/algoliasearch-client-python/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
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/api/usage_client.rb b/clients/algoliasearch-client-ruby/lib/algolia/api/usage_client.rb
deleted file mode 100644
index 45b0430ff8..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/api/usage_client.rb
+++ /dev/null
@@ -1,349 +0,0 @@
-# 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.
-
-module Algolia
- class UsageClient
- attr_accessor :api_client
-
- def initialize(config = nil)
- raise "`config` is missing." if config.nil?
- raise "`app_id` is missing." if config.app_id.nil? || config.app_id == ""
- raise "`api_key` is missing." if config.api_key.nil? || config.api_key == ""
-
- @api_client = Algolia::ApiClient.new(config)
- end
-
- def self.create(app_id, api_key, opts = {})
- hosts = []
- hosts << Transport::StatefulHost.new("usage.algolia.com", accept: CallType::READ | CallType::WRITE)
-
- config = Algolia::Configuration.new(app_id, api_key, hosts, "Usage", opts)
- create_with_config(config)
- end
-
- def self.create_with_config(config)
- new(config)
- end
-
- # Helper method to switch the API key used to authenticate the requests.
- #
- # @param api_key [String] the new API key to use.
- # @return [void]
- def set_client_api_key(api_key)
- @api_client.set_client_api_key(api_key)
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @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 [Http::Response] the response
- def custom_delete_with_http_info(path, parameters = nil, request_options = {})
- # verify the required parameter 'path' is set
- if @api_client.config.client_side_validation && path.nil?
- raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
- end
-
- path = "/{path}".sub("{" + "path" + "}", path.to_s)
- query_params = {}
- query_params = query_params.merge(parameters) unless parameters.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body]
-
- new_options = request_options.merge(
- :operation => :"UsageClient.custom_delete",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:DELETE, path, new_options)
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @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 [Object]
- def custom_delete(path, parameters = nil, request_options = {})
- response = custom_delete_with_http_info(path, parameters, request_options)
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @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 [Http::Response] the response
- def custom_get_with_http_info(path, parameters = nil, request_options = {})
- # verify the required parameter 'path' is set
- if @api_client.config.client_side_validation && path.nil?
- raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
- end
-
- path = "/{path}".sub("{" + "path" + "}", path.to_s)
- query_params = {}
- query_params = query_params.merge(parameters) unless parameters.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body]
-
- new_options = request_options.merge(
- :operation => :"UsageClient.custom_get",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:GET, path, new_options)
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @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 [Object]
- def custom_get(path, parameters = nil, request_options = {})
- response = custom_get_with_http_info(path, parameters, request_options)
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @param body [Object] Parameters to send with the custom request.
- # @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 [Http::Response] the response
- def custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {})
- # verify the required parameter 'path' is set
- if @api_client.config.client_side_validation && path.nil?
- raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
- end
-
- path = "/{path}".sub("{" + "path" + "}", path.to_s)
- query_params = {}
- query_params = query_params.merge(parameters) unless parameters.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)
-
- new_options = request_options.merge(
- :operation => :"UsageClient.custom_post",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:POST, path, new_options)
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @param body [Object] Parameters to send with the custom request.
- # @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 [Object]
- def custom_post(path, parameters = nil, body = nil, request_options = {})
- response = custom_post_with_http_info(path, parameters, body, request_options)
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @param body [Object] Parameters to send with the custom request.
- # @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 [Http::Response] the response
- def custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {})
- # verify the required parameter 'path' is set
- if @api_client.config.client_side_validation && path.nil?
- raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
- end
-
- path = "/{path}".sub("{" + "path" + "}", path.to_s)
- query_params = {}
- query_params = query_params.merge(parameters) unless parameters.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)
-
- new_options = request_options.merge(
- :operation => :"UsageClient.custom_put",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:PUT, path, new_options)
- end
-
- # This method allow you to send requests to the Algolia REST API.
-
- # @param path [String] Path of the endpoint, anything after \"/1\" must be specified. (required)
- # @param parameters [Hash] Query parameters to apply to the current query.
- # @param body [Object] Parameters to send with the custom request.
- # @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 [Object]
- def custom_put(path, parameters = nil, body = nil, request_options = {})
- response = custom_put_with_http_info(path, parameters, body, request_options)
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Object")
- end
-
- # Retrieves the selected usage statistics for one index.
-
- # @param statistic [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)
- # @param index_name [String] Name of the index on which to perform the operation. (required)
- # @param start_date [String] Start date of the period to analyze, in RFC 3339 format. (required)
- # @param end_date [String] End date of the period to analyze, in RFC 3339 format. (required)
- # @param granularity [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. (default to 'daily')
- # @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 [Http::Response] the response
- def get_index_usage_with_http_info(
- statistic,
- index_name,
- start_date,
- end_date,
- granularity = nil,
- request_options = {}
- )
- # verify the required parameter 'statistic' is set
- if @api_client.config.client_side_validation && statistic.nil?
- raise ArgumentError, "Parameter `statistic` is required when calling `get_index_usage`."
- end
- # verify the required parameter 'index_name' is set
- if @api_client.config.client_side_validation && index_name.nil?
- raise ArgumentError, "Parameter `index_name` is required when calling `get_index_usage`."
- end
- # verify the required parameter 'start_date' is set
- if @api_client.config.client_side_validation && start_date.nil?
- raise ArgumentError, "Parameter `start_date` is required when calling `get_index_usage`."
- end
- # verify the required parameter 'end_date' is set
- if @api_client.config.client_side_validation && end_date.nil?
- raise ArgumentError, "Parameter `end_date` is required when calling `get_index_usage`."
- end
-
- path = "/1/usage/{statistic}/{indexName}".sub("{" + "statistic" + "}", Transport.encode_uri(statistic.to_s)).sub(
- "{" + "indexName" + "}",
- Transport.encode_uri(index_name.to_s)
- )
- query_params = {}
- query_params[:startDate] = start_date
- query_params[:endDate] = end_date
- query_params[:granularity] = granularity unless granularity.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body]
-
- new_options = request_options.merge(
- :operation => :"UsageClient.get_index_usage",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:GET, path, new_options)
- end
-
- # Retrieves the selected usage statistics for one index.
-
- # @param statistic [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)
- # @param index_name [String] Name of the index on which to perform the operation. (required)
- # @param start_date [String] Start date of the period to analyze, in RFC 3339 format. (required)
- # @param end_date [String] End date of the period to analyze, in RFC 3339 format. (required)
- # @param granularity [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. (default to 'daily')
- # @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 [IndexUsage]
- def get_index_usage(statistic, index_name, start_date, end_date, granularity = nil, request_options = {})
- response = get_index_usage_with_http_info(
- statistic,
- index_name,
- start_date,
- end_date,
- granularity,
- request_options
- )
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Usage::IndexUsage")
- end
-
- # Retrieves usage statistics evaluated over a specified period.
-
- # @param statistic [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)
- # @param start_date [String] Start date of the period to analyze, in RFC 3339 format. (required)
- # @param end_date [String] End date of the period to analyze, in RFC 3339 format. (required)
- # @param granularity [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. (default to 'daily')
- # @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 [Http::Response] the response
- def get_usage_with_http_info(statistic, start_date, end_date, granularity = nil, request_options = {})
- # verify the required parameter 'statistic' is set
- if @api_client.config.client_side_validation && statistic.nil?
- raise ArgumentError, "Parameter `statistic` is required when calling `get_usage`."
- end
- # verify the required parameter 'start_date' is set
- if @api_client.config.client_side_validation && start_date.nil?
- raise ArgumentError, "Parameter `start_date` is required when calling `get_usage`."
- end
- # verify the required parameter 'end_date' is set
- if @api_client.config.client_side_validation && end_date.nil?
- raise ArgumentError, "Parameter `end_date` is required when calling `get_usage`."
- end
-
- path = "/1/usage/{statistic}".sub("{" + "statistic" + "}", Transport.encode_uri(statistic.to_s))
- query_params = {}
- query_params[:startDate] = start_date
- query_params[:endDate] = end_date
- query_params[:granularity] = granularity unless granularity.nil?
- query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
- header_params = {}
- header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
-
- post_body = request_options[:debug_body]
-
- new_options = request_options.merge(
- :operation => :"UsageClient.get_usage",
- :header_params => header_params,
- :query_params => query_params,
- :body => post_body,
- :use_read_transporter => false
- )
-
- @api_client.call_api(:GET, path, new_options)
- end
-
- # Retrieves usage statistics evaluated over a specified period.
-
- # @param statistic [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)
- # @param start_date [String] Start date of the period to analyze, in RFC 3339 format. (required)
- # @param end_date [String] End date of the period to analyze, in RFC 3339 format. (required)
- # @param granularity [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. (default to 'daily')
- # @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 [IndexUsage]
- def get_usage(statistic, start_date, end_date, granularity = nil, request_options = {})
- response = get_usage_with_http_info(statistic, start_date, end_date, granularity, request_options)
- @api_client.deserialize(response.body, request_options[:debug_return_type] || "Usage::IndexUsage")
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_base.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_base.rb
deleted file mode 100644
index 2fa2575b72..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_base.rb
+++ /dev/null
@@ -1,212 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- # Error.
- class ErrorBase
- attr_accessor :message
-
- attr_accessor :additional_properties
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :message => :message
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :message => :"String"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::ErrorBase` initialize method"
- )
- end
-
- if attributes.key?(:message)
- self.message = attributes[:message]
- end
-
- # add extra attribute to additional_properties
- self.additional_properties ||= {}
- self.additional_properties.merge!(attributes.reject { |k, _| self.class.attribute_map.key?(k.to_sym) })
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- message == other.message
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [message].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- # add extra attribute to transformed_hash
- transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- # also add attributes from additional_properties to hash
- self.additional_properties&.each_pair do |k, v|
- hash[k.to_sym] = _to_hash(v)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_item.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_item.rb
deleted file mode 100644
index 9fa51e12fe..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_item.rb
+++ /dev/null
@@ -1,240 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class ErrorItem
- attr_accessor :code
-
- attr_accessor :message
-
- attr_accessor :line
-
- attr_accessor :position
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :code => :code,
- :message => :message,
- :line => :line,
- :position => :position
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :code => :"String",
- :message => :"String",
- :line => :"Integer",
- :position => :"Integer"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::ErrorItem` initialize method"
- )
- end
-
- # check to see if the attribute exists and convert string to symbol for hash key
- attributes = attributes.each_with_object({}) { |(k, v), h|
- if (!self.class.attribute_map.key?(k.to_sym))
- raise(
- ArgumentError,
- "`#{k}` is not a valid attribute in `Algolia::ErrorItem`. Please check the name to make sure it's valid. List of attributes: " +
- self.class.attribute_map.keys.inspect
- )
- end
-
- h[k.to_sym] = v
- }
-
- if attributes.key?(:code)
- self.code = attributes[:code]
- end
-
- if attributes.key?(:message)
- self.message = attributes[:message]
- else
- self.message = nil
- end
-
- if attributes.key?(:line)
- self.line = attributes[:line]
- end
-
- if attributes.key?(:position)
- self.position = attributes[:position]
- end
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- code == other.code &&
- message == other.message &&
- line == other.line &&
- position == other.position
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [code, message, line, position].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/forbidden_error.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/forbidden_error.rb
deleted file mode 100644
index a8c49343c3..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/forbidden_error.rb
+++ /dev/null
@@ -1,231 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class ForbiddenError
- attr_accessor :code
-
- attr_accessor :message
-
- attr_accessor :errors
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :code => :code,
- :message => :message,
- :errors => :errors
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :code => :"String",
- :message => :"String",
- :errors => :"Array"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::ForbiddenError` initialize method"
- )
- end
-
- # check to see if the attribute exists and convert string to symbol for hash key
- attributes = attributes.each_with_object({}) { |(k, v), h|
- if (!self.class.attribute_map.key?(k.to_sym))
- raise(
- ArgumentError,
- "`#{k}` is not a valid attribute in `Algolia::ForbiddenError`. Please check the name to make sure it's valid. List of attributes: " +
- self.class.attribute_map.keys.inspect
- )
- end
-
- h[k.to_sym] = v
- }
-
- if attributes.key?(:code)
- self.code = attributes[:code]
- end
-
- if attributes.key?(:message)
- self.message = attributes[:message]
- end
-
- if attributes.key?(:errors)
- if (value = attributes[:errors]).is_a?(Array)
- self.errors = value
- end
- end
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- code == other.code &&
- message == other.message &&
- errors == other.errors
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [code, message, errors].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/granularity.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/granularity.rb
deleted file mode 100644
index b2e36d8e13..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/granularity.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class Granularity
- HOURLY = "hourly".freeze
- DAILY = "daily".freeze
-
- def self.all_vars
- @all_vars ||= [HOURLY, DAILY].freeze
- end
-
- # Builds the enum from string
- # @param [String] The enum value in the form of the string
- # @return [String] The enum value
- def self.build_from_hash(value)
- new.build_from_hash(value)
- end
-
- # Builds the enum from string
- # @param [String] The enum value in the form of the string
- # @return [String] The enum value
- def build_from_hash(value)
- return value if Granularity.all_vars.include?(value)
- raise "Invalid ENUM value #{value} for class #Granularity"
- end
- end
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/index_usage.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/index_usage.rb
deleted file mode 100644
index 42a994e55c..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/index_usage.rb
+++ /dev/null
@@ -1,213 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class IndexUsage
- attr_accessor :statistics
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :statistics => :statistics
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :statistics => :"Array"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::IndexUsage` initialize method"
- )
- end
-
- # check to see if the attribute exists and convert string to symbol for hash key
- attributes = attributes.each_with_object({}) { |(k, v), h|
- if (!self.class.attribute_map.key?(k.to_sym))
- raise(
- ArgumentError,
- "`#{k}` is not a valid attribute in `Algolia::IndexUsage`. Please check the name to make sure it's valid. List of attributes: " +
- self.class.attribute_map.keys.inspect
- )
- end
-
- h[k.to_sym] = v
- }
-
- if attributes.key?(:statistics)
- if (value = attributes[:statistics]).is_a?(Array)
- self.statistics = value
- end
- end
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- statistics == other.statistics
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [statistics].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/invalid_request_error.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/invalid_request_error.rb
deleted file mode 100644
index 67cfddf305..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/invalid_request_error.rb
+++ /dev/null
@@ -1,231 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class InvalidRequestError
- attr_accessor :code
-
- attr_accessor :message
-
- attr_accessor :errors
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :code => :code,
- :message => :message,
- :errors => :errors
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :code => :"String",
- :message => :"String",
- :errors => :"Array"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::InvalidRequestError` initialize method"
- )
- end
-
- # check to see if the attribute exists and convert string to symbol for hash key
- attributes = attributes.each_with_object({}) { |(k, v), h|
- if (!self.class.attribute_map.key?(k.to_sym))
- raise(
- ArgumentError,
- "`#{k}` is not a valid attribute in `Algolia::InvalidRequestError`. Please check the name to make sure it's valid. List of attributes: " +
- self.class.attribute_map.keys.inspect
- )
- end
-
- h[k.to_sym] = v
- }
-
- if attributes.key?(:code)
- self.code = attributes[:code]
- end
-
- if attributes.key?(:message)
- self.message = attributes[:message]
- end
-
- if attributes.key?(:errors)
- if (value = attributes[:errors]).is_a?(Array)
- self.errors = value
- end
- end
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- code == other.code &&
- message == other.message &&
- errors == other.errors
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [code, message, errors].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic.rb
deleted file mode 100644
index 3d9cd1d79e..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic.rb
+++ /dev/null
@@ -1,199 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class Statistic
- ALL = "*".freeze
- SEARCH_OPERATIONS = "search_operations".freeze
- TOTAL_SEARCH_OPERATIONS = "total_search_operations".freeze
- TOTAL_SEARCH_REQUESTS = "total_search_requests".freeze
- QUERIES_OPERATIONS = "queries_operations".freeze
- MULTI_QUERIES_OPERATIONS = "multi_queries_operations".freeze
- ACL_OPERATIONS = "acl_operations".freeze
- TOTAL_ACL_OPERATIONS = "total_acl_operations".freeze
- GET_API_KEYS_OPERATIONS = "get_api_keys_operations".freeze
- GET_API_KEY_OPERATIONS = "get_api_key_operations".freeze
- ADD_API_KEY_OPERATIONS = "add_api_key_operations".freeze
- UPDATE_API_KEY_OPERATIONS = "update_api_key_operations".freeze
- DELETE_API_KEY_OPERATIONS = "delete_api_key_operations".freeze
- LIST_API_KEY_OPERATIONS = "list_api_key_operations".freeze
- INDEXING_OPERATIONS = "indexing_operations".freeze
- TOTAL_INDEXING_OPERATIONS = "total_indexing_operations".freeze
- BROWSE_OPERATIONS = "browse_operations".freeze
- CLEAR_INDEX_OPERATIONS = "clear_index_operations".freeze
- COPY_MOVE_OPERATIONS = "copy_move_operations".freeze
- DELETE_INDEX_OPERATIONS = "delete_index_operations".freeze
- GET_LOG_OPERATIONS = "get_log_operations".freeze
- GET_SETTINGS_OPERATIONS = "get_settings_operations".freeze
- SET_SETTINGS_OPERATIONS = "set_settings_operations".freeze
- LIST_INDICES_OPERATIONS = "list_indices_operations".freeze
- WAIT_TASK_OPERATIONS = "wait_task_operations".freeze
- RECORD_OPERATIONS = "record_operations".freeze
- TOTAL_RECORDS_OPERATIONS = "total_records_operations".freeze
- ADD_RECORD_OPERATIONS = "add_record_operations".freeze
- BATCH_OPERATIONS = "batch_operations".freeze
- DELETE_BY_QUERY_OPERATIONS = "delete_by_query_operations".freeze
- DELETE_RECORD_OPERATIONS = "delete_record_operations".freeze
- GET_RECORD_OPERATIONS = "get_record_operations".freeze
- PARTIAL_UPDATE_RECORD_OPERATIONS = "partial_update_record_operations".freeze
- UPDATE_RECORD_OPERATIONS = "update_record_operations".freeze
- SYNONYM_OPERATIONS = "synonym_operations".freeze
- TOTAL_SYNONYM_OPERATIONS = "total_synonym_operations".freeze
- BATCH_SYNONYM_OPERATIONS = "batch_synonym_operations".freeze
- CLEAR_SYNONYM_OPERATIONS = "clear_synonym_operations".freeze
- DELETE_SYNONYM_OPERATIONS = "delete_synonym_operations".freeze
- GET_SYNONYM_OPERATIONS = "get_synonym_operations".freeze
- QUERY_SYNONYM_OPERATIONS = "query_synonym_operations".freeze
- UPDATE_SYNONYM_OPERATIONS = "update_synonym_operations".freeze
- RULE_OPERATIONS = "rule_operations".freeze
- TOTAL_RULES_OPERATIONS = "total_rules_operations".freeze
- BATCH_RULES_OPERATIONS = "batch_rules_operations".freeze
- CLEAR_RULES_OPERATIONS = "clear_rules_operations".freeze
- DELETE_RULES_OPERATIONS = "delete_rules_operations".freeze
- GET_RULES_OPERATIONS = "get_rules_operations".freeze
- SAVE_RULES_OPERATIONS = "save_rules_operations".freeze
- SEARCH_RULES_OPERATIONS = "search_rules_operations".freeze
- TOTAL_RECOMMEND_REQUESTS = "total_recommend_requests".freeze
- TOTAL_WRITE_OPERATIONS = "total_write_operations".freeze
- TOTAL_READ_OPERATIONS = "total_read_operations".freeze
- TOTAL_OPERATIONS = "total_operations".freeze
- QUERYSUGGESTIONS_TOTAL_SEARCH_OPERATIONS = "querysuggestions_total_search_operations".freeze
- QUERYSUGGESTIONS_TOTAL_SEARCH_REQUESTS = "querysuggestions_total_search_requests".freeze
- QUERYSUGGESTIONS_TOTAL_ACL_OPERATIONS = "querysuggestions_total_acl_operations".freeze
- QUERYSUGGESTIONS_TOTAL_INDEXING_OPERATIONS = "querysuggestions_total_indexing_operations".freeze
- QUERYSUGGESTIONS_TOTAL_RECORDS_OPERATIONS = "querysuggestions_total_records_operations".freeze
- QUERYSUGGESTIONS_TOTAL_SYNONYM_OPERATIONS = "querysuggestions_total_synonym_operations".freeze
- QUERYSUGGESTIONS_TOTAL_RULES_OPERATIONS = "querysuggestions_total_rules_operations".freeze
- QUERYSUGGESTIONS_TOTAL_WRITE_OPERATIONS = "querysuggestions_total_write_operations".freeze
- QUERYSUGGESTIONS_TOTAL_READ_OPERATIONS = "querysuggestions_total_read_operations".freeze
- QUERYSUGGESTIONS_TOTAL_OPERATIONS = "querysuggestions_total_operations".freeze
- AVG_PROCESSING_TIME = "avg_processing_time".freeze
- N90P_PROCESSING_TIME = "90p_processing_time".freeze
- N99P_PROCESSING_TIME = "99p_processing_time".freeze
- QUERIES_ABOVE_LAST_MS_PROCESSING_TIME = "queries_above_last_ms_processing_time".freeze
- RECORDS = "records".freeze
- DATA_SIZE = "data_size".freeze
- FILE_SIZE = "file_size".freeze
- MAX_QPS = "max_qps".freeze
- REGION_MAX_QPS = "region_max_qps".freeze
- TOTAL_MAX_QPS = "total_max_qps".freeze
- USED_SEARCH_CAPACITY = "used_search_capacity".freeze
- AVG_USED_SEARCH_CAPACITY = "avg_used_search_capacity".freeze
- REGION_USED_SEARCH_CAPACITY = "region_used_search_capacity".freeze
- REGION_AVG_USED_SEARCH_CAPACITY = "region_avg_used_search_capacity".freeze
- TOTAL_USED_SEARCH_CAPACITY = "total_used_search_capacity".freeze
- TOTAL_AVG_USED_SEARCH_CAPACITY = "total_avg_used_search_capacity".freeze
- DEGRADED_QUERIES_SSD_USED_QUERIES_IMPACTED = "degraded_queries_ssd_used_queries_impacted".freeze
- DEGRADED_QUERIES_SSD_USED_SECONDS_IMPACTED = "degraded_queries_ssd_used_seconds_impacted".freeze
- DEGRADED_QUERIES_MAX_CAPACITY_QUERIES_IMPACTED = "degraded_queries_max_capacity_queries_impacted".freeze
- DEGRADED_QUERIES_MAX_CAPACITY_SECONDS_IMPACTED = "degraded_queries_max_capacity_seconds_impacted".freeze
-
- def self.all_vars
- @all_vars ||= [
- ALL,
- SEARCH_OPERATIONS,
- TOTAL_SEARCH_OPERATIONS,
- TOTAL_SEARCH_REQUESTS,
- QUERIES_OPERATIONS,
- MULTI_QUERIES_OPERATIONS,
- ACL_OPERATIONS,
- TOTAL_ACL_OPERATIONS,
- GET_API_KEYS_OPERATIONS,
- GET_API_KEY_OPERATIONS,
- ADD_API_KEY_OPERATIONS,
- UPDATE_API_KEY_OPERATIONS,
- DELETE_API_KEY_OPERATIONS,
- LIST_API_KEY_OPERATIONS,
- INDEXING_OPERATIONS,
- TOTAL_INDEXING_OPERATIONS,
- BROWSE_OPERATIONS,
- CLEAR_INDEX_OPERATIONS,
- COPY_MOVE_OPERATIONS,
- DELETE_INDEX_OPERATIONS,
- GET_LOG_OPERATIONS,
- GET_SETTINGS_OPERATIONS,
- SET_SETTINGS_OPERATIONS,
- LIST_INDICES_OPERATIONS,
- WAIT_TASK_OPERATIONS,
- RECORD_OPERATIONS,
- TOTAL_RECORDS_OPERATIONS,
- ADD_RECORD_OPERATIONS,
- BATCH_OPERATIONS,
- DELETE_BY_QUERY_OPERATIONS,
- DELETE_RECORD_OPERATIONS,
- GET_RECORD_OPERATIONS,
- PARTIAL_UPDATE_RECORD_OPERATIONS,
- UPDATE_RECORD_OPERATIONS,
- SYNONYM_OPERATIONS,
- TOTAL_SYNONYM_OPERATIONS,
- BATCH_SYNONYM_OPERATIONS,
- CLEAR_SYNONYM_OPERATIONS,
- DELETE_SYNONYM_OPERATIONS,
- GET_SYNONYM_OPERATIONS,
- QUERY_SYNONYM_OPERATIONS,
- UPDATE_SYNONYM_OPERATIONS,
- RULE_OPERATIONS,
- TOTAL_RULES_OPERATIONS,
- BATCH_RULES_OPERATIONS,
- CLEAR_RULES_OPERATIONS,
- DELETE_RULES_OPERATIONS,
- GET_RULES_OPERATIONS,
- SAVE_RULES_OPERATIONS,
- SEARCH_RULES_OPERATIONS,
- TOTAL_RECOMMEND_REQUESTS,
- TOTAL_WRITE_OPERATIONS,
- TOTAL_READ_OPERATIONS,
- TOTAL_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_SEARCH_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_SEARCH_REQUESTS,
- QUERYSUGGESTIONS_TOTAL_ACL_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_INDEXING_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_RECORDS_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_SYNONYM_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_RULES_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_WRITE_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_READ_OPERATIONS,
- QUERYSUGGESTIONS_TOTAL_OPERATIONS,
- AVG_PROCESSING_TIME,
- N90P_PROCESSING_TIME,
- N99P_PROCESSING_TIME,
- QUERIES_ABOVE_LAST_MS_PROCESSING_TIME,
- RECORDS,
- DATA_SIZE,
- FILE_SIZE,
- MAX_QPS,
- REGION_MAX_QPS,
- TOTAL_MAX_QPS,
- USED_SEARCH_CAPACITY,
- AVG_USED_SEARCH_CAPACITY,
- REGION_USED_SEARCH_CAPACITY,
- REGION_AVG_USED_SEARCH_CAPACITY,
- TOTAL_USED_SEARCH_CAPACITY,
- TOTAL_AVG_USED_SEARCH_CAPACITY,
- DEGRADED_QUERIES_SSD_USED_QUERIES_IMPACTED,
- DEGRADED_QUERIES_SSD_USED_SECONDS_IMPACTED,
- DEGRADED_QUERIES_MAX_CAPACITY_QUERIES_IMPACTED,
- DEGRADED_QUERIES_MAX_CAPACITY_SECONDS_IMPACTED
- ].freeze
- end
-
- # Builds the enum from string
- # @param [String] The enum value in the form of the string
- # @return [String] The enum value
- def self.build_from_hash(value)
- new.build_from_hash(value)
- end
-
- # Builds the enum from string
- # @param [String] The enum value in the form of the string
- # @return [String] The enum value
- def build_from_hash(value)
- return value if Statistic.all_vars.include?(value)
- raise "Invalid ENUM value #{value} for class #Statistic"
- end
- end
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_entry.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_entry.rb
deleted file mode 100644
index 7934028d96..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_entry.rb
+++ /dev/null
@@ -1,221 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- class StatisticEntry
- # Timestamp, measured in milliseconds since the Unix epoch.
- attr_accessor :t
-
- attr_accessor :v
-
- # Attribute mapping from ruby-style variable name to JSON key.
- def self.attribute_map
- {
- :t => :t,
- :v => :v
- }
- end
-
- # Returns all the JSON keys this model knows about
- def self.acceptable_attributes
- attribute_map.values
- end
-
- # Attribute type mapping.
- def self.types_mapping
- {
- :t => :"Integer",
- :v => :"StatisticValue"
- }
- end
-
- # List of attributes with nullable: true
- def self.openapi_nullable
- Set.new(
- []
- )
- end
-
- # Initializes the object
- # @param [Hash] attributes Model attributes in the form of hash
- def initialize(attributes = {})
- if (!attributes.is_a?(Hash))
- raise(
- ArgumentError,
- "The input argument (attributes) must be a hash in `Algolia::StatisticEntry` initialize method"
- )
- end
-
- # check to see if the attribute exists and convert string to symbol for hash key
- attributes = attributes.each_with_object({}) { |(k, v), h|
- if (!self.class.attribute_map.key?(k.to_sym))
- raise(
- ArgumentError,
- "`#{k}` is not a valid attribute in `Algolia::StatisticEntry`. Please check the name to make sure it's valid. List of attributes: " +
- self.class.attribute_map.keys.inspect
- )
- end
-
- h[k.to_sym] = v
- }
-
- if attributes.key?(:t)
- self.t = attributes[:t]
- end
-
- if attributes.key?(:v)
- self.v = attributes[:v]
- end
- end
-
- # Checks equality by comparing each attribute.
- # @param [Object] Object to be compared
- def ==(other)
- return true if self.equal?(other)
- self.class == other.class &&
- t == other.t &&
- v == other.v
- end
-
- # @see the `==` method
- # @param [Object] Object to be compared
- def eql?(other)
- self == other
- end
-
- # Calculates hash code according to all attributes.
- # @return [Integer] Hash code
- def hash
- [t, v].hash
- end
-
- # Builds the object from hash
- # @param [Hash] attributes Model attributes in the form of hash
- # @return [Object] Returns the model itself
- def self.build_from_hash(attributes)
- return nil unless attributes.is_a?(Hash)
- attributes = attributes.transform_keys(&:to_sym)
- transformed_hash = {}
- types_mapping.each_pair do |key, type|
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = nil
- elsif type =~ /\AArray<(.*)>/i
- # check to ensure the input is an array given that the attribute
- # is documented as an array but the input is not
- if attributes[attribute_map[key]].is_a?(Array)
- transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v|
- _deserialize(::Regexp.last_match(1), v)
- }
- end
- elsif !attributes[attribute_map[key]].nil?
- transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
- end
- end
-
- new(transformed_hash)
- end
-
- # Deserializes the data based on type
- # @param string type Data type
- # @param string value Value to be deserialized
- # @return [Object] Deserialized data
- def self._deserialize(type, value)
- case type.to_sym
- when :Time
- Time.parse(value)
- when :Date
- Date.parse(value)
- when :String
- value.to_s
- when :Integer
- value.to_i
- when :Float
- value.to_f
- when :Boolean
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
- true
- else
- false
- end
-
- when :Object
- # generic object (usually a Hash), return directly
- value
- when /\AArray<(?.+)>\z/
- inner_type = Regexp.last_match[:inner_type]
- value.map { |v| _deserialize(inner_type, v) }
- when /\AHash<(?.+?), (?.+)>\z/
- k_type = Regexp.last_match[:k_type]
- v_type = Regexp.last_match[:v_type]
- {}.tap do |hash|
- value.each do |k, v|
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
- end
- end
- # model
- else
- # models (e.g. Pet) or oneOf
- klass = Algolia::Usage.const_get(type)
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass
- .build_from_hash(value)
- end
- end
-
- # Returns the string representation of the object
- # @return [String] String presentation of the object
- def to_s
- to_hash.to_s
- end
-
- # to_body is an alias to to_hash (backward compatibility)
- # @return [Hash] Returns the object in the form of hash
- def to_body
- to_hash
- end
-
- def to_json(*_args)
- to_hash.to_json
- end
-
- # Returns the object in the form of hash
- # @return [Hash] Returns the object in the form of hash
- def to_hash
- hash = {}
- self.class.attribute_map.each_pair do |attr, param|
- value = send(attr)
- if value.nil?
- is_nullable = self.class.openapi_nullable.include?(attr)
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
- end
-
- hash[param] = _to_hash(value)
- end
-
- hash
- end
-
- # Outputs non-array value in the form of hash
- # For object, use to_hash. Otherwise, just return the value
- # @param [Object] value Any valid value
- # @return [Hash] Returns the value in the form of hash
- def _to_hash(value)
- if value.is_a?(Array)
- value.compact.map { |v| _to_hash(v) }
- elsif value.is_a?(Hash)
- {}.tap do |hash|
- value.each { |k, v| hash[k] = _to_hash(v) }
- end
- elsif value.respond_to?(:to_hash)
- value.to_hash
- else
- value
- end
- end
-
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_value.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_value.rb
deleted file mode 100644
index df93cc429d..0000000000
--- a/clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_value.rb
+++ /dev/null
@@ -1,108 +0,0 @@
-# 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.
-
-require "date"
-require "time"
-
-module Algolia
- module Usage
- module StatisticValue
- class << self
- # List of class defined in oneOf (OpenAPI v3)
- def openapi_one_of
- [
- :"Hash",
- :"Integer"
- ]
- end
-
- # Builds the object
- # @param [Mixed] Data to be matched against the list of oneOf items
- # @return [Object] Returns the model or the data itself
- def build(data)
- # Go through the list of oneOf items and attempt to identify the appropriate one.
- # Note:
- # - We do not attempt to check whether exactly one item matches.
- # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
- # due to the way the deserialization is made in the base_object template (it just casts without verifying).
- # - TODO: scalar values are de facto behaving as if they were nullable.
- # - TODO: logging when debugging is set.
- openapi_one_of.each do |klass|
- begin
- # "nullable: true"
- next if klass == :AnyType
- typed_data = find_and_cast_into_type(klass, data)
- return typed_data if typed_data
- # rescue all errors so we keep iterating even if the current item lookup raises
- rescue
- end
- end
-
- openapi_one_of.include?(:AnyType) ? data : nil
- end
-
- private
-
- SchemaMismatchError = Class.new(StandardError)
-
- # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
- def find_and_cast_into_type(klass, data)
- return if data.nil?
-
- case klass.to_s
- when "Boolean"
- return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
- when "Float"
- return data if data.instance_of?(Float)
- when "Integer"
- return data if data.instance_of?(Integer)
- when "Time"
- return Time.parse(data)
- when "Date"
- return Date.parse(data)
- when "String"
- return data if data.instance_of?(String)
- # "type: object"
- when "Object"
- return data if data.instance_of?(Hash)
- # "type: array"
- when /\AArray<(?.+)>\z/
- if data.instance_of?(Array)
- sub_type = Regexp.last_match[:sub_type]
- return data.map { |item| find_and_cast_into_type(sub_type, item) }
- end
- # "type: object" with "additionalProperties: { ... }"
- when /\AHash.+)>\z/
- if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
- sub_type = Regexp.last_match[:sub_type]
- return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
- end
- # model
- else
- const = Algolia::Usage.const_get(klass)
- if const
- if const.respond_to?(:openapi_one_of)
- # nested oneOf model
- model = const.build(data)
- elsif const.respond_to?(:acceptable_attributes)
- # raise if data contains keys that are not known to the model
- raise unless (data.keys - const.acceptable_attributes).empty?
- model = const.build_from_hash(data)
- else
- # maybe it's an enum
- model = const.build_from_hash(data)
- end
-
- return model if model
- end
- end
-
- # if no match by now, raise
- raise
- rescue
- raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
- end
- end
- end
-
- end
-end
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorBase.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorBase.scala
deleted file mode 100644
index 84fa1583bb..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorBase.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-import org.json4s.MonadicJValue.jvalueToMonadic
-import org.json4s.{Extraction, Formats, JField, JObject, JValue, Serializer, TypeInfo}
-
-/** Error.
- */
-case class ErrorBase(
- message: Option[String] = scala.None,
- additionalProperties: Option[List[JField]] = None
-)
-
-class ErrorBaseSerializer extends Serializer[ErrorBase] {
-
- override def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), ErrorBase] = {
- case (TypeInfo(clazz, _), json) if clazz == classOf[ErrorBase] =>
- json match {
- case jobject: JObject =>
- val formats = format - this
- val mf = manifest[ErrorBase]
- val obj = Extraction.extract[ErrorBase](jobject)(formats, mf)
-
- val fields = Set("message")
- val additionalProperties = jobject removeField {
- case (name, _) if fields.contains(name) => true
- case _ => false
- }
- additionalProperties.values match {
- case JObject(fieldsList) => obj copy (additionalProperties = Some(fieldsList))
- case _ => obj
- }
- case _ => throw new IllegalArgumentException(s"Can't deserialize $json as ErrorBase")
- }
- }
-
- override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = { case value: ErrorBase =>
- val formats = format - this // remove current serializer from formats to avoid stackoverflow
- value.additionalProperties match {
- case Some(fields) => Extraction.decompose(value.copy(additionalProperties = None))(formats) merge JObject(fields)
- case None => Extraction.decompose(value)(formats)
- }
- }
-}
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorItem.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorItem.scala
deleted file mode 100644
index 756d392e3f..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorItem.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** ErrorItem
- */
-case class ErrorItem(
- code: Option[String] = scala.None,
- message: String,
- line: Option[Int] = scala.None,
- position: Option[Int] = scala.None
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Forbidden.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Forbidden.scala
deleted file mode 100644
index e5cb39dca2..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Forbidden.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** Forbidden
- */
-case class Forbidden(
- error: ForbiddenError
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ForbiddenError.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ForbiddenError.scala
deleted file mode 100644
index a559c0a2b3..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ForbiddenError.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** ForbiddenError
- */
-case class ForbiddenError(
- code: Option[String] = scala.None,
- message: Option[String] = scala.None,
- errors: Option[Seq[ErrorItem]] = scala.None
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Granularity.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Granularity.scala
deleted file mode 100644
index 64e5d9daf2..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Granularity.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-import org.json4s._
-
-sealed trait Granularity
-
-/** Granularity enumeration
- */
-object Granularity {
- case object Hourly extends Granularity {
- override def toString = "hourly"
- }
- case object Daily extends Granularity {
- override def toString = "daily"
- }
- val values: Seq[Granularity] = Seq(Hourly, Daily)
-
- def withName(name: String): Granularity = Granularity.values
- .find(_.toString == name)
- .getOrElse(throw new MappingException(s"Unknown Granularity value: $name"))
-}
-
-class GranularitySerializer
- extends CustomSerializer[Granularity](_ =>
- (
- {
- case JString(value) => Granularity.withName(value)
- case JNull => null
- },
- { case value: Granularity =>
- JString(value.toString)
- }
- )
- )
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/IndexUsage.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/IndexUsage.scala
deleted file mode 100644
index ed6e86d162..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/IndexUsage.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** IndexUsage
- */
-case class IndexUsage(
- statistics: Option[Seq[StatisticEntry]] = scala.None
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequest.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequest.scala
deleted file mode 100644
index 1a11390bcf..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequest.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** InvalidRequest
- */
-case class InvalidRequest(
- error: InvalidRequestError
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequestError.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequestError.scala
deleted file mode 100644
index b908ceb883..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequestError.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** InvalidRequestError
- */
-case class InvalidRequestError(
- code: Option[String] = scala.None,
- message: Option[String] = scala.None,
- errors: Option[Seq[ErrorItem]] = scala.None
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/JsonSupport.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/JsonSupport.scala
deleted file mode 100644
index 808a3ab708..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/JsonSupport.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-import org.json4s._
-
-object JsonSupport {
- private def enumSerializers: Seq[Serializer[_]] = Seq[Serializer[_]]() :+
- new GranularitySerializer() :+
- new StatisticSerializer()
-
- private def oneOfsSerializers: Seq[Serializer[_]] = Seq[Serializer[_]]() :+
- StatisticValueSerializer
-
- private def classMapSerializers: Seq[Serializer[_]] = Seq[Serializer[_]]() :+
- new ErrorBaseSerializer()
-
- implicit val format: Formats = DefaultFormats ++ enumSerializers ++ oneOfsSerializers ++ classMapSerializers
- implicit val serialization: org.json4s.Serialization = org.json4s.native.Serialization
-}
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Statistic.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Statistic.scala
deleted file mode 100644
index 32cbabd45d..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Statistic.scala
+++ /dev/null
@@ -1,380 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-import org.json4s._
-
-sealed trait Statistic
-
-/** Statistic enumeration
- */
-object Statistic {
- case object Star extends Statistic {
- override def toString = "*"
- }
- case object SearchOperations extends Statistic {
- override def toString = "search_operations"
- }
- case object TotalSearchOperations extends Statistic {
- override def toString = "total_search_operations"
- }
- case object TotalSearchRequests extends Statistic {
- override def toString = "total_search_requests"
- }
- case object QueriesOperations extends Statistic {
- override def toString = "queries_operations"
- }
- case object MultiQueriesOperations extends Statistic {
- override def toString = "multi_queries_operations"
- }
- case object AclOperations extends Statistic {
- override def toString = "acl_operations"
- }
- case object TotalAclOperations extends Statistic {
- override def toString = "total_acl_operations"
- }
- case object GetApiKeysOperations extends Statistic {
- override def toString = "get_api_keys_operations"
- }
- case object GetApiKeyOperations extends Statistic {
- override def toString = "get_api_key_operations"
- }
- case object AddApiKeyOperations extends Statistic {
- override def toString = "add_api_key_operations"
- }
- case object UpdateApiKeyOperations extends Statistic {
- override def toString = "update_api_key_operations"
- }
- case object DeleteApiKeyOperations extends Statistic {
- override def toString = "delete_api_key_operations"
- }
- case object ListApiKeyOperations extends Statistic {
- override def toString = "list_api_key_operations"
- }
- case object IndexingOperations extends Statistic {
- override def toString = "indexing_operations"
- }
- case object TotalIndexingOperations extends Statistic {
- override def toString = "total_indexing_operations"
- }
- case object BrowseOperations extends Statistic {
- override def toString = "browse_operations"
- }
- case object ClearIndexOperations extends Statistic {
- override def toString = "clear_index_operations"
- }
- case object CopyMoveOperations extends Statistic {
- override def toString = "copy_move_operations"
- }
- case object DeleteIndexOperations extends Statistic {
- override def toString = "delete_index_operations"
- }
- case object GetLogOperations extends Statistic {
- override def toString = "get_log_operations"
- }
- case object GetSettingsOperations extends Statistic {
- override def toString = "get_settings_operations"
- }
- case object SetSettingsOperations extends Statistic {
- override def toString = "set_settings_operations"
- }
- case object ListIndicesOperations extends Statistic {
- override def toString = "list_indices_operations"
- }
- case object WaitTaskOperations extends Statistic {
- override def toString = "wait_task_operations"
- }
- case object RecordOperations extends Statistic {
- override def toString = "record_operations"
- }
- case object TotalRecordsOperations extends Statistic {
- override def toString = "total_records_operations"
- }
- case object AddRecordOperations extends Statistic {
- override def toString = "add_record_operations"
- }
- case object BatchOperations extends Statistic {
- override def toString = "batch_operations"
- }
- case object DeleteByQueryOperations extends Statistic {
- override def toString = "delete_by_query_operations"
- }
- case object DeleteRecordOperations extends Statistic {
- override def toString = "delete_record_operations"
- }
- case object GetRecordOperations extends Statistic {
- override def toString = "get_record_operations"
- }
- case object PartialUpdateRecordOperations extends Statistic {
- override def toString = "partial_update_record_operations"
- }
- case object UpdateRecordOperations extends Statistic {
- override def toString = "update_record_operations"
- }
- case object SynonymOperations extends Statistic {
- override def toString = "synonym_operations"
- }
- case object TotalSynonymOperations extends Statistic {
- override def toString = "total_synonym_operations"
- }
- case object BatchSynonymOperations extends Statistic {
- override def toString = "batch_synonym_operations"
- }
- case object ClearSynonymOperations extends Statistic {
- override def toString = "clear_synonym_operations"
- }
- case object DeleteSynonymOperations extends Statistic {
- override def toString = "delete_synonym_operations"
- }
- case object GetSynonymOperations extends Statistic {
- override def toString = "get_synonym_operations"
- }
- case object QuerySynonymOperations extends Statistic {
- override def toString = "query_synonym_operations"
- }
- case object UpdateSynonymOperations extends Statistic {
- override def toString = "update_synonym_operations"
- }
- case object RuleOperations extends Statistic {
- override def toString = "rule_operations"
- }
- case object TotalRulesOperations extends Statistic {
- override def toString = "total_rules_operations"
- }
- case object BatchRulesOperations extends Statistic {
- override def toString = "batch_rules_operations"
- }
- case object ClearRulesOperations extends Statistic {
- override def toString = "clear_rules_operations"
- }
- case object DeleteRulesOperations extends Statistic {
- override def toString = "delete_rules_operations"
- }
- case object GetRulesOperations extends Statistic {
- override def toString = "get_rules_operations"
- }
- case object SaveRulesOperations extends Statistic {
- override def toString = "save_rules_operations"
- }
- case object SearchRulesOperations extends Statistic {
- override def toString = "search_rules_operations"
- }
- case object TotalRecommendRequests extends Statistic {
- override def toString = "total_recommend_requests"
- }
- case object TotalWriteOperations extends Statistic {
- override def toString = "total_write_operations"
- }
- case object TotalReadOperations extends Statistic {
- override def toString = "total_read_operations"
- }
- case object TotalOperations extends Statistic {
- override def toString = "total_operations"
- }
- case object QuerysuggestionsTotalSearchOperations extends Statistic {
- override def toString = "querysuggestions_total_search_operations"
- }
- case object QuerysuggestionsTotalSearchRequests extends Statistic {
- override def toString = "querysuggestions_total_search_requests"
- }
- case object QuerysuggestionsTotalAclOperations extends Statistic {
- override def toString = "querysuggestions_total_acl_operations"
- }
- case object QuerysuggestionsTotalIndexingOperations extends Statistic {
- override def toString = "querysuggestions_total_indexing_operations"
- }
- case object QuerysuggestionsTotalRecordsOperations extends Statistic {
- override def toString = "querysuggestions_total_records_operations"
- }
- case object QuerysuggestionsTotalSynonymOperations extends Statistic {
- override def toString = "querysuggestions_total_synonym_operations"
- }
- case object QuerysuggestionsTotalRulesOperations extends Statistic {
- override def toString = "querysuggestions_total_rules_operations"
- }
- case object QuerysuggestionsTotalWriteOperations extends Statistic {
- override def toString = "querysuggestions_total_write_operations"
- }
- case object QuerysuggestionsTotalReadOperations extends Statistic {
- override def toString = "querysuggestions_total_read_operations"
- }
- case object QuerysuggestionsTotalOperations extends Statistic {
- override def toString = "querysuggestions_total_operations"
- }
- case object AvgProcessingTime extends Statistic {
- override def toString = "avg_processing_time"
- }
- case object `90pProcessingTime` extends Statistic {
- override def toString = "90p_processing_time"
- }
- case object `99pProcessingTime` extends Statistic {
- override def toString = "99p_processing_time"
- }
- case object QueriesAboveLastMsProcessingTime extends Statistic {
- override def toString = "queries_above_last_ms_processing_time"
- }
- case object Records extends Statistic {
- override def toString = "records"
- }
- case object DataSize extends Statistic {
- override def toString = "data_size"
- }
- case object FileSize extends Statistic {
- override def toString = "file_size"
- }
- case object MaxQps extends Statistic {
- override def toString = "max_qps"
- }
- case object RegionMaxQps extends Statistic {
- override def toString = "region_max_qps"
- }
- case object TotalMaxQps extends Statistic {
- override def toString = "total_max_qps"
- }
- case object UsedSearchCapacity extends Statistic {
- override def toString = "used_search_capacity"
- }
- case object AvgUsedSearchCapacity extends Statistic {
- override def toString = "avg_used_search_capacity"
- }
- case object RegionUsedSearchCapacity extends Statistic {
- override def toString = "region_used_search_capacity"
- }
- case object RegionAvgUsedSearchCapacity extends Statistic {
- override def toString = "region_avg_used_search_capacity"
- }
- case object TotalUsedSearchCapacity extends Statistic {
- override def toString = "total_used_search_capacity"
- }
- case object TotalAvgUsedSearchCapacity extends Statistic {
- override def toString = "total_avg_used_search_capacity"
- }
- case object DegradedQueriesSsdUsedQueriesImpacted extends Statistic {
- override def toString = "degraded_queries_ssd_used_queries_impacted"
- }
- case object DegradedQueriesSsdUsedSecondsImpacted extends Statistic {
- override def toString = "degraded_queries_ssd_used_seconds_impacted"
- }
- case object DegradedQueriesMaxCapacityQueriesImpacted extends Statistic {
- override def toString = "degraded_queries_max_capacity_queries_impacted"
- }
- case object DegradedQueriesMaxCapacitySecondsImpacted extends Statistic {
- override def toString = "degraded_queries_max_capacity_seconds_impacted"
- }
- val values: Seq[Statistic] = Seq(
- Star,
- SearchOperations,
- TotalSearchOperations,
- TotalSearchRequests,
- QueriesOperations,
- MultiQueriesOperations,
- AclOperations,
- TotalAclOperations,
- GetApiKeysOperations,
- GetApiKeyOperations,
- AddApiKeyOperations,
- UpdateApiKeyOperations,
- DeleteApiKeyOperations,
- ListApiKeyOperations,
- IndexingOperations,
- TotalIndexingOperations,
- BrowseOperations,
- ClearIndexOperations,
- CopyMoveOperations,
- DeleteIndexOperations,
- GetLogOperations,
- GetSettingsOperations,
- SetSettingsOperations,
- ListIndicesOperations,
- WaitTaskOperations,
- RecordOperations,
- TotalRecordsOperations,
- AddRecordOperations,
- BatchOperations,
- DeleteByQueryOperations,
- DeleteRecordOperations,
- GetRecordOperations,
- PartialUpdateRecordOperations,
- UpdateRecordOperations,
- SynonymOperations,
- TotalSynonymOperations,
- BatchSynonymOperations,
- ClearSynonymOperations,
- DeleteSynonymOperations,
- GetSynonymOperations,
- QuerySynonymOperations,
- UpdateSynonymOperations,
- RuleOperations,
- TotalRulesOperations,
- BatchRulesOperations,
- ClearRulesOperations,
- DeleteRulesOperations,
- GetRulesOperations,
- SaveRulesOperations,
- SearchRulesOperations,
- TotalRecommendRequests,
- TotalWriteOperations,
- TotalReadOperations,
- TotalOperations,
- QuerysuggestionsTotalSearchOperations,
- QuerysuggestionsTotalSearchRequests,
- QuerysuggestionsTotalAclOperations,
- QuerysuggestionsTotalIndexingOperations,
- QuerysuggestionsTotalRecordsOperations,
- QuerysuggestionsTotalSynonymOperations,
- QuerysuggestionsTotalRulesOperations,
- QuerysuggestionsTotalWriteOperations,
- QuerysuggestionsTotalReadOperations,
- QuerysuggestionsTotalOperations,
- AvgProcessingTime,
- `90pProcessingTime`,
- `99pProcessingTime`,
- QueriesAboveLastMsProcessingTime,
- Records,
- DataSize,
- FileSize,
- MaxQps,
- RegionMaxQps,
- TotalMaxQps,
- UsedSearchCapacity,
- AvgUsedSearchCapacity,
- RegionUsedSearchCapacity,
- RegionAvgUsedSearchCapacity,
- TotalUsedSearchCapacity,
- TotalAvgUsedSearchCapacity,
- DegradedQueriesSsdUsedQueriesImpacted,
- DegradedQueriesSsdUsedSecondsImpacted,
- DegradedQueriesMaxCapacityQueriesImpacted,
- DegradedQueriesMaxCapacitySecondsImpacted
- )
-
- def withName(name: String): Statistic = Statistic.values
- .find(_.toString == name)
- .getOrElse(throw new MappingException(s"Unknown Statistic value: $name"))
-}
-
-class StatisticSerializer
- extends CustomSerializer[Statistic](_ =>
- (
- {
- case JString(value) => Statistic.withName(value)
- case JNull => null
- },
- { case value: Statistic =>
- JString(value.toString)
- }
- )
- )
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticEntry.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticEntry.scala
deleted file mode 100644
index e2a4692ce1..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticEntry.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-/** StatisticEntry
- *
- * @param t
- * Timestamp, measured in milliseconds since the Unix epoch.
- */
-case class StatisticEntry(
- t: Option[Int] = scala.None,
- v: Option[StatisticValue] = scala.None
-)
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticValue.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticValue.scala
deleted file mode 100644
index c879a127f0..0000000000
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticValue.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/** Usage API The Usage API gives you access to statistics about all requests made to your Algolia applications. ## Base
- * URL The base URL for requests to the Usage API is: - `https://usage.algolia.com` **All requests must use HTTPS.** ##
- * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
- * application ID. - `x-algolia-api-key`. The Usage API key. You can find your application ID and Usage API key in the
- * [Algolia dashboard](https://dashboard.algolia.com/account). ## Response status and errors The Usage API returns JSON
- * responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API
- * response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
- * indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
- * version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- *
- * The version of the OpenAPI document: 1.0.0
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech Do not edit the class manually.
- */
-package algoliasearch.usage
-
-import org.json4s._
-
-/** StatisticValue
- */
-sealed trait StatisticValue
-
-object StatisticValue {
-
- case class IntValue(value: Int) extends StatisticValue
- case class MapOfStringInt(value: Map[String, Int]) extends StatisticValue
-
- def apply(value: Int): StatisticValue = {
- StatisticValue.IntValue(value)
- }
- def apply(value: Map[String, Int]): StatisticValue = {
- StatisticValue.MapOfStringInt(value)
- }
-
-}
-
-object StatisticValueSerializer extends Serializer[StatisticValue] {
- override def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), StatisticValue] = {
-
- case (TypeInfo(clazz, _), json) if clazz == classOf[StatisticValue] =>
- json match {
- case JInt(value) => StatisticValue.IntValue(value.toInt)
- case value: JObject => StatisticValue.apply(Extraction.extract[Map[String, Int]](value))
- case _ => throw new MappingException("Can't convert " + json + " to StatisticValue")
- }
- }
-
- override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = { case value: StatisticValue =>
- value match {
- case StatisticValue.IntValue(value) => JInt(value)
- }
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/ErrorItem.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/ErrorItem.swift
deleted file mode 100644
index 925f42e671..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/ErrorItem.swift
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct ErrorItem: Codable, JSONEncodable {
- public var code: String?
- public var message: String
- public var line: Int?
- public var position: Int?
-
- public init(code: String? = nil, message: String, line: Int? = nil, position: Int? = nil) {
- self.code = code
- self.message = message
- self.line = line
- self.position = position
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case code
- case message
- case line
- case position
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.code, forKey: .code)
- try container.encode(self.message, forKey: .message)
- try container.encodeIfPresent(self.line, forKey: .line)
- try container.encodeIfPresent(self.position, forKey: .position)
- }
-}
-
-extension ErrorItem: Equatable {
- public static func ==(lhs: ErrorItem, rhs: ErrorItem) -> Bool {
- lhs.code == rhs.code &&
- lhs.message == rhs.message &&
- lhs.line == rhs.line &&
- lhs.position == rhs.position
- }
-}
-
-extension ErrorItem: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.code?.hashValue)
- hasher.combine(self.message.hashValue)
- hasher.combine(self.line?.hashValue)
- hasher.combine(self.position?.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/ForbiddenError.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/ForbiddenError.swift
deleted file mode 100644
index bb01acc18a..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/ForbiddenError.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct ForbiddenError: Codable, JSONEncodable {
- public var code: String?
- public var message: String?
- public var errors: [ErrorItem]?
-
- public init(code: String? = nil, message: String? = nil, errors: [ErrorItem]? = nil) {
- self.code = code
- self.message = message
- self.errors = errors
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case code
- case message
- case errors
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.code, forKey: .code)
- try container.encodeIfPresent(self.message, forKey: .message)
- try container.encodeIfPresent(self.errors, forKey: .errors)
- }
-}
-
-extension ForbiddenError: Equatable {
- public static func ==(lhs: ForbiddenError, rhs: ForbiddenError) -> Bool {
- lhs.code == rhs.code &&
- lhs.message == rhs.message &&
- lhs.errors == rhs.errors
- }
-}
-
-extension ForbiddenError: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.code?.hashValue)
- hasher.combine(self.message?.hashValue)
- hasher.combine(self.errors?.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/Granularity.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/Granularity.swift
deleted file mode 100644
index 84eeebd533..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/Granularity.swift
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public enum Granularity: String, Codable, CaseIterable {
- case hourly
- case daily
-}
-
-extension Granularity: Hashable {}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/IndexUsage.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/IndexUsage.swift
deleted file mode 100644
index f6ba27864d..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/IndexUsage.swift
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct IndexUsage: Codable, JSONEncodable {
- public var statistics: [StatisticEntry]?
-
- public init(statistics: [StatisticEntry]? = nil) {
- self.statistics = statistics
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case statistics
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.statistics, forKey: .statistics)
- }
-}
-
-extension IndexUsage: Equatable {
- public static func ==(lhs: IndexUsage, rhs: IndexUsage) -> Bool {
- lhs.statistics == rhs.statistics
- }
-}
-
-extension IndexUsage: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.statistics?.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequest.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequest.swift
deleted file mode 100644
index 3ebb416627..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequest.swift
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct InvalidRequest: Codable, JSONEncodable {
- public var error: InvalidRequestError
-
- public init(error: InvalidRequestError) {
- self.error = error
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case error
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encode(self.error, forKey: .error)
- }
-}
-
-extension InvalidRequest: Equatable {
- public static func ==(lhs: InvalidRequest, rhs: InvalidRequest) -> Bool {
- lhs.error == rhs.error
- }
-}
-
-extension InvalidRequest: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.error.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequestError.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequestError.swift
deleted file mode 100644
index 2614ba5d4b..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequestError.swift
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct InvalidRequestError: Codable, JSONEncodable {
- public var code: String?
- public var message: String?
- public var errors: [ErrorItem]?
-
- public init(code: String? = nil, message: String? = nil, errors: [ErrorItem]? = nil) {
- self.code = code
- self.message = message
- self.errors = errors
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case code
- case message
- case errors
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.code, forKey: .code)
- try container.encodeIfPresent(self.message, forKey: .message)
- try container.encodeIfPresent(self.errors, forKey: .errors)
- }
-}
-
-extension InvalidRequestError: Equatable {
- public static func ==(lhs: InvalidRequestError, rhs: InvalidRequestError) -> Bool {
- lhs.code == rhs.code &&
- lhs.message == rhs.message &&
- lhs.errors == rhs.errors
- }
-}
-
-extension InvalidRequestError: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.code?.hashValue)
- hasher.combine(self.message?.hashValue)
- hasher.combine(self.errors?.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/Statistic.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/Statistic.swift
deleted file mode 100644
index 7bdb291af0..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/Statistic.swift
+++ /dev/null
@@ -1,96 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public enum Statistic: String, Codable, CaseIterable {
- case star = "*"
- case searchOperations = "search_operations"
- case totalSearchOperations = "total_search_operations"
- case totalSearchRequests = "total_search_requests"
- case queriesOperations = "queries_operations"
- case multiQueriesOperations = "multi_queries_operations"
- case aclOperations = "acl_operations"
- case totalAclOperations = "total_acl_operations"
- case getApiKeysOperations = "get_api_keys_operations"
- case getApiKeyOperations = "get_api_key_operations"
- case addApiKeyOperations = "add_api_key_operations"
- case updateApiKeyOperations = "update_api_key_operations"
- case deleteApiKeyOperations = "delete_api_key_operations"
- case listApiKeyOperations = "list_api_key_operations"
- case indexingOperations = "indexing_operations"
- case totalIndexingOperations = "total_indexing_operations"
- case browseOperations = "browse_operations"
- case clearIndexOperations = "clear_index_operations"
- case copyMoveOperations = "copy_move_operations"
- case deleteIndexOperations = "delete_index_operations"
- case getLogOperations = "get_log_operations"
- case getSettingsOperations = "get_settings_operations"
- case setSettingsOperations = "set_settings_operations"
- case listIndicesOperations = "list_indices_operations"
- case waitTaskOperations = "wait_task_operations"
- case recordOperations = "record_operations"
- case totalRecordsOperations = "total_records_operations"
- case addRecordOperations = "add_record_operations"
- case batchOperations = "batch_operations"
- case deleteByQueryOperations = "delete_by_query_operations"
- case deleteRecordOperations = "delete_record_operations"
- case getRecordOperations = "get_record_operations"
- case partialUpdateRecordOperations = "partial_update_record_operations"
- case updateRecordOperations = "update_record_operations"
- case synonymOperations = "synonym_operations"
- case totalSynonymOperations = "total_synonym_operations"
- case batchSynonymOperations = "batch_synonym_operations"
- case clearSynonymOperations = "clear_synonym_operations"
- case deleteSynonymOperations = "delete_synonym_operations"
- case getSynonymOperations = "get_synonym_operations"
- case querySynonymOperations = "query_synonym_operations"
- case updateSynonymOperations = "update_synonym_operations"
- case ruleOperations = "rule_operations"
- case totalRulesOperations = "total_rules_operations"
- case batchRulesOperations = "batch_rules_operations"
- case clearRulesOperations = "clear_rules_operations"
- case deleteRulesOperations = "delete_rules_operations"
- case getRulesOperations = "get_rules_operations"
- case saveRulesOperations = "save_rules_operations"
- case searchRulesOperations = "search_rules_operations"
- case totalRecommendRequests = "total_recommend_requests"
- case totalWriteOperations = "total_write_operations"
- case totalReadOperations = "total_read_operations"
- case totalOperations = "total_operations"
- case querysuggestionsTotalSearchOperations = "querysuggestions_total_search_operations"
- case querysuggestionsTotalSearchRequests = "querysuggestions_total_search_requests"
- case querysuggestionsTotalAclOperations = "querysuggestions_total_acl_operations"
- case querysuggestionsTotalIndexingOperations = "querysuggestions_total_indexing_operations"
- case querysuggestionsTotalRecordsOperations = "querysuggestions_total_records_operations"
- case querysuggestionsTotalSynonymOperations = "querysuggestions_total_synonym_operations"
- case querysuggestionsTotalRulesOperations = "querysuggestions_total_rules_operations"
- case querysuggestionsTotalWriteOperations = "querysuggestions_total_write_operations"
- case querysuggestionsTotalReadOperations = "querysuggestions_total_read_operations"
- case querysuggestionsTotalOperations = "querysuggestions_total_operations"
- case avgProcessingTime = "avg_processing_time"
- case _90pProcessingTime = "90p_processing_time"
- case _99pProcessingTime = "99p_processing_time"
- case queriesAboveLastMsProcessingTime = "queries_above_last_ms_processing_time"
- case records
- case dataSize = "data_size"
- case fileSize = "file_size"
- case maxQps = "max_qps"
- case regionMaxQps = "region_max_qps"
- case totalMaxQps = "total_max_qps"
- case usedSearchCapacity = "used_search_capacity"
- case avgUsedSearchCapacity = "avg_used_search_capacity"
- case regionUsedSearchCapacity = "region_used_search_capacity"
- case regionAvgUsedSearchCapacity = "region_avg_used_search_capacity"
- case totalUsedSearchCapacity = "total_used_search_capacity"
- case totalAvgUsedSearchCapacity = "total_avg_used_search_capacity"
- case degradedQueriesSsdUsedQueriesImpacted = "degraded_queries_ssd_used_queries_impacted"
- case degradedQueriesSsdUsedSecondsImpacted = "degraded_queries_ssd_used_seconds_impacted"
- case degradedQueriesMaxCapacityQueriesImpacted = "degraded_queries_max_capacity_queries_impacted"
- case degradedQueriesMaxCapacitySecondsImpacted = "degraded_queries_max_capacity_seconds_impacted"
-}
-
-extension Statistic: Hashable {}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticEntry.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticEntry.swift
deleted file mode 100644
index 314659965c..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticEntry.swift
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct StatisticEntry: Codable, JSONEncodable {
- /// Timestamp, measured in milliseconds since the Unix epoch.
- public var t: Int?
- public var v: StatisticValue?
-
- public init(t: Int? = nil, v: StatisticValue? = nil) {
- self.t = t
- self.v = v
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case t
- case v
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.t, forKey: .t)
- try container.encodeIfPresent(self.v, forKey: .v)
- }
-}
-
-extension StatisticEntry: Equatable {
- public static func ==(lhs: StatisticEntry, rhs: StatisticEntry) -> Bool {
- lhs.t == rhs.t &&
- lhs.v == rhs.v
- }
-}
-
-extension StatisticEntry: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.t?.hashValue)
- hasher.combine(self.v?.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticValue.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticValue.swift
deleted file mode 100644
index 33f9fbfa97..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticValue.swift
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public enum StatisticValue: Codable, JSONEncodable, AbstractEncodable {
- case int(Int)
- case dictionaryOfStringToInt([String: Int])
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.singleValueContainer()
- switch self {
- case let .int(value):
- try container.encode(value)
- case let .dictionaryOfStringToInt(value):
- try container.encode(value)
- }
- }
-
- public init(from decoder: Decoder) throws {
- let container = try decoder.singleValueContainer()
- if let value = try? container.decode(Int.self) {
- self = .int(value)
- } else if let value = try? container.decode([String: Int].self) {
- self = .dictionaryOfStringToInt(value)
- } else {
- throw DecodingError.typeMismatch(
- Self.Type.self,
- .init(codingPath: decoder.codingPath, debugDescription: "Unable to decode instance of StatisticValue")
- )
- }
- }
-
- public func GetActualInstance() -> Encodable {
- switch self {
- case let .int(value):
- value as Int
- case let .dictionaryOfStringToInt(value):
- value as [String: Int]
- }
- }
-}
-
-extension StatisticValue: Equatable {}
-extension StatisticValue: Hashable {}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageErrorBase.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageErrorBase.swift
deleted file mode 100644
index c905761216..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageErrorBase.swift
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-/// Error.
-public struct UsageErrorBase: Codable, JSONEncodable {
- public var message: String?
-
- public init(message: String? = nil) {
- self.message = message
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case message
- }
-
- public var additionalProperties: [String: AnyCodable] = [:]
-
- public subscript(key: String) -> AnyCodable? {
- get {
- if let value = additionalProperties[key] {
- return value
- }
- return nil
- }
-
- set {
- self.additionalProperties[key] = newValue
- }
- }
-
- public init(from dictionary: [String: AnyCodable]) throws {
- self.message = dictionary["message"]?.value as? String
-
- for (key, value) in dictionary {
- switch key {
- case "message":
- continue
- default:
- self.additionalProperties[key] = value
- }
- }
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encodeIfPresent(self.message, forKey: .message)
- var additionalPropertiesContainer = encoder.container(keyedBy: String.self)
- try additionalPropertiesContainer.encodeMap(self.additionalProperties)
- }
-
- // Decodable protocol methods
-
- public init(from decoder: Decoder) throws {
- let container = try decoder.container(keyedBy: CodingKeys.self)
-
- self.message = try container.decodeIfPresent(String.self, forKey: .message)
- var nonAdditionalPropertyKeys = Set()
- nonAdditionalPropertyKeys.insert("message")
- let additionalPropertiesContainer = try decoder.container(keyedBy: String.self)
- self.additionalProperties = try additionalPropertiesContainer.decodeMap(
- AnyCodable.self,
- excludedKeys: nonAdditionalPropertyKeys
- )
- }
-}
-
-extension UsageErrorBase: Equatable {
- public static func ==(lhs: UsageErrorBase, rhs: UsageErrorBase) -> Bool {
- lhs.message == rhs.message
- && lhs.additionalProperties == rhs.additionalProperties
- }
-}
-
-extension UsageErrorBase: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.message?.hashValue)
- hasher.combine(self.additionalProperties.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageForbidden.swift b/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageForbidden.swift
deleted file mode 100644
index 6deb4963b3..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/Models/UsageForbidden.swift
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct UsageForbidden: Codable, JSONEncodable {
- public var error: ForbiddenError
-
- public init(error: ForbiddenError) {
- self.error = error
- }
-
- public enum CodingKeys: String, CodingKey, CaseIterable {
- case error
- }
-
- // Encodable protocol methods
-
- public func encode(to encoder: Encoder) throws {
- var container = encoder.container(keyedBy: CodingKeys.self)
- try container.encode(self.error, forKey: .error)
- }
-}
-
-extension UsageForbidden: Equatable {
- public static func ==(lhs: UsageForbidden, rhs: UsageForbidden) -> Bool {
- lhs.error == rhs.error
- }
-}
-
-extension UsageForbidden: Hashable {
- public func hash(into hasher: inout Hasher) {
- hasher.combine(self.error.hashValue)
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/UsageClient.swift b/clients/algoliasearch-client-swift/Sources/Usage/UsageClient.swift
deleted file mode 100644
index 7f5d009c38..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/UsageClient.swift
+++ /dev/null
@@ -1,881 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-open class UsageClient {
- private var configuration: UsageClientConfiguration
- private var transporter: Transporter
-
- var appID: String {
- self.configuration.appID
- }
-
- public init(configuration: UsageClientConfiguration, transporter: Transporter) {
- self.configuration = configuration
- self.transporter = transporter
- }
-
- public convenience init(configuration: UsageClientConfiguration) {
- self.init(configuration: configuration, transporter: Transporter(configuration: configuration))
- }
-
- public convenience init(appID: String, apiKey: String) throws {
- try self.init(configuration: UsageClientConfiguration(appID: appID, apiKey: apiKey))
- }
-
- open func setClientApiKey(apiKey: String) {
- self.configuration.apiKey = apiKey
- self.transporter.setClientApiKey(apiKey: apiKey)
- }
-
- /// - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- /// - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- /// - returns: AnyCodable
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func customDelete(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> AnyCodable {
- let response: Response = try await customDeleteWithHTTPInfo(
- path: path,
- parameters: parameters,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // This method allow you to send requests to the Algolia REST API.
- //
- //
- // - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- //
- // - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- // - returns: RequestBuilder
-
- open func customDeleteWithHTTPInfo(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !path.isEmpty else {
- throw AlgoliaError.invalidArgument("path", "customDelete")
- }
-
- var resourcePath = "/{path}"
- let pathPreEscape = "\(APIHelper.mapValueToPathItem(path))"
- resourcePath = resourcePath.replacingOccurrences(
- of: "{path}",
- with: pathPreEscape,
- options: .literal,
- range: nil
- )
- let body: AnyCodable? = nil
- let queryParameters: [String: AnyCodable]? = parameters
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "DELETE",
- path: resourcePath,
- data: body,
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-
- /// - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- /// - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- /// - returns: AnyCodable
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func customGet(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> AnyCodable {
- let response: Response = try await customGetWithHTTPInfo(
- path: path,
- parameters: parameters,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // This method allow you to send requests to the Algolia REST API.
- //
- //
- // - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- //
- // - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- // - returns: RequestBuilder
-
- open func customGetWithHTTPInfo(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !path.isEmpty else {
- throw AlgoliaError.invalidArgument("path", "customGet")
- }
-
- var resourcePath = "/{path}"
- let pathPreEscape = "\(APIHelper.mapValueToPathItem(path))"
- resourcePath = resourcePath.replacingOccurrences(
- of: "{path}",
- with: pathPreEscape,
- options: .literal,
- range: nil
- )
- let body: AnyCodable? = nil
- let queryParameters: [String: AnyCodable]? = parameters
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "GET",
- path: resourcePath,
- data: body,
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-
- /// - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- /// - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- /// - parameter body: (body) Parameters to send with the custom request. (optional)
- /// - returns: AnyCodable
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func customPost(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- body: Codable? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> AnyCodable {
- let response: Response = try await customPostWithHTTPInfo(
- path: path,
- parameters: parameters,
- body: body,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // This method allow you to send requests to the Algolia REST API.
- //
- //
- // - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- //
- // - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- //
- // - parameter body: (body) Parameters to send with the custom request. (optional)
- // - returns: RequestBuilder
-
- open func customPostWithHTTPInfo(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- body: Codable? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !path.isEmpty else {
- throw AlgoliaError.invalidArgument("path", "customPost")
- }
-
- var resourcePath = "/{path}"
- let pathPreEscape = "\(APIHelper.mapValueToPathItem(path))"
- resourcePath = resourcePath.replacingOccurrences(
- of: "{path}",
- with: pathPreEscape,
- options: .literal,
- range: nil
- )
- let body = body
- let queryParameters: [String: AnyCodable]? = parameters
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "POST",
- path: resourcePath,
- data: body ?? AnyCodable(),
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-
- /// - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- /// - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- /// - parameter body: (body) Parameters to send with the custom request. (optional)
- /// - returns: AnyCodable
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func customPut(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- body: Codable? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> AnyCodable {
- let response: Response = try await customPutWithHTTPInfo(
- path: path,
- parameters: parameters,
- body: body,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // This method allow you to send requests to the Algolia REST API.
- //
- //
- // - parameter path: (path) Path of the endpoint, anything after \"/1\" must be specified.
- //
- // - parameter parameters: (query) Query parameters to apply to the current query. (optional)
- //
- // - parameter body: (body) Parameters to send with the custom request. (optional)
- // - returns: RequestBuilder
-
- open func customPutWithHTTPInfo(
- path: String,
- parameters: [String: AnyCodable]? = nil,
- body: Codable? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !path.isEmpty else {
- throw AlgoliaError.invalidArgument("path", "customPut")
- }
-
- var resourcePath = "/{path}"
- let pathPreEscape = "\(APIHelper.mapValueToPathItem(path))"
- resourcePath = resourcePath.replacingOccurrences(
- of: "{path}",
- with: pathPreEscape,
- options: .literal,
- range: nil
- )
- let body = body
- let queryParameters: [String: AnyCodable]? = parameters
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "PUT",
- path: resourcePath,
- data: body ?? AnyCodable(),
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-
- /// - parameter statistic: (path) 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.
- /// - parameter indexName: (path) Name of the index on which to perform the operation.
- /// - parameter startDate: (query) Start date of the period to analyze, in RFC 3339 format.
- /// - parameter endDate: (query) End date of the period to analyze, in RFC 3339 format.
- /// - parameter granularity: (query) 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. (optional)
- /// - returns: IndexUsage
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func getIndexUsage(
- statistic: Statistic,
- indexName: String,
- startDate: String,
- endDate: String,
- granularity: Granularity? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> IndexUsage {
- let response: Response = try await getIndexUsageWithHTTPInfo(
- statistic: statistic,
- indexName: indexName,
- startDate: startDate,
- endDate: endDate,
- granularity: granularity,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // Retrieves the selected usage statistics for one index.
- //
- //
- // - parameter statistic: (path) 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.
- //
- // - parameter indexName: (path) Name of the index on which to perform the operation.
- //
- // - parameter startDate: (query) Start date of the period to analyze, in RFC 3339 format.
- //
- // - parameter endDate: (query) End date of the period to analyze, in RFC 3339 format.
- //
- // - parameter granularity: (query) 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. (optional)
- // - returns: RequestBuilder
-
- open func getIndexUsageWithHTTPInfo(
- statistic: Statistic,
- indexName: String,
- startDate: String,
- endDate: String,
- granularity: Granularity? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !indexName.isEmpty else {
- throw AlgoliaError.invalidArgument("indexName", "getIndexUsage")
- }
-
- guard !startDate.isEmpty else {
- throw AlgoliaError.invalidArgument("startDate", "getIndexUsage")
- }
-
- guard !endDate.isEmpty else {
- throw AlgoliaError.invalidArgument("endDate", "getIndexUsage")
- }
-
- var resourcePath = "/1/usage/{statistic}/{indexName}"
- let statisticPreEscape = "\(APIHelper.mapValueToPathItem(statistic))"
- let statisticPostEscape = statisticPreEscape
- .addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
- resourcePath = resourcePath.replacingOccurrences(
- of: "{statistic}",
- with: statisticPostEscape,
- options: .literal,
- range: nil
- )
- let indexNamePreEscape = "\(APIHelper.mapValueToPathItem(indexName))"
- let indexNamePostEscape = indexNamePreEscape
- .addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
- resourcePath = resourcePath.replacingOccurrences(
- of: "{indexName}",
- with: indexNamePostEscape,
- options: .literal,
- range: nil
- )
- let body: AnyCodable? = nil
- let queryParameters: [String: Any?] = [
- "startDate": startDate.encodeToJSON(),
- "endDate": endDate.encodeToJSON(),
- "granularity": granularity?.encodeToJSON(),
- ]
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "GET",
- path: resourcePath,
- data: body,
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-
- /// - parameter statistic: (path) 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.
- /// - parameter startDate: (query) Start date of the period to analyze, in RFC 3339 format.
- /// - parameter endDate: (query) End date of the period to analyze, in RFC 3339 format.
- /// - parameter granularity: (query) 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. (optional)
- /// - returns: IndexUsage
- @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
- open func getUsage(
- statistic: Statistic,
- startDate: String,
- endDate: String,
- granularity: Granularity? = nil,
- requestOptions: RequestOptions? = nil
- ) async throws -> IndexUsage {
- let response: Response = try await getUsageWithHTTPInfo(
- statistic: statistic,
- startDate: startDate,
- endDate: endDate,
- granularity: granularity,
- requestOptions: requestOptions
- )
-
- guard let body = response.body else {
- throw AlgoliaError.missingData
- }
-
- return body
- }
-
- // Retrieves usage statistics evaluated over a specified period.
- //
- //
- // - parameter statistic: (path) 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.
- //
- // - parameter startDate: (query) Start date of the period to analyze, in RFC 3339 format.
- //
- // - parameter endDate: (query) End date of the period to analyze, in RFC 3339 format.
- //
- // - parameter granularity: (query) 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. (optional)
- // - returns: RequestBuilder
-
- open func getUsageWithHTTPInfo(
- statistic: Statistic,
- startDate: String,
- endDate: String,
- granularity: Granularity? = nil,
- requestOptions userRequestOptions: RequestOptions? = nil
- ) async throws -> Response {
- guard !startDate.isEmpty else {
- throw AlgoliaError.invalidArgument("startDate", "getUsage")
- }
-
- guard !endDate.isEmpty else {
- throw AlgoliaError.invalidArgument("endDate", "getUsage")
- }
-
- var resourcePath = "/1/usage/{statistic}"
- let statisticPreEscape = "\(APIHelper.mapValueToPathItem(statistic))"
- let statisticPostEscape = statisticPreEscape
- .addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
- resourcePath = resourcePath.replacingOccurrences(
- of: "{statistic}",
- with: statisticPostEscape,
- options: .literal,
- range: nil
- )
- let body: AnyCodable? = nil
- let queryParameters: [String: Any?] = [
- "startDate": startDate.encodeToJSON(),
- "endDate": endDate.encodeToJSON(),
- "granularity": granularity?.encodeToJSON(),
- ]
-
- let nillableHeaders: [String: Any?]? = nil
-
- let headers = APIHelper.rejectNilHeaders(nillableHeaders)
-
- return try await self.transporter.send(
- method: "GET",
- path: resourcePath,
- data: body,
- requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
- )
- }
-}
diff --git a/clients/algoliasearch-client-swift/Sources/Usage/UsageClientConfiguration.swift b/clients/algoliasearch-client-swift/Sources/Usage/UsageClientConfiguration.swift
deleted file mode 100644
index 3d6aa68762..0000000000
--- a/clients/algoliasearch-client-swift/Sources/Usage/UsageClientConfiguration.swift
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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.
-
-import Foundation
-#if canImport(Core)
- import Core
-#endif
-
-public struct UsageClientConfiguration: BaseConfiguration, Credentials {
- public let appID: String
- public var apiKey: String
- public var writeTimeout: TimeInterval
- public var readTimeout: TimeInterval
- public var logLevel: LogLevel
- public var defaultHeaders: [String: String]?
- public var hosts: [RetryableHost]
- public let compression: CompressionAlgorithm
-
- init(
- appID: String,
- apiKey: String,
- writeTimeout: TimeInterval = DefaultConfiguration.default.writeTimeout,
- readTimeout: TimeInterval = DefaultConfiguration.default.readTimeout,
- logLevel: LogLevel = DefaultConfiguration.default.logLevel,
- defaultHeaders: [String: String]? = DefaultConfiguration.default.defaultHeaders,
- hosts: [RetryableHost]? = nil
- ) throws {
- guard !appID.isEmpty else {
- throw AlgoliaError.invalidCredentials("appId")
- }
-
- guard !apiKey.isEmpty else {
- throw AlgoliaError.invalidCredentials("apiKey")
- }
-
- self.appID = appID
- self.apiKey = apiKey
- self.writeTimeout = writeTimeout
- self.readTimeout = readTimeout
- self.logLevel = logLevel
- self.defaultHeaders = [
- "X-Algolia-Application-Id": appID,
- "X-Algolia-API-Key": apiKey,
- "Content-Type": "application/json",
- ].merging(defaultHeaders ?? [:]) { _, new in new }
- self.compression = .none
-
- UserAgentController.append(UserAgent(title: "Usage", version: Version.current.description))
-
- guard let hosts else {
- self.hosts = [
- .init(url: URL(string: "https://usage.algolia.com")!),
- ]
- return
- }
-
- self.hosts = hosts
- }
-}
diff --git a/config/clients.config.json b/config/clients.config.json
index ac49a9f8da..f18ef5f2ee 100644
--- a/config/clients.config.json
+++ b/config/clients.config.json
@@ -9,8 +9,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-csharp",
"gitRepoId": "algoliasearch-client-csharp",
@@ -71,8 +70,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-go",
"gitRepoId": "algoliasearch-client-go",
@@ -99,8 +97,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-java",
"gitRepoId": "algoliasearch-client-java",
@@ -164,10 +161,6 @@
{
"name": "search",
"output": "clients/algoliasearch-client-javascript/packages/client-search"
- },
- {
- "name": "usage",
- "output": "clients/algoliasearch-client-javascript/packages/client-usage"
}
],
"folder": "clients/algoliasearch-client-javascript",
@@ -195,8 +188,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-kotlin",
"gitRepoId": "algoliasearch-client-kotlin",
@@ -223,8 +215,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-php",
"gitRepoId": "algoliasearch-client-php",
@@ -251,8 +242,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-python",
"gitRepoId": "algoliasearch-client-python",
@@ -286,8 +276,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-ruby",
"gitRepoId": "algoliasearch-client-ruby",
@@ -314,8 +303,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-scala",
"gitRepoId": "algoliasearch-client-scala",
@@ -342,8 +330,7 @@
"personalization",
"query-suggestions",
"recommend",
- "search",
- "usage"
+ "search"
],
"folder": "clients/algoliasearch-client-swift",
"gitRepoId": "algoliasearch-client-swift",
diff --git a/snippets/csharp/src/Usage.cs b/snippets/csharp/src/Usage.cs
deleted file mode 100644
index eb6cbc1f6e..0000000000
--- a/snippets/csharp/src/Usage.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-// 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.
-// >IMPORT
-using Algolia.Search.Clients;
-using Algolia.Search.Http;
-// IMPORT<
-using Algolia.Search.Models.Usage;
-using Action = Algolia.Search.Models.Ingestion.Action;
-
-public class SnippetUsageClient
-{
- ///
- /// Snippet for the CustomDelete method.
- ///
- /// allow del method for a custom path with minimal parameters
- ///
- public async Task SnippetForUsageClientCustomDelete()
- {
- // >SEPARATOR customDelete default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.CustomDeleteAsync("test/minimal");
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the CustomGet method.
- ///
- /// allow get method for a custom path with minimal parameters
- ///
- public async Task SnippetForUsageClientCustomGet()
- {
- // >SEPARATOR customGet default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.CustomGetAsync("test/minimal");
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the CustomPost method.
- ///
- /// allow post method for a custom path with minimal parameters
- ///
- public async Task SnippetForUsageClientCustomPost()
- {
- // >SEPARATOR customPost default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.CustomPostAsync("test/minimal");
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the CustomPut method.
- ///
- /// allow put method for a custom path with minimal parameters
- ///
- public async Task SnippetForUsageClientCustomPut()
- {
- // >SEPARATOR customPut default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.CustomPutAsync("test/minimal");
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the GetIndexUsage method.
- ///
- /// getIndexUsage with minimal parameters
- ///
- public async Task SnippetForUsageClientGetIndexUsage()
- {
- // >SEPARATOR getIndexUsage default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.GetIndexUsageAsync(
- Enum.Parse("QueriesOperations"),
- "",
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- );
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the GetUsage method.
- ///
- /// getUsage with minimal parameters
- ///
- public async Task SnippetForUsageClientGetUsage()
- {
- // >SEPARATOR getUsage default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- var response = await client.GetUsageAsync(
- Enum.Parse("QueriesOperations"),
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- );
- // >LOG
- // SEPARATOR<
- }
-
- ///
- /// Snippet for the SetClientApiKey method.
- ///
- /// switch API key
- ///
- public async Task SnippetForUsageClientSetClientApiKey()
- {
- // >SEPARATOR setClientApiKey default
- // Initialize the client
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID", "YOUR_API_KEY"));
-
- // Call the API
- client.SetClientApiKey("updated-api-key");
- // >LOG
- // SEPARATOR<
- }
-}
diff --git a/snippets/go/src/usage.go b/snippets/go/src/usage.go
deleted file mode 100644
index 30608c665c..0000000000
--- a/snippets/go/src/usage.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// 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.
-package snippets
-
-// >IMPORT
-import "github.com/algolia/algoliasearch-client-go/v4/algolia/usage"
-
-// IMPORT<
-
-func SnippetForCustomDeleteOfUsage() {
- /*
- Snippet for the customDelete method.
-
- allow del method for a custom path with minimal parameters
- */
-
- // >SEPARATOR customDelete default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomDelete(client.NewApiCustomDeleteRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForCustomGetOfUsage() {
- /*
- Snippet for the customGet method.
-
- allow get method for a custom path with minimal parameters
- */
-
- // >SEPARATOR customGet default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomGet(client.NewApiCustomGetRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForCustomPostOfUsage() {
- /*
- Snippet for the customPost method.
-
- allow post method for a custom path with minimal parameters
- */
-
- // >SEPARATOR customPost default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForCustomPutOfUsage() {
- /*
- Snippet for the customPut method.
-
- allow put method for a custom path with minimal parameters
- */
-
- // >SEPARATOR customPut default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomPut(client.NewApiCustomPutRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForGetIndexUsageOfUsage() {
- /*
- Snippet for the getIndexUsage method.
-
- getIndexUsage with minimal parameters
- */
-
- // >SEPARATOR getIndexUsage default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.GetIndexUsage(client.NewApiGetIndexUsageRequest(
- usage.Statistic("queries_operations"), "", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForGetUsageOfUsage() {
- /*
- Snippet for the getUsage method.
-
- getUsage with minimal parameters
- */
-
- // >SEPARATOR getUsage default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.GetUsage(client.NewApiGetUsageRequest(
- usage.Statistic("queries_operations"), "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- // SEPARATOR<
-}
-func SnippetForSetClientApiKeyOfUsage() {
- /*
- Snippet for the setClientApiKey method.
-
- switch API key
- */
-
- // >SEPARATOR setClientApiKey default
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- err = client.SetClientApiKey(
- "updated-api-key",
- )
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // SEPARATOR<
-}
diff --git a/snippets/guides/usage-snippets.json b/snippets/guides/usage-snippets.json
deleted file mode 100644
index db014e4161..0000000000
--- a/snippets/guides/usage-snippets.json
+++ /dev/null
@@ -1,290 +0,0 @@
-{
- "csharp": {
- "import": {
- "default": "using Algolia.Search.Clients;\nusing Algolia.Search.Http;"
- },
- "customDelete": {
- "default": "var response = await client.CustomDeleteAsync(\"test/minimal\");"
- },
- "customGet": {
- "default": "var response = await client.CustomGetAsync(\"test/minimal\");"
- },
- "customPost": {
- "default": "var response = await client.CustomPostAsync(\"test/minimal\");"
- },
- "customPut": {
- "default": "var response = await client.CustomPutAsync(\"test/minimal\");"
- },
- "getIndexUsage": {
- "default": "var response = await client.GetIndexUsageAsync(\n Enum.Parse(\"QueriesOperations\"),\n \"\",\n \"2024-04-03T12:46:43Z\",\n \"2024-04-05T12:46:43Z\"\n);"
- },
- "getUsage": {
- "default": "var response = await client.GetUsageAsync(\n Enum.Parse(\"QueriesOperations\"),\n \"2024-04-03T12:46:43Z\",\n \"2024-04-05T12:46:43Z\"\n);"
- },
- "setClientApiKey": {
- "default": "client.SetClientApiKey(\"updated-api-key\");"
- },
- "init": {
- "default": "var client = new UsageClient(new UsageConfig(\"YOUR_APP_ID\", \"YOUR_API_KEY\"));"
- }
- },
- "dart": {},
- "go": {
- "import": {
- "default": "import \"github.com/algolia/algoliasearch-client-go/v4/algolia/usage\""
- },
- "customDelete": {
- "default": "response, err := client.CustomDelete(client.NewApiCustomDeleteRequest(\n \"test/minimal\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "customGet": {
- "default": "response, err := client.CustomGet(client.NewApiCustomGetRequest(\n \"test/minimal\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "customPost": {
- "default": "response, err := client.CustomPost(client.NewApiCustomPostRequest(\n \"test/minimal\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "customPut": {
- "default": "response, err := client.CustomPut(client.NewApiCustomPutRequest(\n \"test/minimal\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "getIndexUsage": {
- "default": "response, err := client.GetIndexUsage(client.NewApiGetIndexUsageRequest(\n usage.Statistic(\"queries_operations\"), \"\", \"2024-04-03T12:46:43Z\", \"2024-04-05T12:46:43Z\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "getUsage": {
- "default": "response, err := client.GetUsage(client.NewApiGetUsageRequest(\n usage.Statistic(\"queries_operations\"), \"2024-04-03T12:46:43Z\", \"2024-04-05T12:46:43Z\",\n))\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "setClientApiKey": {
- "default": "err = client.SetClientApiKey(\n \"updated-api-key\",\n)\nif err != nil {\n // handle the eventual error\n panic(err)\n}"
- },
- "init": {
- "default": "client, err := usage.NewClient(\"YOUR_APP_ID\", \"YOUR_API_KEY\")"
- }
- },
- "java": {
- "import": {
- "default": "import com.algolia.api.UsageClient;\nimport com.algolia.model.usage.*;"
- },
- "customDelete": {
- "default": "client.customDelete(\"test/minimal\");"
- },
- "customGet": {
- "default": "client.customGet(\"test/minimal\");"
- },
- "customPost": {
- "default": "client.customPost(\"test/minimal\");"
- },
- "customPut": {
- "default": "client.customPut(\"test/minimal\");"
- },
- "getIndexUsage": {
- "default": "client.getIndexUsage(Statistic.QUERIES_OPERATIONS, \"\", \"2024-04-03T12:46:43Z\", \"2024-04-05T12:46:43Z\");"
- },
- "getUsage": {
- "default": "client.getUsage(Statistic.QUERIES_OPERATIONS, \"2024-04-03T12:46:43Z\", \"2024-04-05T12:46:43Z\");"
- },
- "setClientApiKey": {
- "default": "client.setClientApiKey(\"updated-api-key\");"
- },
- "init": {
- "default": "UsageClient client = new UsageClient(\"YOUR_APP_ID\", \"YOUR_API_KEY\");"
- }
- },
- "javascript": {
- "import": {
- "default": "import { usageClient } from '@algolia/client-usage';"
- },
- "customDelete": {
- "default": "const response = await client.customDelete({ path: 'test/minimal' });"
- },
- "customGet": {
- "default": "const response = await client.customGet({ path: 'test/minimal' });"
- },
- "customPost": {
- "default": "const response = await client.customPost({ path: 'test/minimal' });"
- },
- "customPut": {
- "default": "const response = await client.customPut({ path: 'test/minimal' });"
- },
- "getIndexUsage": {
- "default": "const response = await client.getIndexUsage({\n statistic: 'queries_operations',\n indexName: 'myIndexName',\n startDate: '2024-04-03T12:46:43Z',\n endDate: '2024-04-05T12:46:43Z',\n});"
- },
- "getUsage": {
- "default": "const response = await client.getUsage({\n statistic: 'queries_operations',\n startDate: '2024-04-03T12:46:43Z',\n endDate: '2024-04-05T12:46:43Z',\n});"
- },
- "setClientApiKey": {
- "default": "client.setClientApiKey({ apiKey: 'updated-api-key' });"
- },
- "init": {
- "default": "const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');"
- }
- },
- "kotlin": {
- "import": {
- "default": "import com.algolia.client.api.UsageClient"
- },
- "customDelete": {
- "default": "var response = client.customDelete(\n path = \"test/minimal\",\n)"
- },
- "customGet": {
- "default": "var response = client.customGet(\n path = \"test/minimal\",\n)"
- },
- "customPost": {
- "default": "var response = client.customPost(\n path = \"test/minimal\",\n)"
- },
- "customPut": {
- "default": "var response = client.customPut(\n path = \"test/minimal\",\n)"
- },
- "getIndexUsage": {
- "default": "var response = client.getIndexUsage(\n statistic = Statistic.entries.first { it.value == \"queries_operations\" },\n indexName = \"\",\n startDate = \"2024-04-03T12:46:43Z\",\n endDate = \"2024-04-05T12:46:43Z\",\n)"
- },
- "getUsage": {
- "default": "var response = client.getUsage(\n statistic = Statistic.entries.first { it.value == \"queries_operations\" },\n startDate = \"2024-04-03T12:46:43Z\",\n endDate = \"2024-04-05T12:46:43Z\",\n)"
- },
- "setClientApiKey": {
- "default": "client.setClientApiKey(\n apiKey = \"updated-api-key\",\n)"
- },
- "init": {
- "default": "val client = UsageClient(appId = \"YOUR_APP_ID\", apiKey = \"YOUR_API_KEY\")"
- }
- },
- "php": {
- "import": {
- "default": "use Algolia\\AlgoliaSearch\\Api\\UsageClient;"
- },
- "customDelete": {
- "default": "$response = $client->customDelete(\n 'test/minimal',\n);"
- },
- "customGet": {
- "default": "$response = $client->customGet(\n 'test/minimal',\n);"
- },
- "customPost": {
- "default": "$response = $client->customPost(\n 'test/minimal',\n);"
- },
- "customPut": {
- "default": "$response = $client->customPut(\n 'test/minimal',\n);"
- },
- "getIndexUsage": {
- "default": "$response = $client->getIndexUsage(\n 'queries_operations',\n '',\n '2024-04-03T12:46:43Z',\n '2024-04-05T12:46:43Z',\n);"
- },
- "getUsage": {
- "default": "$response = $client->getUsage(\n 'queries_operations',\n '2024-04-03T12:46:43Z',\n '2024-04-05T12:46:43Z',\n);"
- },
- "setClientApiKey": {
- "default": "$client->setClientApiKey(\n 'updated-api-key',\n);"
- },
- "init": {
- "default": "$client = UsageClient::create('', '');"
- }
- },
- "python": {
- "import": {
- "default": "from algoliasearch.usage.client import UsageClient"
- },
- "customDelete": {
- "default": "response = await _client.custom_delete(\n path=\"test/minimal\",\n)"
- },
- "customGet": {
- "default": "response = await _client.custom_get(\n path=\"test/minimal\",\n)"
- },
- "customPost": {
- "default": "response = await _client.custom_post(\n path=\"test/minimal\",\n)"
- },
- "customPut": {
- "default": "response = await _client.custom_put(\n path=\"test/minimal\",\n)"
- },
- "getIndexUsage": {
- "default": "response = await _client.get_index_usage(\n statistic=\"queries_operations\",\n index_name=\"\",\n start_date=\"2024-04-03T12:46:43Z\",\n end_date=\"2024-04-05T12:46:43Z\",\n)"
- },
- "getUsage": {
- "default": "response = await _client.get_usage(\n statistic=\"queries_operations\",\n start_date=\"2024-04-03T12:46:43Z\",\n end_date=\"2024-04-05T12:46:43Z\",\n)"
- },
- "setClientApiKey": {
- "default": "_client.set_client_api_key(\n api_key=\"updated-api-key\",\n)"
- },
- "init": {
- "default": "_client = UsageClient(\"YOUR_APP_ID\", \"YOUR_API_KEY\")"
- }
- },
- "ruby": {
- "import": {
- "default": "require \"algolia\""
- },
- "customDelete": {
- "default": "response = client.custom_delete(\"test/minimal\")"
- },
- "customGet": {
- "default": "response = client.custom_get(\"test/minimal\")"
- },
- "customPost": {
- "default": "response = client.custom_post(\"test/minimal\")"
- },
- "customPut": {
- "default": "response = client.custom_put(\"test/minimal\")"
- },
- "getIndexUsage": {
- "default": "response = client.get_index_usage(\n \"queries_operations\",\n \"\",\n \"2024-04-03T12:46:43Z\",\n \"2024-04-05T12:46:43Z\"\n)"
- },
- "getUsage": {
- "default": "response = client.get_usage(\"queries_operations\", \"2024-04-03T12:46:43Z\", \"2024-04-05T12:46:43Z\")"
- },
- "setClientApiKey": {
- "default": "client.set_client_api_key(\"updated-api-key\")"
- },
- "init": {
- "default": "client = Algolia::UsageClient.create(\"YOUR_APP_ID\", \"YOUR_API_KEY\")"
- }
- },
- "scala": {
- "import": {
- "default": "import algoliasearch.api.UsageClient"
- },
- "customDelete": {
- "default": "val response = client.customDelete[JObject](\n path = \"test/minimal\"\n)"
- },
- "customGet": {
- "default": "val response = client.customGet[JObject](\n path = \"test/minimal\"\n)"
- },
- "customPost": {
- "default": "val response = client.customPost[JObject](\n path = \"test/minimal\"\n)"
- },
- "customPut": {
- "default": "val response = client.customPut[JObject](\n path = \"test/minimal\"\n)"
- },
- "getIndexUsage": {
- "default": "val response = client.getIndexUsage(\n statistic = Statistic.withName(\"queries_operations\"),\n indexName = \"\",\n startDate = \"2024-04-03T12:46:43Z\",\n endDate = \"2024-04-05T12:46:43Z\"\n)"
- },
- "getUsage": {
- "default": "val response = client.getUsage(\n statistic = Statistic.withName(\"queries_operations\"),\n startDate = \"2024-04-03T12:46:43Z\",\n endDate = \"2024-04-05T12:46:43Z\"\n)"
- },
- "init": {
- "default": "val client = UsageClient(appId = \"YOUR_APP_ID\", apiKey = \"YOUR_API_KEY\")"
- }
- },
- "swift": {
- "import": {
- "default": "import Usage"
- },
- "customDelete": {
- "default": "let response = try await client.customDelete(path: \"test/minimal\")"
- },
- "customGet": {
- "default": "let response = try await client.customGet(path: \"test/minimal\")"
- },
- "customPost": {
- "default": "let response = try await client.customPost(path: \"test/minimal\")"
- },
- "customPut": {
- "default": "let response = try await client.customPut(path: \"test/minimal\")"
- },
- "getIndexUsage": {
- "default": "let response = try await client.getIndexUsage(\n statistic: Statistic.queriesOperations,\n indexName: \"\",\n startDate: \"2024-04-03T12:46:43Z\",\n endDate: \"2024-04-05T12:46:43Z\"\n)"
- },
- "getUsage": {
- "default": "let response = try await client.getUsage(\n statistic: Statistic.queriesOperations,\n startDate: \"2024-04-03T12:46:43Z\",\n endDate: \"2024-04-05T12:46:43Z\"\n)"
- },
- "setClientApiKey": {
- "default": "try client.setClientApiKey(apiKey: \"updated-api-key\")"
- },
- "init": {
- "default": "let client = try UsageClient(appID: \"YOUR_APP_ID\", apiKey: \"YOUR_API_KEY\")"
- }
- }
-}
\ No newline at end of file
diff --git a/snippets/javascript/src/usage.ts b/snippets/javascript/src/usage.ts
deleted file mode 100644
index 28a56883b2..0000000000
--- a/snippets/javascript/src/usage.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-// 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.
-/* eslint no-console: ["error", { allow: ["log"] }] */
-
-// >IMPORT
-import { usageClient } from '@algolia/client-usage';
-// IMPORT<
-
-// Snippet for the customDelete method.
-//
-// allow del method for a custom path with minimal parameters
-export async function snippetForCustomDelete(): Promise {
- // >SEPARATOR customDelete default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customDelete({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the customGet method.
-//
-// allow get method for a custom path with minimal parameters
-export async function snippetForCustomGet(): Promise {
- // >SEPARATOR customGet default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customGet({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the customPost method.
-//
-// allow post method for a custom path with minimal parameters
-export async function snippetForCustomPost(): Promise {
- // >SEPARATOR customPost default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customPost({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the customPut method.
-//
-// allow put method for a custom path with minimal parameters
-export async function snippetForCustomPut(): Promise {
- // >SEPARATOR customPut default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customPut({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the getIndexUsage method.
-//
-// getIndexUsage with minimal parameters
-export async function snippetForGetIndexUsage(): Promise {
- // >SEPARATOR getIndexUsage default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.getIndexUsage({
- statistic: 'queries_operations',
- indexName: 'myIndexName',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the getUsage method.
-//
-// getUsage with minimal parameters
-export async function snippetForGetUsage(): Promise {
- // >SEPARATOR getUsage default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.getUsage({
- statistic: 'queries_operations',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- });
-
- // >LOG
- // use typed response
- console.log(response);
- // SEPARATOR<
-}
-
-// Snippet for the setClientApiKey method.
-//
-// switch API key
-export function snippetForSetClientApiKey(): void {
- // >SEPARATOR setClientApiKey default
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- client.setClientApiKey({ apiKey: 'updated-api-key' });
-
- // >LOG
- // SEPARATOR<
-}
diff --git a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Usage.kt b/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Usage.kt
deleted file mode 100644
index aeafbd756f..0000000000
--- a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Usage.kt
+++ /dev/null
@@ -1,140 +0,0 @@
-// 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.
-package com.algolia.snippets
-
-// >IMPORT
-import com.algolia.client.api.UsageClient
-// IMPORT<
-import com.algolia.client.model.usage.*
-import kotlinx.serialization.json.*
-import kotlin.system.exitProcess
-
-class SnippetUsageClient {
- suspend fun snippetForCustomDelete() {
- // >SEPARATOR customDelete default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.customDelete(
- path = "test/minimal",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForCustomGet() {
- // >SEPARATOR customGet default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.customGet(
- path = "test/minimal",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForCustomPost() {
- // >SEPARATOR customPost default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.customPost(
- path = "test/minimal",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForCustomPut() {
- // >SEPARATOR customPut default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.customPut(
- path = "test/minimal",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForGetIndexUsage() {
- // >SEPARATOR getIndexUsage default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.getIndexUsage(
- statistic = Statistic.entries.first { it.value == "queries_operations" },
- indexName = "",
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForGetUsage() {
- // >SEPARATOR getUsage default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- var response = client.getUsage(
- statistic = Statistic.entries.first { it.value == "queries_operations" },
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z",
- )
-
- // >LOG
- // Use the response
- println(response)
- // SEPARATOR<
-
- exitProcess(0)
- }
-
- suspend fun snippetForSetClientApiKey() {
- // >SEPARATOR setClientApiKey default
- // Initialize the client
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY")
-
- // Call the API
- client.setClientApiKey(
- apiKey = "updated-api-key",
- )
-
- // >LOG
- // SEPARATOR<
-
- exitProcess(0)
- }
-}
diff --git a/snippets/php/src/Usage.php b/snippets/php/src/Usage.php
deleted file mode 100644
index 3389b834aa..0000000000
--- a/snippets/php/src/Usage.php
+++ /dev/null
@@ -1,170 +0,0 @@
-IMPORT
-use Algolia\AlgoliaSearch\Api\UsageClient;
-
-// IMPORT<
-
-class SnippetUsageClient
-{
- /**
- * Snippet for the CustomDelete method.
- *
- * allow del method for a custom path with minimal parameters
- */
- public function snippetForCustomDelete(): void
- {
- // >SEPARATOR customDelete default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customDelete(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the CustomGet method.
- *
- * allow get method for a custom path with minimal parameters
- */
- public function snippetForCustomGet(): void
- {
- // >SEPARATOR customGet default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customGet(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the CustomPost method.
- *
- * allow post method for a custom path with minimal parameters
- */
- public function snippetForCustomPost(): void
- {
- // >SEPARATOR customPost default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customPost(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the CustomPut method.
- *
- * allow put method for a custom path with minimal parameters
- */
- public function snippetForCustomPut(): void
- {
- // >SEPARATOR customPut default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customPut(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the GetIndexUsage method.
- *
- * getIndexUsage with minimal parameters
- */
- public function snippetForGetIndexUsage(): void
- {
- // >SEPARATOR getIndexUsage default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->getIndexUsage(
- 'queries_operations',
- '',
- '2024-04-03T12:46:43Z',
- '2024-04-05T12:46:43Z',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the GetUsage method.
- *
- * getUsage with minimal parameters
- */
- public function snippetForGetUsage(): void
- {
- // >SEPARATOR getUsage default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->getUsage(
- 'queries_operations',
- '2024-04-03T12:46:43Z',
- '2024-04-05T12:46:43Z',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- // SEPARATOR<
- }
-
- /**
- * Snippet for the SetClientApiKey method.
- *
- * switch API key
- */
- public function snippetForSetClientApiKey(): void
- {
- // >SEPARATOR setClientApiKey default
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $client->setClientApiKey(
- 'updated-api-key',
- );
-
- // >LOG
- // SEPARATOR<
- }
-}
diff --git a/snippets/python/usage.py b/snippets/python/usage.py
deleted file mode 100644
index 97708ea571..0000000000
--- a/snippets/python/usage.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# 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.
-# >IMPORT
-from algoliasearch.usage.client import UsageClient
-# IMPORT<
-
-
-async def snippet_for_custom_delete():
- """
- Snippet for the customDelete method.
-
- allow del method for a custom path with minimal parameters
- """
- # >SEPARATOR customDelete default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_delete(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_custom_get():
- """
- Snippet for the customGet method.
-
- allow get method for a custom path with minimal parameters
- """
- # >SEPARATOR customGet default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_get(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_custom_post():
- """
- Snippet for the customPost method.
-
- allow post method for a custom path with minimal parameters
- """
- # >SEPARATOR customPost default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_post(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_custom_put():
- """
- Snippet for the customPut method.
-
- allow put method for a custom path with minimal parameters
- """
- # >SEPARATOR customPut default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_put(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_get_index_usage():
- """
- Snippet for the getIndexUsage method.
-
- getIndexUsage with minimal parameters
- """
- # >SEPARATOR getIndexUsage default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.get_index_usage(
- statistic="queries_operations",
- index_name="",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_get_usage():
- """
- Snippet for the getUsage method.
-
- getUsage with minimal parameters
- """
- # >SEPARATOR getUsage default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.get_usage(
- statistic="queries_operations",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- # SEPARATOR<
-
-
-async def snippet_for_set_client_api_key():
- """
- Snippet for the setClientApiKey method.
-
- switch API key
- """
- # >SEPARATOR setClientApiKey default
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- _client.set_client_api_key(
- api_key="updated-api-key",
- )
-
- # >LOG
- # SEPARATOR<
diff --git a/snippets/ruby/usage.rb b/snippets/ruby/usage.rb
deleted file mode 100644
index 417b14e6e7..0000000000
--- a/snippets/ruby/usage.rb
+++ /dev/null
@@ -1,144 +0,0 @@
-# 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.
-# >IMPORT
-require "algolia"
-
-# IMPORT<
-
-# Snippet for the customDelete method.
-#
-# allow del method for a custom path with minimal parameters
-def snippet_for_custom_delete
- # >SEPARATOR customDelete default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_delete("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the customGet method.
-#
-# allow get method for a custom path with minimal parameters
-def snippet_for_custom_get
- # >SEPARATOR customGet default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_get("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the customPost method.
-#
-# allow post method for a custom path with minimal parameters
-def snippet_for_custom_post
- # >SEPARATOR customPost default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_post("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the customPut method.
-#
-# allow put method for a custom path with minimal parameters
-def snippet_for_custom_put
- # >SEPARATOR customPut default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_put("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the getIndexUsage method.
-#
-# getIndexUsage with minimal parameters
-def snippet_for_get_index_usage
- # >SEPARATOR getIndexUsage default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.get_index_usage(
- "queries_operations",
- "",
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- )
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the getUsage method.
-#
-# getUsage with minimal parameters
-def snippet_for_get_usage
- # >SEPARATOR getUsage default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.get_usage("queries_operations", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- # SEPARATOR<
-end
-
-# Snippet for the setClientApiKey method.
-#
-# switch API key
-def snippet_for_set_client_api_key
- # >SEPARATOR setClientApiKey default
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- client.set_client_api_key("updated-api-key")
- # >LOG
- # SEPARATOR<
-end
diff --git a/specs/bundled/usage.doc.yml b/specs/bundled/usage.doc.yml
deleted file mode 100644
index a5cab34523..0000000000
--- a/specs/bundled/usage.doc.yml
+++ /dev/null
@@ -1,1904 +0,0 @@
-openapi: 3.0.2
-info:
- title: Usage API
- description: >
- The Usage API gives you access to statistics about all requests made to your
- Algolia applications.
-
-
- ## Base URL
-
-
- The base URL for requests to the Usage API is:
-
-
- - `https://usage.algolia.com`
-
-
- **All requests must use HTTPS.**
-
-
- ## Authentication
-
-
- To authenticate your API requests, add these headers:
-
-
- - `x-algolia-application-id`. Your Algolia application ID.
-
- - `x-algolia-api-key`. The Usage API key.
-
-
- You can find your application ID and Usage API key in the [Algolia
- dashboard](https://dashboard.algolia.com/account).
-
-
- ## Response status and errors
-
-
- The Usage API returns JSON responses.
-
- Since JSON doesn't guarantee any specific ordering, don't rely on the order
- of attributes in the API response.
-
-
- Successful responses return a `2xx` status. Client errors return a `4xx`
- status. Server errors are indicated by a `5xx` status.
-
- Error responses have a `message` property with more information.
-
-
- ## Version
-
-
- The current version of the Usage API is version 1, as indicated by the `/1/`
- in each endpoint's URL.
- version: 1.0.0
-servers:
- - url: https://usage.algolia.com
- description: Base URL of the Usage API.
-security:
- - appId: []
- apiKey: []
-tags:
- - name: statistics
- x-displayName: Usage statistics
- description: Get various metrics related to the usage of your Algolia applications.
-paths:
- /{path}:
- get:
- operationId: customGet
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.CustomGetAsync("test/minimal");
-
- // >LOG
- - lang: go
- label: Go
- source: |
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomGet(client.NewApiCustomGetRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- - lang: java
- label: Java
- source: |
- // Initialize the client
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
- // Call the API
- client.customGet("test/minimal");
- // >LOG
- - lang: javascript
- label: JavaScript
- source: |
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customGet({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.customGet(
- path = "test/minimal",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customGet(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_get(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: |
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_get("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.customGet[JObject](
- path = "test/minimal"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.customGet(path: "test/minimal")
-
- // >LOG
- post:
- operationId: customPost
- requestBody:
- description: Parameters to send with the custom request.
- content:
- application/json:
- schema:
- type: object
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.CustomPostAsync("test/minimal");
-
- // >LOG
- - lang: go
- label: Go
- source: |
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- - lang: java
- label: Java
- source: |
- // Initialize the client
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
- // Call the API
- client.customPost("test/minimal");
- // >LOG
- - lang: javascript
- label: JavaScript
- source: |
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customPost({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.customPost(
- path = "test/minimal",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customPost(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_post(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: |
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_post("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.customPost[JObject](
- path = "test/minimal"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.customPost(path: "test/minimal")
-
- // >LOG
- put:
- operationId: customPut
- requestBody:
- description: Parameters to send with the custom request.
- content:
- application/json:
- schema:
- type: object
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.CustomPutAsync("test/minimal");
-
- // >LOG
- - lang: go
- label: Go
- source: |
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.CustomPut(client.NewApiCustomPutRequest(
- "test/minimal",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- - lang: java
- label: Java
- source: |
- // Initialize the client
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
- // Call the API
- client.customPut("test/minimal");
- // >LOG
- - lang: javascript
- label: JavaScript
- source: |
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.customPut({ path: 'test/minimal' });
-
- // >LOG
- // use typed response
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.customPut(
- path = "test/minimal",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customPut(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_put(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: |
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_put("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.customPut[JObject](
- path = "test/minimal"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.customPut(path: "test/minimal")
-
- // >LOG
- delete:
- operationId: customDelete
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.CustomDeleteAsync("test/minimal");
-
- // >LOG
- - lang: go
- label: Go
- source: >
- // Initialize the client
-
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
-
- // Call the API
-
- response, err :=
- client.CustomDelete(client.NewApiCustomDeleteRequest(
- "test/minimal",
- ))
-
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
-
- // >LOG
-
- // use the model directly
-
- print(response)
- - lang: java
- label: Java
- source: |
- // Initialize the client
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
- // Call the API
- client.customDelete("test/minimal");
- // >LOG
- - lang: javascript
- label: JavaScript
- source: >
- // Initialize the client
-
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
-
- // Call the API
-
- const response = await client.customDelete({ path: 'test/minimal'
- });
-
-
- // >LOG
-
- // use typed response
-
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.customDelete(
- path = "test/minimal",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->customDelete(
- 'test/minimal',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.custom_delete(
- path="test/minimal",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: |
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.custom_delete("test/minimal")
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.customDelete[JObject](
- path = "test/minimal"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.customDelete(path: "test/minimal")
-
- // >LOG
- /1/usage/{statistic}:
- get:
- operationId: getUsage
- summary: Retrieve usage information
- description: |
- Retrieves usage statistics evaluated over a specified period.
- tags:
- - statistics
- parameters:
- - $ref: '#/components/parameters/statisticParameter'
- - $ref: '#/components/parameters/StartDateRequired'
- - $ref: '#/components/parameters/EndDateRequired'
- - $ref: '#/components/parameters/granularityParameter'
- responses:
- '200':
- $ref: '#/components/responses/Success'
- '400':
- $ref: '#/components/responses/InvalidRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
- '403':
- $ref: '#/components/responses/Forbidden'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- '422':
- $ref: '#/components/responses/UnprocessableEntity'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.GetUsageAsync(
- Enum.Parse("QueriesOperations"),
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- );
-
- // >LOG
- - lang: go
- label: Go
- source: |
- // Initialize the client
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
- // Call the API
- response, err := client.GetUsage(client.NewApiGetUsageRequest(
- usage.Statistic("queries_operations"), "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
- // >LOG
- // use the model directly
- print(response)
- - lang: java
- label: Java
- source: >
- // Initialize the client
-
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
-
- // Call the API
-
- client.getUsage(Statistic.QUERIES_OPERATIONS,
- "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z");
-
- // >LOG
- - lang: javascript
- label: JavaScript
- source: |
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.getUsage({
- statistic: 'queries_operations',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- });
-
- // >LOG
- // use typed response
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.getUsage(
- statistic = Statistic.entries.first { it.value == "queries_operations" },
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->getUsage(
- 'queries_operations',
- '2024-04-03T12:46:43Z',
- '2024-04-05T12:46:43Z',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.get_usage(
- statistic="queries_operations",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: >
- # Initialize the client
-
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
-
- # Call the API
-
- response = client.get_usage("queries_operations",
- "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z")
-
-
- # >LOG
-
- # use the class directly
-
- puts(response)
-
-
- # print the JSON response
-
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.getUsage(
- statistic = Statistic.withName("queries_operations"),
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.getUsage(
- statistic: Statistic.queriesOperations,
- startDate: "2024-04-03T12:46:43Z",
- endDate: "2024-04-05T12:46:43Z"
- )
-
- // >LOG
- /1/usage/{statistic}/{indexName}:
- get:
- operationId: getIndexUsage
- summary: Retrieve usage information for one index
- description: |
- Retrieves the selected usage statistics for one index.
- tags:
- - statistics
- parameters:
- - $ref: '#/components/parameters/statisticParameter'
- - $ref: '#/components/parameters/IndexName'
- - $ref: '#/components/parameters/StartDateRequired'
- - $ref: '#/components/parameters/EndDateRequired'
- - $ref: '#/components/parameters/granularityParameter'
- responses:
- '200':
- $ref: '#/components/responses/Success'
- '400':
- $ref: '#/components/responses/InvalidRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
- '403':
- $ref: '#/components/responses/Forbidden'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- '422':
- $ref: '#/components/responses/UnprocessableEntity'
- x-codeSamples:
- - lang: csharp
- label: C#
- source: >
- // Initialize the client
-
- var client = new UsageClient(new UsageConfig("YOUR_APP_ID",
- "YOUR_API_KEY"));
-
-
- // Call the API
-
- var response = await client.GetIndexUsageAsync(
- Enum.Parse("QueriesOperations"),
- "",
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- );
-
- // >LOG
- - lang: go
- label: Go
- source: >
- // Initialize the client
-
- client, err := usage.NewClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- if err != nil {
- // The client can fail to initialize if you pass an invalid parameter.
- panic(err)
- }
-
-
- // Call the API
-
- response, err :=
- client.GetIndexUsage(client.NewApiGetIndexUsageRequest(
- usage.Statistic("queries_operations"), "", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
-
- if err != nil {
- // handle the eventual error
- panic(err)
- }
-
-
- // >LOG
-
- // use the model directly
-
- print(response)
- - lang: java
- label: Java
- source: >
- // Initialize the client
-
- UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
-
-
- // Call the API
-
- client.getIndexUsage(Statistic.QUERIES_OPERATIONS,
- "", "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z");
-
- // >LOG
- - lang: javascript
- label: JavaScript
- source: |
- // Initialize the client
- const client = usageClient('YOUR_APP_ID', 'YOUR_API_KEY');
-
- // Call the API
- const response = await client.getIndexUsage({
- statistic: 'queries_operations',
- indexName: 'myIndexName',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- });
-
- // >LOG
- // use typed response
- console.log(response);
- - lang: kotlin
- label: Kotlin
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- var response = client.getIndexUsage(
- statistic = Statistic.entries.first { it.value == "queries_operations" },
- indexName = "",
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z",
- )
-
-
- // >LOG
-
- // Use the response
-
- println(response)
- - lang: php
- label: PHP
- source: |
- // Initialize the client
- $client = UsageClient::create('', '');
-
- // Call the API
- $response = $client->getIndexUsage(
- 'queries_operations',
- '',
- '2024-04-03T12:46:43Z',
- '2024-04-05T12:46:43Z',
- );
-
- // >LOG
- // play with the response
- var_dump($response);
- - lang: python
- label: Python
- source: |
- # Initialize the client
- _client = UsageClient("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = await _client.get_index_usage(
- statistic="queries_operations",
- index_name="",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- # >LOG
- # use the class directly
- print(response)
-
- # print the JSON response
- print(response.to_json())
- - lang: ruby
- label: Ruby
- source: |
- # Initialize the client
- client = Algolia::UsageClient.create("YOUR_APP_ID", "YOUR_API_KEY")
-
- # Call the API
- response = client.get_index_usage(
- "queries_operations",
- "",
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- )
-
- # >LOG
- # use the class directly
- puts(response)
-
- # print the JSON response
- puts(response.to_json)
- - lang: scala
- label: Scala
- source: >
- // Initialize the client
-
- val client = UsageClient(appId = "YOUR_APP_ID", apiKey =
- "YOUR_API_KEY")
-
-
- // Call the API
-
- val response = client.getIndexUsage(
- statistic = Statistic.withName("queries_operations"),
- indexName = "",
- startDate = "2024-04-03T12:46:43Z",
- endDate = "2024-04-05T12:46:43Z"
- )
-
-
- // >LOG
-
- // Use the response
-
- val value = Await.result(response, Duration(100, "sec"))
- - lang: swift
- label: Swift
- source: >
- // Initialize the client
-
- let client = try UsageClient(appID: "YOUR_APP_ID", apiKey:
- "YOUR_API_KEY")
-
-
- // Call the API
-
- let response = try await client.getIndexUsage(
- statistic: Statistic.queriesOperations,
- indexName: "",
- startDate: "2024-04-03T12:46:43Z",
- endDate: "2024-04-05T12:46:43Z"
- )
-
- // >LOG
-components:
- securitySchemes:
- appId:
- type: apiKey
- in: header
- name: x-algolia-application-id
- description: Your Algolia application ID.
- apiKey:
- type: apiKey
- in: header
- name: x-algolia-api-key
- description: >
- Your Algolia API key with the necessary permissions to make the request.
-
- Permissions are controlled through access control lists (ACL) and access
- restrictions.
-
- The required ACL to make a request is listed in each endpoint's
- reference.
- parameters:
- PathInPath:
- name: path
- in: path
- description: Path of the endpoint, anything after "/1" must be specified.
- required: true
- schema:
- type: string
- example: /keys
- Parameters:
- name: parameters
- in: query
- description: Query parameters to apply to the current query.
- schema:
- type: object
- additionalProperties: true
- statisticParameter:
- name: statistic
- in: path
- required: true
- schema:
- $ref: '#/components/schemas/Statistic'
- example: records,max_qps,region_max_qps
- 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.
- StartDateRequired:
- in: query
- name: startDate
- description: Start date of the period to analyze, in RFC 3339 format.
- required: true
- schema:
- type: string
- example: '2024-08-30T00:00:00Z'
- EndDateRequired:
- in: query
- name: endDate
- description: End date of the period to analyze, in RFC 3339 format.
- required: true
- schema:
- type: string
- example: '2024-08-30T00:00:00Z'
- granularityParameter:
- name: granularity
- in: query
- 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.
- schema:
- $ref: '#/components/schemas/granularity'
- IndexName:
- name: indexName
- in: path
- description: Name of the index on which to perform the operation.
- required: true
- schema:
- type: string
- example: YourIndexName
- schemas:
- ErrorBase:
- description: Error.
- type: object
- x-keep-model: true
- additionalProperties: true
- properties:
- message:
- type: string
- example: Invalid Application-Id or API-Key
- Statistic:
- type: string
- enum:
- - '*'
- - search_operations
- - total_search_operations
- - total_search_requests
- - queries_operations
- - multi_queries_operations
- - acl_operations
- - total_acl_operations
- - get_api_keys_operations
- - get_api_key_operations
- - add_api_key_operations
- - update_api_key_operations
- - delete_api_key_operations
- - list_api_key_operations
- - indexing_operations
- - total_indexing_operations
- - browse_operations
- - clear_index_operations
- - copy_move_operations
- - delete_index_operations
- - get_log_operations
- - get_settings_operations
- - set_settings_operations
- - list_indices_operations
- - wait_task_operations
- - record_operations
- - total_records_operations
- - add_record_operations
- - batch_operations
- - delete_by_query_operations
- - delete_record_operations
- - get_record_operations
- - partial_update_record_operations
- - update_record_operations
- - synonym_operations
- - total_synonym_operations
- - batch_synonym_operations
- - clear_synonym_operations
- - delete_synonym_operations
- - get_synonym_operations
- - query_synonym_operations
- - update_synonym_operations
- - rule_operations
- - total_rules_operations
- - batch_rules_operations
- - clear_rules_operations
- - delete_rules_operations
- - get_rules_operations
- - save_rules_operations
- - search_rules_operations
- - total_recommend_requests
- - total_write_operations
- - total_read_operations
- - total_operations
- - querysuggestions_total_search_operations
- - querysuggestions_total_search_requests
- - querysuggestions_total_acl_operations
- - querysuggestions_total_indexing_operations
- - querysuggestions_total_records_operations
- - querysuggestions_total_synonym_operations
- - querysuggestions_total_rules_operations
- - querysuggestions_total_write_operations
- - querysuggestions_total_read_operations
- - querysuggestions_total_operations
- - avg_processing_time
- - 90p_processing_time
- - 99p_processing_time
- - queries_above_last_ms_processing_time
- - records
- - data_size
- - file_size
- - max_qps
- - region_max_qps
- - total_max_qps
- - used_search_capacity
- - avg_used_search_capacity
- - region_used_search_capacity
- - region_avg_used_search_capacity
- - total_used_search_capacity
- - total_avg_used_search_capacity
- - degraded_queries_ssd_used_queries_impacted
- - degraded_queries_ssd_used_seconds_impacted
- - degraded_queries_max_capacity_queries_impacted
- - degraded_queries_max_capacity_seconds_impacted
- granularity:
- type: string
- enum:
- - hourly
- - daily
- default: daily
- statisticValue:
- oneOf:
- - type: integer
- description: Value of the metric.
- - type: object
- additionalProperties:
- type: integer
- description: Value per server or region of the metric.
- responses:
- BadRequest:
- description: Bad request or request arguments.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- FeatureNotEnabled:
- description: This feature is not enabled on your Algolia account.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- MethodNotAllowed:
- description: Method not allowed with this API key.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- IndexNotFound:
- description: Index not found.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- Success:
- description: OK
- content:
- application/json:
- schema:
- title: indexUsage
- type: object
- properties:
- statistics:
- type: array
- items:
- title: statisticEntry
- type: object
- properties:
- t:
- type: integer
- description: >-
- Timestamp, measured in milliseconds since the Unix
- epoch.
- example: 1455451200000
- v:
- description: Value of the statistics.
- $ref: '#/components/schemas/statisticValue'
- InvalidRequest:
- description: Invalid request.
- content:
- application/json:
- schema:
- title: invalidRequest
- type: object
- properties:
- error:
- title: invalidRequestError
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- errors:
- type: array
- items:
- title: errorItem
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- line:
- type: integer
- position:
- type: integer
- required:
- - message
- example:
- message: url is not defined
- line: 5
- example:
- code: malformed_id
- required:
- - error
- Unauthorized:
- description: Unauthorized
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- Forbidden:
- description: Invalid credentials.
- content:
- application/json:
- schema:
- title: forbidden
- type: object
- properties:
- error:
- title: forbiddenError
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- errors:
- type: array
- items:
- title: errorItem
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- line:
- type: integer
- position:
- type: integer
- required:
- - message
- example:
- message: url is not defined
- line: 5
- example:
- code: malformed_id
- required:
- - error
- UnprocessableEntity:
- description: Unprocessable Entity.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
diff --git a/specs/bundled/usage.yml b/specs/bundled/usage.yml
deleted file mode 100644
index 0ccad972cc..0000000000
--- a/specs/bundled/usage.yml
+++ /dev/null
@@ -1,875 +0,0 @@
-openapi: 3.0.2
-info:
- title: Usage API
- description: >
- The Usage API gives you access to statistics about all requests made to your
- Algolia applications.
-
-
- ## Base URL
-
-
- The base URL for requests to the Usage API is:
-
-
- - `https://usage.algolia.com`
-
-
- **All requests must use HTTPS.**
-
-
- ## Authentication
-
-
- To authenticate your API requests, add these headers:
-
-
- - `x-algolia-application-id`. Your Algolia application ID.
-
- - `x-algolia-api-key`. The Usage API key.
-
-
- You can find your application ID and Usage API key in the [Algolia
- dashboard](https://dashboard.algolia.com/account).
-
-
- ## Response status and errors
-
-
- The Usage API returns JSON responses.
-
- Since JSON doesn't guarantee any specific ordering, don't rely on the order
- of attributes in the API response.
-
-
- Successful responses return a `2xx` status. Client errors return a `4xx`
- status. Server errors are indicated by a `5xx` status.
-
- Error responses have a `message` property with more information.
-
-
- ## Version
-
-
- The current version of the Usage API is version 1, as indicated by the `/1/`
- in each endpoint's URL.
- version: 1.0.0
-servers:
- - url: https://usage.algolia.com
- description: Base URL of the Usage API.
-security:
- - appId: []
- apiKey: []
-tags:
- - name: statistics
- x-displayName: Usage statistics
- description: Get various metrics related to the usage of your Algolia applications.
-paths:
- /{path}:
- get:
- operationId: customGet
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- tags:
- - usage
- post:
- operationId: customPost
- requestBody:
- description: Parameters to send with the custom request.
- content:
- application/json:
- schema:
- type: object
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- tags:
- - usage
- put:
- operationId: customPut
- requestBody:
- description: Parameters to send with the custom request.
- content:
- application/json:
- schema:
- type: object
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- tags:
- - usage
- delete:
- operationId: customDelete
- summary: Send requests to the Algolia REST API
- description: This method allow you to send requests to the Algolia REST API.
- parameters:
- - $ref: '#/components/parameters/PathInPath'
- - $ref: '#/components/parameters/Parameters'
- responses:
- '200':
- description: OK
- content:
- application/json:
- schema:
- type: object
- '400':
- $ref: '#/components/responses/BadRequest'
- '402':
- $ref: '#/components/responses/FeatureNotEnabled'
- '403':
- $ref: '#/components/responses/MethodNotAllowed'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- tags:
- - usage
- /1/usage/{statistic}:
- get:
- operationId: getUsage
- summary: Retrieve usage information
- description: |
- Retrieves usage statistics evaluated over a specified period.
- tags:
- - usage
- parameters:
- - $ref: '#/components/parameters/statisticParameter'
- - $ref: '#/components/parameters/StartDateRequired'
- - $ref: '#/components/parameters/EndDateRequired'
- - $ref: '#/components/parameters/granularityParameter'
- responses:
- '200':
- $ref: '#/components/responses/Success'
- '400':
- $ref: '#/components/responses/InvalidRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
- '403':
- $ref: '#/components/responses/Forbidden'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- '422':
- $ref: '#/components/responses/UnprocessableEntity'
- /1/usage/{statistic}/{indexName}:
- get:
- operationId: getIndexUsage
- summary: Retrieve usage information for one index
- description: |
- Retrieves the selected usage statistics for one index.
- tags:
- - usage
- parameters:
- - $ref: '#/components/parameters/statisticParameter'
- - $ref: '#/components/parameters/IndexName'
- - $ref: '#/components/parameters/StartDateRequired'
- - $ref: '#/components/parameters/EndDateRequired'
- - $ref: '#/components/parameters/granularityParameter'
- responses:
- '200':
- $ref: '#/components/responses/Success'
- '400':
- $ref: '#/components/responses/InvalidRequest'
- '401':
- $ref: '#/components/responses/Unauthorized'
- '403':
- $ref: '#/components/responses/Forbidden'
- '404':
- $ref: '#/components/responses/IndexNotFound'
- '422':
- $ref: '#/components/responses/UnprocessableEntity'
- /setClientApiKey:
- get:
- x-helper: true
- x-asynchronous-helper: false
- tags:
- - usage
- operationId: setClientApiKey
- summary: Switch the API key used to authenticate requests
- description: |
- Switch the API key used to authenticate requests.
- parameters:
- - in: query
- name: apiKey
- description: API key to be used from now on.
- required: true
- schema:
- type: string
- responses:
- '204':
- description: No content.
-components:
- securitySchemes:
- appId:
- type: apiKey
- in: header
- name: x-algolia-application-id
- description: Your Algolia application ID.
- apiKey:
- type: apiKey
- in: header
- name: x-algolia-api-key
- description: >
- Your Algolia API key with the necessary permissions to make the request.
-
- Permissions are controlled through access control lists (ACL) and access
- restrictions.
-
- The required ACL to make a request is listed in each endpoint's
- reference.
- parameters:
- PathInPath:
- name: path
- in: path
- description: Path of the endpoint, anything after "/1" must be specified.
- required: true
- schema:
- type: string
- example: /keys
- Parameters:
- name: parameters
- in: query
- description: Query parameters to apply to the current query.
- schema:
- type: object
- additionalProperties: true
- statisticParameter:
- name: statistic
- in: path
- required: true
- schema:
- $ref: '#/components/schemas/Statistic'
- example: records,max_qps,region_max_qps
- 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.
- StartDateRequired:
- in: query
- name: startDate
- description: Start date of the period to analyze, in RFC 3339 format.
- required: true
- schema:
- type: string
- example: '2024-08-30T00:00:00Z'
- EndDateRequired:
- in: query
- name: endDate
- description: End date of the period to analyze, in RFC 3339 format.
- required: true
- schema:
- type: string
- example: '2024-08-30T00:00:00Z'
- granularityParameter:
- name: granularity
- in: query
- 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.
- schema:
- $ref: '#/components/schemas/granularity'
- IndexName:
- name: indexName
- in: path
- description: Name of the index on which to perform the operation.
- required: true
- schema:
- type: string
- example: YourIndexName
- schemas:
- ErrorBase:
- description: Error.
- type: object
- x-keep-model: true
- additionalProperties: true
- properties:
- message:
- type: string
- example: Invalid Application-Id or API-Key
- Statistic:
- type: string
- enum:
- - '*'
- - search_operations
- - total_search_operations
- - total_search_requests
- - queries_operations
- - multi_queries_operations
- - acl_operations
- - total_acl_operations
- - get_api_keys_operations
- - get_api_key_operations
- - add_api_key_operations
- - update_api_key_operations
- - delete_api_key_operations
- - list_api_key_operations
- - indexing_operations
- - total_indexing_operations
- - browse_operations
- - clear_index_operations
- - copy_move_operations
- - delete_index_operations
- - get_log_operations
- - get_settings_operations
- - set_settings_operations
- - list_indices_operations
- - wait_task_operations
- - record_operations
- - total_records_operations
- - add_record_operations
- - batch_operations
- - delete_by_query_operations
- - delete_record_operations
- - get_record_operations
- - partial_update_record_operations
- - update_record_operations
- - synonym_operations
- - total_synonym_operations
- - batch_synonym_operations
- - clear_synonym_operations
- - delete_synonym_operations
- - get_synonym_operations
- - query_synonym_operations
- - update_synonym_operations
- - rule_operations
- - total_rules_operations
- - batch_rules_operations
- - clear_rules_operations
- - delete_rules_operations
- - get_rules_operations
- - save_rules_operations
- - search_rules_operations
- - total_recommend_requests
- - total_write_operations
- - total_read_operations
- - total_operations
- - querysuggestions_total_search_operations
- - querysuggestions_total_search_requests
- - querysuggestions_total_acl_operations
- - querysuggestions_total_indexing_operations
- - querysuggestions_total_records_operations
- - querysuggestions_total_synonym_operations
- - querysuggestions_total_rules_operations
- - querysuggestions_total_write_operations
- - querysuggestions_total_read_operations
- - querysuggestions_total_operations
- - avg_processing_time
- - 90p_processing_time
- - 99p_processing_time
- - queries_above_last_ms_processing_time
- - records
- - data_size
- - file_size
- - max_qps
- - region_max_qps
- - total_max_qps
- - used_search_capacity
- - avg_used_search_capacity
- - region_used_search_capacity
- - region_avg_used_search_capacity
- - total_used_search_capacity
- - total_avg_used_search_capacity
- - degraded_queries_ssd_used_queries_impacted
- - degraded_queries_ssd_used_seconds_impacted
- - degraded_queries_max_capacity_queries_impacted
- - degraded_queries_max_capacity_seconds_impacted
- granularity:
- type: string
- enum:
- - hourly
- - daily
- default: daily
- statisticValue:
- oneOf:
- - type: integer
- description: Value of the metric.
- - type: object
- additionalProperties:
- type: integer
- description: Value per server or region of the metric.
- responses:
- BadRequest:
- description: Bad request or request arguments.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- FeatureNotEnabled:
- description: This feature is not enabled on your Algolia account.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- MethodNotAllowed:
- description: Method not allowed with this API key.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- IndexNotFound:
- description: Index not found.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- Success:
- description: OK
- content:
- application/json:
- schema:
- title: indexUsage
- type: object
- properties:
- statistics:
- type: array
- items:
- title: statisticEntry
- type: object
- properties:
- t:
- type: integer
- description: >-
- Timestamp, measured in milliseconds since the Unix
- epoch.
- example: 1455451200000
- v:
- description: Value of the statistics.
- $ref: '#/components/schemas/statisticValue'
- InvalidRequest:
- description: Invalid request.
- content:
- application/json:
- schema:
- title: invalidRequest
- type: object
- properties:
- error:
- title: invalidRequestError
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- errors:
- type: array
- items:
- title: errorItem
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- line:
- type: integer
- position:
- type: integer
- required:
- - message
- example:
- message: url is not defined
- line: 5
- example:
- code: malformed_id
- required:
- - error
- Unauthorized:
- description: Unauthorized
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
- Forbidden:
- description: Invalid credentials.
- content:
- application/json:
- schema:
- title: forbidden
- type: object
- properties:
- error:
- title: forbiddenError
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- errors:
- type: array
- items:
- title: errorItem
- type: object
- properties:
- code:
- type: string
- message:
- type: string
- line:
- type: integer
- position:
- type: integer
- required:
- - message
- example:
- message: url is not defined
- line: 5
- example:
- code: malformed_id
- required:
- - error
- UnprocessableEntity:
- description: Unprocessable Entity.
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ErrorBase'
diff --git a/specs/usage/common/parameters.yml b/specs/usage/common/parameters.yml
deleted file mode 100644
index a57cead61c..0000000000
--- a/specs/usage/common/parameters.yml
+++ /dev/null
@@ -1,158 +0,0 @@
-statisticParameter:
- name: statistic
- in: path
- required: true
- schema:
- $ref: './schemas/statistic.yml#/Statistic'
- example: 'records,max_qps,region_max_qps'
- 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.
-
-granularityParameter:
- name: granularity
- in: query
- 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.
- schema:
- $ref: '#/granularity'
-
-granularity:
- type: string
- enum:
- - hourly
- - daily
- default: daily
diff --git a/specs/usage/common/schemas/responses.yml b/specs/usage/common/schemas/responses.yml
deleted file mode 100644
index b34d4e9e56..0000000000
--- a/specs/usage/common/schemas/responses.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-Success:
- description: OK
- content:
- application/json:
- schema:
- title: indexUsage
- type: object
- properties:
- statistics:
- type: array
- items:
- title: statisticEntry
- type: object
- properties:
- t:
- type: integer
- description: Timestamp, measured in milliseconds since the Unix epoch.
- example: 1455451200000
- v:
- description: Value of the statistics.
- $ref: '#/statisticValue'
-
-statisticValue:
- oneOf:
- - type: integer
- description: Value of the metric.
- - type: object
- additionalProperties:
- type: integer
- description: Value per server or region of the metric.
diff --git a/specs/usage/common/schemas/statistic.yml b/specs/usage/common/schemas/statistic.yml
deleted file mode 100644
index d3c51c266e..0000000000
--- a/specs/usage/common/schemas/statistic.yml
+++ /dev/null
@@ -1,87 +0,0 @@
-Statistic:
- type: string
- enum:
- - '*'
- - search_operations
- - total_search_operations
- - total_search_requests
- - queries_operations
- - multi_queries_operations
- - acl_operations
- - total_acl_operations
- - get_api_keys_operations
- - get_api_key_operations
- - add_api_key_operations
- - update_api_key_operations
- - delete_api_key_operations
- - list_api_key_operations
- - indexing_operations
- - total_indexing_operations
- - browse_operations
- - clear_index_operations
- - copy_move_operations
- - delete_index_operations
- - get_log_operations
- - get_settings_operations
- - set_settings_operations
- - list_indices_operations
- - wait_task_operations
- - record_operations
- - total_records_operations
- - add_record_operations
- - batch_operations
- - delete_by_query_operations
- - delete_record_operations
- - get_record_operations
- - partial_update_record_operations
- - update_record_operations
- - synonym_operations
- - total_synonym_operations
- - batch_synonym_operations
- - clear_synonym_operations
- - delete_synonym_operations
- - get_synonym_operations
- - query_synonym_operations
- - update_synonym_operations
- - rule_operations
- - total_rules_operations
- - batch_rules_operations
- - clear_rules_operations
- - delete_rules_operations
- - get_rules_operations
- - save_rules_operations
- - search_rules_operations
- - total_recommend_requests
- - total_write_operations
- - total_read_operations
- - total_operations
- - querysuggestions_total_search_operations
- - querysuggestions_total_search_requests
- - querysuggestions_total_acl_operations
- - querysuggestions_total_indexing_operations
- - querysuggestions_total_records_operations
- - querysuggestions_total_synonym_operations
- - querysuggestions_total_rules_operations
- - querysuggestions_total_write_operations
- - querysuggestions_total_read_operations
- - querysuggestions_total_operations
- - avg_processing_time
- - 90p_processing_time
- - 99p_processing_time
- - queries_above_last_ms_processing_time
- - records
- - data_size
- - file_size
- - max_qps
- - region_max_qps
- - total_max_qps
- - used_search_capacity
- - avg_used_search_capacity
- - region_used_search_capacity
- - region_avg_used_search_capacity
- - total_used_search_capacity
- - total_avg_used_search_capacity
- - degraded_queries_ssd_used_queries_impacted
- - degraded_queries_ssd_used_seconds_impacted
- - degraded_queries_max_capacity_queries_impacted
- - degraded_queries_max_capacity_seconds_impacted
diff --git a/specs/usage/paths/statistic.yml b/specs/usage/paths/statistic.yml
deleted file mode 100644
index f69ec6c5cc..0000000000
--- a/specs/usage/paths/statistic.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-get:
- operationId: getUsage
- summary: Retrieve usage information
- description: |
- Retrieves usage statistics evaluated over a specified period.
- tags:
- - statistics
- parameters:
- - $ref: '../common/parameters.yml#/statisticParameter'
- - $ref: '../../common/parameters.yml#/StartDateRequired'
- - $ref: '../../common/parameters.yml#/EndDateRequired'
- - $ref: '../common/parameters.yml#/granularityParameter'
- responses:
- '200':
- $ref: '../common/schemas/responses.yml#/Success'
- '400':
- $ref: '../../common/responses/InvalidRequest.yml'
- '401':
- $ref: '../../common/responses/Unauthorized.yml'
- '403':
- $ref: '../../common/responses/Forbidden.yml'
- '404':
- $ref: '../../common/responses/IndexNotFound.yml'
- '422':
- $ref: '../../common/responses/UnprocessableEntity.yml'
diff --git a/specs/usage/paths/statisticIndex.yml b/specs/usage/paths/statisticIndex.yml
deleted file mode 100644
index 015e84d681..0000000000
--- a/specs/usage/paths/statisticIndex.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-get:
- operationId: getIndexUsage
- summary: Retrieve usage information for one index
- description: |
- Retrieves the selected usage statistics for one index.
- tags:
- - statistics
- parameters:
- - $ref: '../common/parameters.yml#/statisticParameter'
- - $ref: '../../common/parameters.yml#/IndexName'
- - $ref: '../../common/parameters.yml#/StartDateRequired'
- - $ref: '../../common/parameters.yml#/EndDateRequired'
- - $ref: '../common/parameters.yml#/granularityParameter'
- responses:
- '200':
- $ref: '../common/schemas/responses.yml#/Success'
- '400':
- $ref: '../../common/responses/InvalidRequest.yml'
- '401':
- $ref: '../../common/responses/Unauthorized.yml'
- '403':
- $ref: '../../common/responses/Forbidden.yml'
- '404':
- $ref: '../../common/responses/IndexNotFound.yml'
- '422':
- $ref: '../../common/responses/UnprocessableEntity.yml'
diff --git a/specs/usage/spec.yml b/specs/usage/spec.yml
deleted file mode 100644
index deddb3c7e1..0000000000
--- a/specs/usage/spec.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-openapi: 3.0.2
-info:
- title: Usage API
- description: |
- The Usage API gives you access to statistics about all requests made to your Algolia applications.
-
- ## Base URL
-
- The base URL for requests to the Usage API is:
-
- - `https://usage.algolia.com`
-
- **All requests must use HTTPS.**
-
- ## Authentication
-
- To authenticate your API requests, add these headers:
-
- - `x-algolia-application-id`. Your Algolia application ID.
- - `x-algolia-api-key`. The Usage API key.
-
- You can find your application ID and Usage API key in the [Algolia dashboard](https://dashboard.algolia.com/account).
-
- ## Response status and errors
-
- The Usage API returns JSON responses.
- Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in the API response.
-
- Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are indicated by a `5xx` status.
- Error responses have a `message` property with more information.
-
- ## Version
-
- The current version of the Usage API is version 1, as indicated by the `/1/` in each endpoint's URL.
- version: 1.0.0
-components:
- securitySchemes:
- appId:
- $ref: '../common/securitySchemes.yml#/appId'
- apiKey:
- $ref: '../common/securitySchemes.yml#/apiKey'
-servers:
- - url: 'https://usage.algolia.com'
- description: Base URL of the Usage API.
-security:
- - appId: []
- apiKey: []
-tags:
- - name: statistics
- x-displayName: Usage statistics
- description: Get various metrics related to the usage of your Algolia applications.
-x-tagGroups:
- - name: General
- tags:
- - statistics
-paths:
- # ######################
- # ### Custom request ###
- # ######################
- /{path}:
- $ref: '../common/paths/customRequest.yml'
-
- # ##################################
- # ######## Usage Endpoints ########
- # ##################################
- /1/usage/{statistic}:
- $ref: 'paths/statistic.yml'
- /1/usage/{statistic}/{indexName}:
- $ref: 'paths/statisticIndex.yml'
-
- # ###############
- # ### Helpers ###
- # ###############
- /setClientApiKey:
- $ref: '../common/helpers/setClientApiKey.yml#/method'
diff --git a/tests/CTS/client/usage/api.json b/tests/CTS/client/usage/api.json
deleted file mode 100644
index bcc0e280c7..0000000000
--- a/tests/CTS/client/usage/api.json
+++ /dev/null
@@ -1,50 +0,0 @@
-[
- {
- "testName": "calls api with correct read host",
- "autoCreateClient": false,
- "steps": [
- {
- "type": "createClient",
- "parameters": {
- "appId": "test-app-id",
- "apiKey": "test-api-key"
- }
- },
- {
- "type": "method",
- "method": "customGet",
- "parameters": {
- "path": "test"
- },
- "expected": {
- "type": "host",
- "match": "usage.algolia.com"
- }
- }
- ]
- },
- {
- "testName": "calls api with correct write host",
- "autoCreateClient": false,
- "steps": [
- {
- "type": "createClient",
- "parameters": {
- "appId": "test-app-id",
- "apiKey": "test-api-key"
- }
- },
- {
- "type": "method",
- "method": "customPost",
- "parameters": {
- "path": "test"
- },
- "expected": {
- "type": "host",
- "match": "usage.algolia.com"
- }
- }
- ]
- }
-]
diff --git a/tests/CTS/client/usage/parameters.json b/tests/CTS/client/usage/parameters.json
deleted file mode 100644
index 09a063fa55..0000000000
--- a/tests/CTS/client/usage/parameters.json
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- {
- "testName": "client throws with invalid parameters",
- "autoCreateClient": false,
- "steps": [
- {
- "type": "createClient",
- "expected": {
- "error": "`appId` is missing."
- }
- },
- {
- "type": "createClient",
- "parameters": {
- "apiKey": "my-api-key"
- },
- "expected": {
- "error": "`appId` is missing."
- }
- },
- {
- "type": "createClient",
- "parameters": {
- "appId": "my-app-id"
- },
- "expected": {
- "error": "`apiKey` is missing."
- }
- }
- ]
- }
-]
diff --git a/tests/CTS/requests/usage/getIndexUsage.json b/tests/CTS/requests/usage/getIndexUsage.json
deleted file mode 100644
index bf49ef434e..0000000000
--- a/tests/CTS/requests/usage/getIndexUsage.json
+++ /dev/null
@@ -1,19 +0,0 @@
-[
- {
- "testName": "getIndexUsage with minimal parameters",
- "parameters": {
- "statistic": "queries_operations",
- "indexName": "myIndexName",
- "startDate": "2024-04-03T12:46:43Z",
- "endDate": "2024-04-05T12:46:43Z"
- },
- "request": {
- "path": "/1/usage/queries_operations/myIndexName",
- "method": "GET",
- "queryParameters": {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z"
- }
- }
- }
-]
diff --git a/tests/CTS/requests/usage/getUsage.json b/tests/CTS/requests/usage/getUsage.json
deleted file mode 100644
index c93bb92074..0000000000
--- a/tests/CTS/requests/usage/getUsage.json
+++ /dev/null
@@ -1,18 +0,0 @@
-[
- {
- "testName": "getUsage with minimal parameters",
- "parameters": {
- "statistic": "queries_operations",
- "startDate": "2024-04-03T12:46:43Z",
- "endDate": "2024-04-05T12:46:43Z"
- },
- "request": {
- "path": "/1/usage/queries_operations",
- "method": "GET",
- "queryParameters": {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z"
- }
- }
- }
-]
diff --git a/tests/output/go/tests/client/usage_test.go b/tests/output/go/tests/client/usage_test.go
deleted file mode 100644
index c809a6812e..0000000000
--- a/tests/output/go/tests/client/usage_test.go
+++ /dev/null
@@ -1,225 +0,0 @@
-// 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.
-package client
-
-import (
- "encoding/json"
- "regexp"
- "testing"
-
- "github.com/stretchr/testify/require"
-
- "gotests/tests"
-
- "github.com/algolia/algoliasearch-client-go/v4/algolia/call"
- "github.com/algolia/algoliasearch-client-go/v4/algolia/transport"
- "github.com/algolia/algoliasearch-client-go/v4/algolia/usage"
-)
-
-func createUsageClient(t *testing.T) (*usage.APIClient, *tests.EchoRequester) {
- echo := &tests.EchoRequester{}
- cfg := usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "appID",
- ApiKey: "apiKey",
- Requester: echo,
- },
- }
- client, err := usage.NewClientWithConfig(cfg)
- require.NoError(t, err)
-
- return client, echo
-}
-
-// calls api with correct read host
-func TestUsageapi0(t *testing.T) {
- var err error
- var res any
- _ = res
- echo := &tests.EchoRequester{}
- var client *usage.APIClient
- var cfg usage.UsageConfiguration
- _ = client
- _ = echo
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "test-app-id",
- ApiKey: "test-api-key",
- Requester: echo,
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.NoError(t, err)
- res, err = client.CustomGet(client.NewApiCustomGetRequest(
- "test",
- ))
- require.NoError(t, err)
- require.Equal(t, "usage.algolia.com", echo.Host)
-}
-
-// calls api with correct write host
-func TestUsageapi1(t *testing.T) {
- var err error
- var res any
- _ = res
- echo := &tests.EchoRequester{}
- var client *usage.APIClient
- var cfg usage.UsageConfiguration
- _ = client
- _ = echo
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "test-app-id",
- ApiKey: "test-api-key",
- Requester: echo,
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.NoError(t, err)
- res, err = client.CustomPost(client.NewApiCustomPostRequest(
- "test",
- ))
- require.NoError(t, err)
- require.Equal(t, "usage.algolia.com", echo.Host)
-}
-
-// calls api with correct user agent
-func TestUsagecommonApi0(t *testing.T) {
- var err error
- var res any
- _ = res
- client, echo := createUsageClient(t)
- _ = echo
- res, err = client.CustomPost(client.NewApiCustomPostRequest(
- "1/test",
- ))
- require.NoError(t, err)
- require.Regexp(t, regexp.MustCompile(`^Algolia for Go \(\d+\.\d+\.\d+(-?.*)?\)(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*(; Usage (\(\d+\.\d+\.\d+(-?.*)?\)))(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*$`), echo.Header.Get("User-Agent"))
-}
-
-// the user agent contains the latest version
-func TestUsagecommonApi1(t *testing.T) {
- var err error
- var res any
- _ = res
- client, echo := createUsageClient(t)
- _ = echo
- res, err = client.CustomPost(client.NewApiCustomPostRequest(
- "1/test",
- ))
- require.NoError(t, err)
- require.Regexp(t, regexp.MustCompile(`^Algolia for Go \(4.3.0\).*`), echo.Header.Get("User-Agent"))
-}
-
-// calls api with default read timeouts
-func TestUsagecommonApi2(t *testing.T) {
- var err error
- var res any
- _ = res
- client, echo := createUsageClient(t)
- _ = echo
- res, err = client.CustomGet(client.NewApiCustomGetRequest(
- "1/test",
- ))
- require.NoError(t, err)
- require.Equal(t, int64(2000), echo.ConnectTimeout.Milliseconds())
- require.Equal(t, int64(5000), echo.Timeout.Milliseconds())
-}
-
-// calls api with default write timeouts
-func TestUsagecommonApi3(t *testing.T) {
- var err error
- var res any
- _ = res
- client, echo := createUsageClient(t)
- _ = echo
- res, err = client.CustomPost(client.NewApiCustomPostRequest(
- "1/test",
- ))
- require.NoError(t, err)
- require.Equal(t, int64(2000), echo.ConnectTimeout.Milliseconds())
- require.Equal(t, int64(30000), echo.Timeout.Milliseconds())
-}
-
-// client throws with invalid parameters
-func TestUsageparameters0(t *testing.T) {
- var err error
- var res any
- _ = res
- echo := &tests.EchoRequester{}
- var client *usage.APIClient
- var cfg usage.UsageConfiguration
- _ = client
- _ = echo
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "",
- ApiKey: "",
- Requester: echo,
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.EqualError(t, err, "`appId` is missing.")
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "",
- ApiKey: "my-api-key",
- Requester: echo,
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.EqualError(t, err, "`appId` is missing.")
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "my-app-id",
- ApiKey: "",
- Requester: echo,
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.EqualError(t, err, "`apiKey` is missing.")
-}
-
-// switch API key
-func TestUsagesetClientApiKey0(t *testing.T) {
- var err error
- var res any
- _ = res
- echo := &tests.EchoRequester{}
- var client *usage.APIClient
- var cfg usage.UsageConfiguration
- _ = client
- _ = echo
- cfg = usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "test-app-id",
- ApiKey: "test-api-key",
- Hosts: []transport.StatefulHost{transport.NewStatefulHost("http", "localhost:6683", call.IsReadWrite)},
- },
- }
- client, err = usage.NewClientWithConfig(cfg)
- require.NoError(t, err)
- {
- res, err = client.CustomGet(client.NewApiCustomGetRequest(
- "check-api-key/1",
- ))
- require.NoError(t, err)
- rawBody, err := json.Marshal(res)
- require.NoError(t, err)
- require.JSONEq(t, `{"headerAPIKeyValue":"test-api-key"}`, string(rawBody))
- }
- {
- err = client.SetClientApiKey(
- "updated-api-key",
- )
- require.NoError(t, err)
- }
- {
- res, err = client.CustomGet(client.NewApiCustomGetRequest(
- "check-api-key/2",
- ))
- require.NoError(t, err)
- rawBody, err := json.Marshal(res)
- require.NoError(t, err)
- require.JSONEq(t, `{"headerAPIKeyValue":"updated-api-key"}`, string(rawBody))
- }
-}
diff --git a/tests/output/go/tests/requests/usage_test.go b/tests/output/go/tests/requests/usage_test.go
deleted file mode 100644
index e39a2e75ee..0000000000
--- a/tests/output/go/tests/requests/usage_test.go
+++ /dev/null
@@ -1,436 +0,0 @@
-// 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.
-package requests
-
-import (
- "encoding/json"
- "testing"
-
- "github.com/kinbiko/jsonassert"
- "github.com/stretchr/testify/require"
-
- "gotests/tests"
-
- "github.com/algolia/algoliasearch-client-go/v4/algolia/transport"
- "github.com/algolia/algoliasearch-client-go/v4/algolia/usage"
-)
-
-func createUsageClient(t *testing.T) (*usage.APIClient, *tests.EchoRequester) {
- t.Helper()
-
- echo := &tests.EchoRequester{}
- cfg := usage.UsageConfiguration{
- Configuration: transport.Configuration{
- AppID: "appID",
- ApiKey: "apiKey",
- Requester: echo,
- },
- }
- client, err := usage.NewClientWithConfig(cfg)
- require.NoError(t, err)
-
- return client, echo
-}
-
-func TestUsage_CustomDelete(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("allow del method for a custom path with minimal parameters", func(t *testing.T) {
- _, err := client.CustomDelete(client.NewApiCustomDeleteRequest(
- "test/minimal",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/test/minimal", echo.Path)
- require.Equal(t, "DELETE", echo.Method)
-
- require.Nil(t, echo.Body)
- })
- t.Run("allow del method for a custom path with all parameters", func(t *testing.T) {
- _, err := client.CustomDelete(client.NewApiCustomDeleteRequest(
- "test/all",
- ).WithParameters(map[string]any{"query": "parameters"}))
- require.NoError(t, err)
-
- require.Equal(t, "/test/all", echo.Path)
- require.Equal(t, "DELETE", echo.Method)
-
- require.Nil(t, echo.Body)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
-
-func TestUsage_CustomGet(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("allow get method for a custom path with minimal parameters", func(t *testing.T) {
- _, err := client.CustomGet(client.NewApiCustomGetRequest(
- "test/minimal",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/test/minimal", echo.Path)
- require.Equal(t, "GET", echo.Method)
-
- require.Nil(t, echo.Body)
- })
- t.Run("allow get method for a custom path with all parameters", func(t *testing.T) {
- _, err := client.CustomGet(client.NewApiCustomGetRequest(
- "test/all",
- ).WithParameters(map[string]any{"query": "parameters with space"}))
- require.NoError(t, err)
-
- require.Equal(t, "/test/all", echo.Path)
- require.Equal(t, "GET", echo.Method)
-
- require.Nil(t, echo.Body)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters%20with%20space"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions should be escaped too", func(t *testing.T) {
- _, err := client.CustomGet(client.NewApiCustomGetRequest(
- "test/all",
- ).WithParameters(map[string]any{"query": "to be overriden"}),
- usage.WithQueryParam("query", "parameters with space"), usage.WithQueryParam("and an array",
- []string{"array", "with spaces"}), usage.WithHeaderParam("x-header-1", "spaces are left alone"),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/all", echo.Path)
- require.Equal(t, "GET", echo.Method)
-
- require.Nil(t, echo.Body)
- headers := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"x-header-1":"spaces are left alone"}`), &headers))
- for k, v := range headers {
- require.Equal(t, v, echo.Header.Get(k))
- }
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters%20with%20space","and%20an%20array":"array%2Cwith%20spaces"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
-
-func TestUsage_CustomPost(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("allow post method for a custom path with minimal parameters", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/minimal",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/test/minimal", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{}`)
- })
- t.Run("allow post method for a custom path with all parameters", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/all",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"body": "parameters"}))
- require.NoError(t, err)
-
- require.Equal(t, "/test/all", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"body":"parameters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions can override default query parameters", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("query", "myQueryParameter"),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"myQueryParameter"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions merges query parameters with default ones", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("query2", "myQueryParameter"),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","query2":"myQueryParameter"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions can override default headers", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithHeaderParam("x-algolia-api-key", "myApiKey"),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- headers := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"x-algolia-api-key":"myApiKey"}`), &headers))
- for k, v := range headers {
- require.Equal(t, v, echo.Header.Get(k))
- }
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions merges headers with default ones", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithHeaderParam("x-algolia-api-key", "myApiKey"),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- headers := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"x-algolia-api-key":"myApiKey"}`), &headers))
- for k, v := range headers {
- require.Equal(t, v, echo.Header.Get(k))
- }
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions queryParameters accepts booleans", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("isItWorking", true),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","isItWorking":"true"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions queryParameters accepts integers", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("myParam", 2),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","myParam":"2"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions queryParameters accepts list of string", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("myParam",
- []string{"b and c", "d"}),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","myParam":"b%20and%20c%2Cd"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions queryParameters accepts list of booleans", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("myParam",
- []bool{true, true, false}),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","myParam":"true%2Ctrue%2Cfalse"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
- t.Run("requestOptions queryParameters accepts list of integers", func(t *testing.T) {
- _, err := client.CustomPost(client.NewApiCustomPostRequest(
- "test/requestOptions",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"facet": "filters"}),
- usage.WithQueryParam("myParam",
- []int32{1, 2}),
- )
- require.NoError(t, err)
-
- require.Equal(t, "/test/requestOptions", echo.Path)
- require.Equal(t, "POST", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"facet":"filters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters","myParam":"1%2C2"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
-
-func TestUsage_CustomPut(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("allow put method for a custom path with minimal parameters", func(t *testing.T) {
- _, err := client.CustomPut(client.NewApiCustomPutRequest(
- "test/minimal",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/test/minimal", echo.Path)
- require.Equal(t, "PUT", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{}`)
- })
- t.Run("allow put method for a custom path with all parameters", func(t *testing.T) {
- _, err := client.CustomPut(client.NewApiCustomPutRequest(
- "test/all",
- ).WithParameters(map[string]any{"query": "parameters"}).WithBody(map[string]any{"body": "parameters"}))
- require.NoError(t, err)
-
- require.Equal(t, "/test/all", echo.Path)
- require.Equal(t, "PUT", echo.Method)
-
- ja := jsonassert.New(t)
- ja.Assertf(*echo.Body, `{"body":"parameters"}`)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"query":"parameters"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
-
-func TestUsage_GetIndexUsage(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("getIndexUsage with minimal parameters", func(t *testing.T) {
- _, err := client.GetIndexUsage(client.NewApiGetIndexUsageRequest(
- usage.Statistic("queries_operations"), "myIndexName", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/1/usage/queries_operations/myIndexName", echo.Path)
- require.Equal(t, "GET", echo.Method)
-
- require.Nil(t, echo.Body)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
-
-func TestUsage_GetUsage(t *testing.T) {
- client, echo := createUsageClient(t)
- _ = echo
-
- t.Run("getUsage with minimal parameters", func(t *testing.T) {
- _, err := client.GetUsage(client.NewApiGetUsageRequest(
- usage.Statistic("queries_operations"), "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z",
- ))
- require.NoError(t, err)
-
- require.Equal(t, "/1/usage/queries_operations", echo.Path)
- require.Equal(t, "GET", echo.Method)
-
- require.Nil(t, echo.Body)
- queryParams := map[string]string{}
- require.NoError(t, json.Unmarshal([]byte(`{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}`), &queryParams))
- require.Len(t, queryParams, len(echo.Query))
- for k, v := range queryParams {
- require.Equal(t, v, echo.Query.Get(k))
- }
- })
-}
diff --git a/tests/output/javascript/src/client/usage.test.ts b/tests/output/javascript/src/client/usage.test.ts
deleted file mode 100644
index 9d25949248..0000000000
--- a/tests/output/javascript/src/client/usage.test.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-// 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.
-/* eslint-disable @typescript-eslint/no-unused-vars, require-await, no-lone-blocks */
-// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines.
-import type { UsageClient } from '@algolia/client-usage';
-import { usageClient } from '@algolia/client-usage';
-import { nodeEchoRequester } from '@algolia/requester-testing';
-import type { EchoResponse } from '@algolia/requester-testing';
-
-const appId = 'test-app-id';
-const apiKey = 'test-api-key';
-
-function createClient(): UsageClient {
- return usageClient(appId, apiKey, { requester: nodeEchoRequester() });
-}
-
-describe('api', () => {
- test('calls api with correct read host', async () => {
- const client = usageClient('test-app-id', 'test-api-key', { requester: nodeEchoRequester() });
-
- const result = (await client.customGet({ path: 'test' })) as unknown as EchoResponse;
-
- expect(result.host).toEqual('usage.algolia.com');
- }, 15000);
-
- test('calls api with correct write host', async () => {
- const client = usageClient('test-app-id', 'test-api-key', { requester: nodeEchoRequester() });
-
- const result = (await client.customPost({ path: 'test' })) as unknown as EchoResponse;
-
- expect(result.host).toEqual('usage.algolia.com');
- }, 15000);
-});
-
-describe('commonApi', () => {
- test('calls api with correct user agent', async () => {
- const client = createClient();
-
- const result = (await client.customPost({ path: '1/test' })) as unknown as EchoResponse;
-
- expect(decodeURIComponent(result.algoliaAgent)).toMatch(
- /^Algolia for JavaScript \(\d+\.\d+\.\d+(-?.*)?\)(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*(; Usage (\(\d+\.\d+\.\d+(-?.*)?\)))(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*$/,
- );
- }, 15000);
-
- test('the user agent contains the latest version', async () => {
- const client = createClient();
-
- const result = (await client.customPost({ path: '1/test' })) as unknown as EchoResponse;
-
- expect(decodeURIComponent(result.algoliaAgent)).toMatch(/^Algolia for JavaScript \(1.4.0\).*/);
- }, 15000);
-
- test('calls api with default read timeouts', async () => {
- const client = createClient();
-
- const result = (await client.customGet({ path: '1/test' })) as unknown as EchoResponse;
-
- expect(result).toEqual(expect.objectContaining({ connectTimeout: 2000, responseTimeout: 5000 }));
- }, 15000);
-
- test('calls api with default write timeouts', async () => {
- const client = createClient();
-
- const result = (await client.customPost({ path: '1/test' })) as unknown as EchoResponse;
-
- expect(result).toEqual(expect.objectContaining({ connectTimeout: 2000, responseTimeout: 30000 }));
- }, 15000);
-});
-
-describe('parameters', () => {
- test('client throws with invalid parameters', async () => {
- try {
- const client = usageClient('', '', { requester: nodeEchoRequester() });
- throw new Error('test is expected to throw error');
- } catch (e) {
- expect((e as Error).message).toMatch('`appId` is missing.');
- }
- try {
- const client = usageClient('', 'my-api-key', { requester: nodeEchoRequester() });
- throw new Error('test is expected to throw error');
- } catch (e) {
- expect((e as Error).message).toMatch('`appId` is missing.');
- }
- try {
- const client = usageClient('my-app-id', '', { requester: nodeEchoRequester() });
- throw new Error('test is expected to throw error');
- } catch (e) {
- expect((e as Error).message).toMatch('`apiKey` is missing.');
- }
- }, 15000);
-});
-
-describe('setClientApiKey', () => {
- test('switch API key', async () => {
- const client = usageClient('test-app-id', 'test-api-key', {
- hosts: [{ url: 'localhost', port: 6683, accept: 'readWrite', protocol: 'http' }],
- });
-
- {
- const result = await client.customGet({ path: 'check-api-key/1' });
-
- expect(result).toEqual({ headerAPIKeyValue: 'test-api-key' });
- }
- {
- client.setClientApiKey({ apiKey: 'updated-api-key' });
- }
- {
- const result = await client.customGet({ path: 'check-api-key/2' });
-
- expect(result).toEqual({ headerAPIKeyValue: 'updated-api-key' });
- }
- }, 15000);
-});
-
-describe('init', () => {
- test('sets authMode', async () => {
- const qpClient = usageClient('foo', 'bar', {
- authMode: 'WithinQueryParameters',
- requester: nodeEchoRequester(),
- });
- const headerClient = usageClient('foo', 'bar', {
- authMode: 'WithinHeaders',
- requester: nodeEchoRequester(),
- });
-
- const qpResult = (await qpClient.customGet({
- path: '1/foo',
- })) as unknown as EchoResponse;
- expect(qpResult.searchParams).toEqual({
- 'x-algolia-api-key': 'bar',
- 'x-algolia-application-id': 'foo',
- });
-
- const headerResult = (await headerClient.customGet({
- path: '1/bar',
- })) as unknown as EchoResponse;
- expect(headerResult.headers).toEqual({
- accept: 'application/json',
- 'content-type': 'text/plain',
- 'x-algolia-api-key': 'bar',
- 'x-algolia-application-id': 'foo',
- });
- });
-});
diff --git a/tests/output/javascript/src/requests/usage.test.ts b/tests/output/javascript/src/requests/usage.test.ts
deleted file mode 100644
index a804c41d03..0000000000
--- a/tests/output/javascript/src/requests/usage.test.ts
+++ /dev/null
@@ -1,287 +0,0 @@
-// 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.
-import { usageClient } from '@algolia/client-usage';
-import { nodeEchoRequester } from '@algolia/requester-testing';
-import type { EchoResponse } from '@algolia/requester-testing';
-
-const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id';
-const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key';
-
-const client = usageClient(appId, apiKey, { requester: nodeEchoRequester() });
-
-describe('customDelete', () => {
- test('allow del method for a custom path with minimal parameters', async () => {
- const req = (await client.customDelete({ path: 'test/minimal' })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/minimal');
- expect(req.method).toEqual('DELETE');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual(undefined);
- });
-
- test('allow del method for a custom path with all parameters', async () => {
- const req = (await client.customDelete({
- path: 'test/all',
- parameters: { query: 'parameters' },
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/all');
- expect(req.method).toEqual('DELETE');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual({ query: 'parameters' });
- });
-});
-
-describe('customGet', () => {
- test('allow get method for a custom path with minimal parameters', async () => {
- const req = (await client.customGet({ path: 'test/minimal' })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/minimal');
- expect(req.method).toEqual('GET');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual(undefined);
- });
-
- test('allow get method for a custom path with all parameters', async () => {
- const req = (await client.customGet({
- path: 'test/all',
- parameters: { query: 'parameters with space' },
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/all');
- expect(req.method).toEqual('GET');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual({ query: 'parameters%20with%20space' });
- });
-
- test('requestOptions should be escaped too', async () => {
- const req = (await client.customGet(
- { path: 'test/all', parameters: { query: 'to be overriden' } },
- {
- queryParameters: { query: 'parameters with space', 'and an array': ['array', 'with spaces'] },
- headers: { 'x-header-1': 'spaces are left alone' },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/all');
- expect(req.method).toEqual('GET');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual({
- query: 'parameters%20with%20space',
- 'and%20an%20array': 'array%2Cwith%20spaces',
- });
- expect(req.headers).toEqual(expect.objectContaining({ 'x-header-1': 'spaces are left alone' }));
- });
-});
-
-describe('customPost', () => {
- test('allow post method for a custom path with minimal parameters', async () => {
- const req = (await client.customPost({ path: 'test/minimal' })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/minimal');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({});
- expect(req.searchParams).toStrictEqual(undefined);
- });
-
- test('allow post method for a custom path with all parameters', async () => {
- const req = (await client.customPost({
- path: 'test/all',
- parameters: { query: 'parameters' },
- body: { body: 'parameters' },
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/all');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ body: 'parameters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters' });
- });
-
- test('requestOptions can override default query parameters', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { query: 'myQueryParameter' },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'myQueryParameter' });
- });
-
- test('requestOptions merges query parameters with default ones', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { query2: 'myQueryParameter' },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', query2: 'myQueryParameter' });
- });
-
- test('requestOptions can override default headers', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- headers: { 'x-algolia-api-key': 'myApiKey' },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters' });
- expect(req.headers).toEqual(expect.objectContaining({ 'x-algolia-api-key': 'myApiKey' }));
- });
-
- test('requestOptions merges headers with default ones', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- headers: { 'x-algolia-api-key': 'myApiKey' },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters' });
- expect(req.headers).toEqual(expect.objectContaining({ 'x-algolia-api-key': 'myApiKey' }));
- });
-
- test('requestOptions queryParameters accepts booleans', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { isItWorking: true },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', isItWorking: 'true' });
- });
-
- test('requestOptions queryParameters accepts integers', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { myParam: 2 },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', myParam: '2' });
- });
-
- test('requestOptions queryParameters accepts list of string', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { myParam: ['b and c', 'd'] },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', myParam: 'b%20and%20c%2Cd' });
- });
-
- test('requestOptions queryParameters accepts list of booleans', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { myParam: [true, true, false] },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', myParam: 'true%2Ctrue%2Cfalse' });
- });
-
- test('requestOptions queryParameters accepts list of integers', async () => {
- const req = (await client.customPost(
- { path: 'test/requestOptions', parameters: { query: 'parameters' }, body: { facet: 'filters' } },
- {
- queryParameters: { myParam: [1, 2] },
- },
- )) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/requestOptions');
- expect(req.method).toEqual('POST');
- expect(req.data).toEqual({ facet: 'filters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters', myParam: '1%2C2' });
- });
-});
-
-describe('customPut', () => {
- test('allow put method for a custom path with minimal parameters', async () => {
- const req = (await client.customPut({ path: 'test/minimal' })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/minimal');
- expect(req.method).toEqual('PUT');
- expect(req.data).toEqual({});
- expect(req.searchParams).toStrictEqual(undefined);
- });
-
- test('allow put method for a custom path with all parameters', async () => {
- const req = (await client.customPut({
- path: 'test/all',
- parameters: { query: 'parameters' },
- body: { body: 'parameters' },
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/test/all');
- expect(req.method).toEqual('PUT');
- expect(req.data).toEqual({ body: 'parameters' });
- expect(req.searchParams).toStrictEqual({ query: 'parameters' });
- });
-});
-
-describe('getIndexUsage', () => {
- test('getIndexUsage with minimal parameters', async () => {
- const req = (await client.getIndexUsage({
- statistic: 'queries_operations',
- indexName: 'myIndexName',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/1/usage/queries_operations/myIndexName');
- expect(req.method).toEqual('GET');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual({
- startDate: '2024-04-03T12%3A46%3A43Z',
- endDate: '2024-04-05T12%3A46%3A43Z',
- });
- });
-});
-
-describe('getUsage', () => {
- test('getUsage with minimal parameters', async () => {
- const req = (await client.getUsage({
- statistic: 'queries_operations',
- startDate: '2024-04-03T12:46:43Z',
- endDate: '2024-04-05T12:46:43Z',
- })) as unknown as EchoResponse;
-
- expect(req.path).toEqual('/1/usage/queries_operations');
- expect(req.method).toEqual('GET');
- expect(req.data).toEqual(undefined);
- expect(req.searchParams).toStrictEqual({
- startDate: '2024-04-03T12%3A46%3A43Z',
- endDate: '2024-04-05T12%3A46%3A43Z',
- });
- });
-});
diff --git a/tests/output/python/tests/client/usage_test.py b/tests/output/python/tests/client/usage_test.py
deleted file mode 100644
index dfb05904ba..0000000000
--- a/tests/output/python/tests/client/usage_test.py
+++ /dev/null
@@ -1,310 +0,0 @@
-# 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 re import compile
-from json import loads
-
-from algoliasearch.http.transporter import EchoTransporter
-from algoliasearch.http.transporter_sync import EchoTransporterSync
-from algoliasearch.http.hosts import Host, HostsCollection
-from algoliasearch.usage.client import UsageClient
-from algoliasearch.usage.client import UsageClientSync
-from algoliasearch.usage.config import UsageConfig
-
-
-class TestUsageClient:
- def create_client(self) -> UsageClient:
- _config = UsageConfig("appId", "apiKey")
- return UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
-
- async def test_api_0(self):
- """
- calls api with correct read host
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
- _req = await _client.custom_get_with_http_info(
- path="test",
- )
- assert _req.host == "usage.algolia.com"
-
- async def test_api_1(self):
- """
- calls api with correct write host
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
- _req = await _client.custom_post_with_http_info(
- path="test",
- )
- assert _req.host == "usage.algolia.com"
-
- async def test_common_api_0(self):
- """
- calls api with correct user agent
- """
- _client = self.create_client()
-
- _req = await _client.custom_post_with_http_info(
- path="1/test",
- )
- regex_user_agent = compile(
- "^Algolia for Python \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$"
- )
- assert regex_user_agent.match(_req.headers.get("user-agent")) is not None
-
- async def test_common_api_1(self):
- """
- the user agent contains the latest version
- """
- _client = self.create_client()
-
- _req = await _client.custom_post_with_http_info(
- path="1/test",
- )
- regex_user_agent = compile("^Algolia for Python \\(4.4.0\\).*")
- assert regex_user_agent.match(_req.headers.get("user-agent")) is not None
-
- async def test_common_api_2(self):
- """
- calls api with default read timeouts
- """
- _client = self.create_client()
-
- _req = await _client.custom_get_with_http_info(
- path="1/test",
- )
- assert _req.timeouts.get("connect") == 2000
- assert _req.timeouts.get("response") == 5000
-
- async def test_common_api_3(self):
- """
- calls api with default write timeouts
- """
- _client = self.create_client()
-
- _req = await _client.custom_post_with_http_info(
- path="1/test",
- )
- assert _req.timeouts.get("connect") == 2000
- assert _req.timeouts.get("response") == 30000
-
- async def test_parameters_0(self):
- """
- client throws with invalid parameters
- """
-
- try:
- _config = UsageConfig("", "")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`app_id` is missing."
- try:
- _config = UsageConfig("", "my-api-key")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`app_id` is missing."
- try:
- _config = UsageConfig("my-app-id", "")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`api_key` is missing."
-
- async def test_set_client_api_key_0(self):
- """
- switch API key
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _config.hosts = HostsCollection(
- [Host(url="localhost", scheme="http", port=6683)]
- )
- _client = UsageClient.create_with_config(config=_config)
- _req = await _client.custom_get(
- path="check-api-key/1",
- )
- assert (
- _req
- if isinstance(_req, dict)
- else [elem.to_dict() for elem in _req]
- if isinstance(_req, list)
- else _req.to_dict()
- ) == loads("""{"headerAPIKeyValue":"test-api-key"}""")
- await _client.set_client_api_key(
- api_key="updated-api-key",
- )
- _req = await _client.custom_get(
- path="check-api-key/2",
- )
- assert (
- _req
- if isinstance(_req, dict)
- else [elem.to_dict() for elem in _req]
- if isinstance(_req, list)
- else _req.to_dict()
- ) == loads("""{"headerAPIKeyValue":"updated-api-key"}""")
-
-
-class TestUsageClientSync:
- def create_client(self) -> UsageClientSync:
- _config = UsageConfig("appId", "apiKey")
- return UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
-
- def test_api_0(self):
- """
- calls api with correct read host
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
- _req = _client.custom_get_with_http_info(
- path="test",
- )
- assert _req.host == "usage.algolia.com"
-
- def test_api_1(self):
- """
- calls api with correct write host
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
- _req = _client.custom_post_with_http_info(
- path="test",
- )
- assert _req.host == "usage.algolia.com"
-
- def test_common_api_0(self):
- """
- calls api with correct user agent
- """
- _client = self.create_client()
-
- _req = _client.custom_post_with_http_info(
- path="1/test",
- )
- regex_user_agent = compile(
- "^Algolia for Python \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$"
- )
- assert regex_user_agent.match(_req.headers.get("user-agent")) is not None
-
- def test_common_api_1(self):
- """
- the user agent contains the latest version
- """
- _client = self.create_client()
-
- _req = _client.custom_post_with_http_info(
- path="1/test",
- )
- regex_user_agent = compile("^Algolia for Python \\(4.4.0\\).*")
- assert regex_user_agent.match(_req.headers.get("user-agent")) is not None
-
- def test_common_api_2(self):
- """
- calls api with default read timeouts
- """
- _client = self.create_client()
-
- _req = _client.custom_get_with_http_info(
- path="1/test",
- )
- assert _req.timeouts.get("connect") == 2000
- assert _req.timeouts.get("response") == 5000
-
- def test_common_api_3(self):
- """
- calls api with default write timeouts
- """
- _client = self.create_client()
-
- _req = _client.custom_post_with_http_info(
- path="1/test",
- )
- assert _req.timeouts.get("connect") == 2000
- assert _req.timeouts.get("response") == 30000
-
- def test_parameters_0(self):
- """
- client throws with invalid parameters
- """
-
- try:
- _config = UsageConfig("", "")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`app_id` is missing."
- try:
- _config = UsageConfig("", "my-api-key")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`app_id` is missing."
- try:
- _config = UsageConfig("my-app-id", "")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
- assert False
- except (ValueError, Exception) as e:
- assert str(e) == "`api_key` is missing."
-
- def test_set_client_api_key_0(self):
- """
- switch API key
- """
-
- _config = UsageConfig("test-app-id", "test-api-key")
- _config.hosts = HostsCollection(
- [Host(url="localhost", scheme="http", port=6683)]
- )
- _client = UsageClientSync.create_with_config(config=_config)
- _req = _client.custom_get(
- path="check-api-key/1",
- )
- assert (
- _req
- if isinstance(_req, dict)
- else [elem.to_dict() for elem in _req]
- if isinstance(_req, list)
- else _req.to_dict()
- ) == loads("""{"headerAPIKeyValue":"test-api-key"}""")
- _client.set_client_api_key(
- api_key="updated-api-key",
- )
- _req = _client.custom_get(
- path="check-api-key/2",
- )
- assert (
- _req
- if isinstance(_req, dict)
- else [elem.to_dict() for elem in _req]
- if isinstance(_req, list)
- else _req.to_dict()
- ) == loads("""{"headerAPIKeyValue":"updated-api-key"}""")
diff --git a/tests/output/python/tests/requests/usage_test.py b/tests/output/python/tests/requests/usage_test.py
deleted file mode 100644
index 5697f0415c..0000000000
--- a/tests/output/python/tests/requests/usage_test.py
+++ /dev/null
@@ -1,885 +0,0 @@
-# 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 json import loads
-from algoliasearch.http.transporter import EchoTransporter
-from algoliasearch.http.transporter_sync import EchoTransporterSync
-from algoliasearch.usage.client import UsageClient
-from algoliasearch.usage.client import UsageClientSync
-from algoliasearch.usage.config import UsageConfig
-
-
-class TestUsageClient:
- _config = UsageConfig("test_app_id", "test_api_key")
- _client = UsageClient.create_with_config(
- config=_config, transporter=EchoTransporter(_config)
- )
-
- async def test_custom_delete_(self):
- """
- allow del method for a custom path with minimal parameters
- """
- _req = await self._client.custom_delete_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "DELETE"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- async def test_custom_delete_1(self):
- """
- allow del method for a custom path with all parameters
- """
- _req = await self._client.custom_delete_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "DELETE"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- async def test_custom_get_(self):
- """
- allow get method for a custom path with minimal parameters
- """
- _req = await self._client.custom_get_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "GET"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- async def test_custom_get_1(self):
- """
- allow get method for a custom path with all parameters
- """
- _req = await self._client.custom_get_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters with space",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters%20with%20space"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- async def test_custom_get_2(self):
- """
- requestOptions should be escaped too
- """
- _req = await self._client.custom_get_with_http_info(
- path="test/all",
- parameters={
- "query": "to be overriden",
- },
- request_options={
- "headers": loads("""{"x-header-1":"spaces are left alone"}"""),
- "query_parameters": loads(
- """{"query":"parameters with space","and an array":["array","with spaces"]}"""
- ),
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "query": "parameters%20with%20space",
- "and%20an%20array": "array%2Cwith%20spaces",
- }.items()
- )
- assert _req.headers.items() >= {"x-header-1": "spaces are left alone"}.items()
- assert _req.data is None
-
- async def test_custom_post_(self):
- """
- allow post method for a custom path with minimal parameters
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{}""")
-
- async def test_custom_post_1(self):
- """
- allow post method for a custom path with all parameters
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- body={
- "body": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"body":"parameters"}""")
-
- async def test_custom_post_2(self):
- """
- requestOptions can override default query parameters
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"query":"myQueryParameter"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "myQueryParameter"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_3(self):
- """
- requestOptions merges query parameters with default ones
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"query2":"myQueryParameter"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "query2": "myQueryParameter"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_4(self):
- """
- requestOptions can override default headers
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "headers": loads("""{"x-algolia-api-key":"myApiKey"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {"x-algolia-api-key": "myApiKey"}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_5(self):
- """
- requestOptions merges headers with default ones
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "headers": loads("""{"x-algolia-api-key":"myApiKey"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {"x-algolia-api-key": "myApiKey"}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_6(self):
- """
- requestOptions queryParameters accepts booleans
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"isItWorking":true}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "isItWorking": "true"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_7(self):
- """
- requestOptions queryParameters accepts integers
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":2}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "2"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_8(self):
- """
- requestOptions queryParameters accepts list of string
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":["b and c","d"]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "b%20and%20c%2Cd"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_9(self):
- """
- requestOptions queryParameters accepts list of booleans
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":[true,true,false]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "true%2Ctrue%2Cfalse"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_post_10(self):
- """
- requestOptions queryParameters accepts list of integers
- """
- _req = await self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":[1,2]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "1%2C2"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- async def test_custom_put_(self):
- """
- allow put method for a custom path with minimal parameters
- """
- _req = await self._client.custom_put_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "PUT"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{}""")
-
- async def test_custom_put_1(self):
- """
- allow put method for a custom path with all parameters
- """
- _req = await self._client.custom_put_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- body={
- "body": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "PUT"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"body":"parameters"}""")
-
- async def test_get_index_usage_(self):
- """
- getIndexUsage with minimal parameters
- """
- _req = await self._client.get_index_usage_with_http_info(
- statistic="queries_operations",
- index_name="myIndexName",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- assert _req.path == "/1/usage/queries_operations/myIndexName"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z",
- }.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- async def test_get_usage_(self):
- """
- getUsage with minimal parameters
- """
- _req = await self._client.get_usage_with_http_info(
- statistic="queries_operations",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- assert _req.path == "/1/usage/queries_operations"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z",
- }.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
-
-class TestUsageClientSync:
- _config = UsageConfig("test_app_id", "test_api_key")
- _client = UsageClientSync.create_with_config(
- config=_config, transporter=EchoTransporterSync(_config)
- )
-
- def test_custom_delete_(self):
- """
- allow del method for a custom path with minimal parameters
- """
- _req = self._client.custom_delete_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "DELETE"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- def test_custom_delete_1(self):
- """
- allow del method for a custom path with all parameters
- """
- _req = self._client.custom_delete_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "DELETE"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- def test_custom_get_(self):
- """
- allow get method for a custom path with minimal parameters
- """
- _req = self._client.custom_get_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "GET"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- def test_custom_get_1(self):
- """
- allow get method for a custom path with all parameters
- """
- _req = self._client.custom_get_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters with space",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters%20with%20space"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- def test_custom_get_2(self):
- """
- requestOptions should be escaped too
- """
- _req = self._client.custom_get_with_http_info(
- path="test/all",
- parameters={
- "query": "to be overriden",
- },
- request_options={
- "headers": loads("""{"x-header-1":"spaces are left alone"}"""),
- "query_parameters": loads(
- """{"query":"parameters with space","and an array":["array","with spaces"]}"""
- ),
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "query": "parameters%20with%20space",
- "and%20an%20array": "array%2Cwith%20spaces",
- }.items()
- )
- assert _req.headers.items() >= {"x-header-1": "spaces are left alone"}.items()
- assert _req.data is None
-
- def test_custom_post_(self):
- """
- allow post method for a custom path with minimal parameters
- """
- _req = self._client.custom_post_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{}""")
-
- def test_custom_post_1(self):
- """
- allow post method for a custom path with all parameters
- """
- _req = self._client.custom_post_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- body={
- "body": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"body":"parameters"}""")
-
- def test_custom_post_2(self):
- """
- requestOptions can override default query parameters
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"query":"myQueryParameter"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "myQueryParameter"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_3(self):
- """
- requestOptions merges query parameters with default ones
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"query2":"myQueryParameter"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "query2": "myQueryParameter"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_4(self):
- """
- requestOptions can override default headers
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "headers": loads("""{"x-algolia-api-key":"myApiKey"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {"x-algolia-api-key": "myApiKey"}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_5(self):
- """
- requestOptions merges headers with default ones
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "headers": loads("""{"x-algolia-api-key":"myApiKey"}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {"x-algolia-api-key": "myApiKey"}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_6(self):
- """
- requestOptions queryParameters accepts booleans
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"isItWorking":true}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "isItWorking": "true"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_7(self):
- """
- requestOptions queryParameters accepts integers
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":2}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "2"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_8(self):
- """
- requestOptions queryParameters accepts list of string
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":["b and c","d"]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "b%20and%20c%2Cd"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_9(self):
- """
- requestOptions queryParameters accepts list of booleans
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":[true,true,false]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "true%2Ctrue%2Cfalse"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_post_10(self):
- """
- requestOptions queryParameters accepts list of integers
- """
- _req = self._client.custom_post_with_http_info(
- path="test/requestOptions",
- parameters={
- "query": "parameters",
- },
- body={
- "facet": "filters",
- },
- request_options={
- "query_parameters": loads("""{"myParam":[1,2]}"""),
- },
- )
-
- assert _req.path == "/test/requestOptions"
- assert _req.verb == "POST"
- assert (
- _req.query_parameters.items()
- == {"query": "parameters", "myParam": "1%2C2"}.items()
- )
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"facet":"filters"}""")
-
- def test_custom_put_(self):
- """
- allow put method for a custom path with minimal parameters
- """
- _req = self._client.custom_put_with_http_info(
- path="test/minimal",
- )
-
- assert _req.path == "/test/minimal"
- assert _req.verb == "PUT"
- assert _req.query_parameters.items() == {}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{}""")
-
- def test_custom_put_1(self):
- """
- allow put method for a custom path with all parameters
- """
- _req = self._client.custom_put_with_http_info(
- path="test/all",
- parameters={
- "query": "parameters",
- },
- body={
- "body": "parameters",
- },
- )
-
- assert _req.path == "/test/all"
- assert _req.verb == "PUT"
- assert _req.query_parameters.items() == {"query": "parameters"}.items()
- assert _req.headers.items() >= {}.items()
- assert loads(_req.data) == loads("""{"body":"parameters"}""")
-
- def test_get_index_usage_(self):
- """
- getIndexUsage with minimal parameters
- """
- _req = self._client.get_index_usage_with_http_info(
- statistic="queries_operations",
- index_name="myIndexName",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- assert _req.path == "/1/usage/queries_operations/myIndexName"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z",
- }.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
-
- def test_get_usage_(self):
- """
- getUsage with minimal parameters
- """
- _req = self._client.get_usage_with_http_info(
- statistic="queries_operations",
- start_date="2024-04-03T12:46:43Z",
- end_date="2024-04-05T12:46:43Z",
- )
-
- assert _req.path == "/1/usage/queries_operations"
- assert _req.verb == "GET"
- assert (
- _req.query_parameters.items()
- == {
- "startDate": "2024-04-03T12%3A46%3A43Z",
- "endDate": "2024-04-05T12%3A46%3A43Z",
- }.items()
- )
- assert _req.headers.items() >= {}.items()
- assert _req.data is None
diff --git a/tests/output/ruby/test/client/usage_test.rb b/tests/output/ruby/test/client/usage_test.rb
deleted file mode 100644
index ebe140e696..0000000000
--- a/tests/output/ruby/test/client/usage_test.rb
+++ /dev/null
@@ -1,153 +0,0 @@
-# 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.
-require "algolia"
-require "test/unit"
-
-class TestClientUsageClient < Test::Unit::TestCase
- include Algolia::Usage
- # calls api with correct read host
- def test_api0
-
- client = Algolia::UsageClient.create(
- "test-app-id",
- "test-api-key",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_get_with_http_info("test")
- assert_equal("usage.algolia.com", req.host.url)
- end
-
- # calls api with correct write host
- def test_api1
-
- client = Algolia::UsageClient.create(
- "test-app-id",
- "test-api-key",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_post_with_http_info("test")
- assert_equal("usage.algolia.com", req.host.url)
- end
-
- # calls api with correct user agent
- def test_common_api0
- client = Algolia::UsageClient.create(
- "APP_ID",
- "API_KEY",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_post_with_http_info("1/test")
- assert(
- req.headers["user-agent"].match(
- /^Algolia for Ruby \(\d+\.\d+\.\d+(-?.*)?\)(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*(; Usage (\(\d+\.\d+\.\d+(-?.*)?\)))(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*$/
- )
- )
- end
-
- # the user agent contains the latest version
- def test_common_api1
- client = Algolia::UsageClient.create(
- "APP_ID",
- "API_KEY",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_post_with_http_info("1/test")
- assert(req.headers["user-agent"].match(/^Algolia for Ruby \(3.3.0\).*/))
- end
-
- # calls api with default read timeouts
- def test_common_api2
- client = Algolia::UsageClient.create(
- "APP_ID",
- "API_KEY",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_get_with_http_info("1/test")
- assert_equal(2000, req.connect_timeout)
- assert_equal(5000, req.timeout)
- end
-
- # calls api with default write timeouts
- def test_common_api3
- client = Algolia::UsageClient.create(
- "APP_ID",
- "API_KEY",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- req = client.custom_post_with_http_info("1/test")
- assert_equal(2000, req.connect_timeout)
- assert_equal(30000, req.timeout)
- end
-
- # client throws with invalid parameters
- def test_parameters0
- begin
-
- Algolia::UsageClient.create(
- "",
- "",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- assert(false, "An error should have been raised")
- rescue => e
- assert_equal("`app_id` is missing.", e.message)
- end
-
- begin
-
- Algolia::UsageClient.create(
- "",
- "my-api-key",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- assert(false, "An error should have been raised")
- rescue => e
- assert_equal("`app_id` is missing.", e.message)
- end
-
- begin
-
- Algolia::UsageClient.create(
- "my-app-id",
- "",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- assert(false, "An error should have been raised")
- rescue => e
- assert_equal("`api_key` is missing.", e.message)
- end
- end
-
- # switch API key
- def test_set_client_api_key0
- client = Algolia::UsageClient.create_with_config(
- Algolia::Configuration.new(
- "test-app-id",
- "test-api-key",
- [
- Algolia::Transport::StatefulHost.new(
- "localhost",
- protocol: "http://",
- port: 6683,
- accept: CallType::READ | CallType::WRITE
- )
- ],
- "usageClient"
- )
- )
- req = client.custom_get("check-api-key/1")
- assert_equal({:"headerAPIKeyValue" => "test-api-key"}, req.is_a?(Array) ? req.map(&:to_hash) : req.to_hash)
- client.set_client_api_key("updated-api-key")
- req = client.custom_get("check-api-key/2")
- assert_equal({:"headerAPIKeyValue" => "updated-api-key"}, req.is_a?(Array) ? req.map(&:to_hash) : req.to_hash)
- end
-
-end
diff --git a/tests/output/ruby/test/requests/usage_test.rb b/tests/output/ruby/test/requests/usage_test.rb
deleted file mode 100644
index 2a976cc5e7..0000000000
--- a/tests/output/ruby/test/requests/usage_test.rb
+++ /dev/null
@@ -1,321 +0,0 @@
-# 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.
-require "algolia"
-require "test/unit"
-
-class TestUsageClient < Test::Unit::TestCase
- include Algolia::Usage
- def setup
- @client = Algolia::UsageClient.create(
- "APP_ID",
- "API_KEY",
-
- {requester: Algolia::Transport::EchoRequester.new}
- )
- end
-
- # allow del method for a custom path with minimal parameters
- def test_custom_delete
- req = @client.custom_delete_with_http_info("test/minimal")
-
- assert_equal(:delete, req.method)
- assert_equal("/test/minimal", req.path)
- assert_equal({}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # allow del method for a custom path with all parameters
- def test_custom_delete1
- req = @client.custom_delete_with_http_info("test/all", {query: "parameters"})
-
- assert_equal(:delete, req.method)
- assert_equal("/test/all", req.path)
- assert_equal({:"query" => "parameters"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # allow get method for a custom path with minimal parameters
- def test_custom_get
- req = @client.custom_get_with_http_info("test/minimal")
-
- assert_equal(:get, req.method)
- assert_equal("/test/minimal", req.path)
- assert_equal({}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # allow get method for a custom path with all parameters
- def test_custom_get1
- req = @client.custom_get_with_http_info("test/all", {query: "parameters with space"})
-
- assert_equal(:get, req.method)
- assert_equal("/test/all", req.path)
- assert_equal({:"query" => "parameters%20with%20space"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # requestOptions should be escaped too
- def test_custom_get2
- req = @client.custom_get_with_http_info(
- "test/all",
- {query: "to be overriden"},
- {
- :header_params => JSON.parse("{\"x-header-1\":\"spaces are left alone\"}", :symbolize_names => true),
- :query_params => JSON.parse(
- "{\"query\":\"parameters with space\",\"and an array\":[\"array\",\"with spaces\"]}",
- :symbolize_names => true
- )
- }
- )
-
- assert_equal(:get, req.method)
- assert_equal("/test/all", req.path)
- assert_equal(
- {:"query" => "parameters%20with%20space", :"and%20an%20array" => "array%2Cwith%20spaces"}.to_a,
- req.query_params.to_a
- )
- assert(
- ({:"x-header-1" => "spaces are left alone"}.transform_keys(&:to_s).to_a - req.headers.to_a).empty?,
- req.headers.to_s
- )
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # allow post method for a custom path with minimal parameters
- def test_custom_post
- req = @client.custom_post_with_http_info("test/minimal")
-
- assert_equal(:post, req.method)
- assert_equal("/test/minimal", req.path)
- assert_equal({}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{}"), JSON.parse(req.body))
- end
-
- # allow post method for a custom path with all parameters
- def test_custom_post1
- req = @client.custom_post_with_http_info("test/all", {query: "parameters"}, {body: "parameters"})
-
- assert_equal(:post, req.method)
- assert_equal("/test/all", req.path)
- assert_equal({:"query" => "parameters"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"body\":\"parameters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions can override default query parameters
- def test_custom_post2
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"query\":\"myQueryParameter\"}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "myQueryParameter"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions merges query parameters with default ones
- def test_custom_post3
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"query2\":\"myQueryParameter\"}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"query2" => "myQueryParameter"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions can override default headers
- def test_custom_post4
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:header_params => JSON.parse("{\"x-algolia-api-key\":\"myApiKey\"}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters"}.to_a, req.query_params.to_a)
- assert(
- ({:"x-algolia-api-key" => "myApiKey"}.transform_keys(&:to_s).to_a - req.headers.to_a).empty?,
- req.headers.to_s
- )
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions merges headers with default ones
- def test_custom_post5
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:header_params => JSON.parse("{\"x-algolia-api-key\":\"myApiKey\"}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters"}.to_a, req.query_params.to_a)
- assert(
- ({:"x-algolia-api-key" => "myApiKey"}.transform_keys(&:to_s).to_a - req.headers.to_a).empty?,
- req.headers.to_s
- )
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions queryParameters accepts booleans
- def test_custom_post6
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"isItWorking\":true}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"isItWorking" => "true"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions queryParameters accepts integers
- def test_custom_post7
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"myParam\":2}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"myParam" => "2"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions queryParameters accepts list of string
- def test_custom_post8
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"myParam\":[\"b and c\",\"d\"]}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"myParam" => "b%20and%20c%2Cd"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions queryParameters accepts list of booleans
- def test_custom_post9
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"myParam\":[true,true,false]}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"myParam" => "true%2Ctrue%2Cfalse"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # requestOptions queryParameters accepts list of integers
- def test_custom_post10
- req = @client.custom_post_with_http_info(
- "test/requestOptions",
- {query: "parameters"},
- {facet: "filters"},
- {:query_params => JSON.parse("{\"myParam\":[1,2]}", :symbolize_names => true)}
- )
-
- assert_equal(:post, req.method)
- assert_equal("/test/requestOptions", req.path)
- assert_equal({:"query" => "parameters", :"myParam" => "1%2C2"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"facet\":\"filters\"}"), JSON.parse(req.body))
- end
-
- # allow put method for a custom path with minimal parameters
- def test_custom_put
- req = @client.custom_put_with_http_info("test/minimal")
-
- assert_equal(:put, req.method)
- assert_equal("/test/minimal", req.path)
- assert_equal({}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{}"), JSON.parse(req.body))
- end
-
- # allow put method for a custom path with all parameters
- def test_custom_put1
- req = @client.custom_put_with_http_info("test/all", {query: "parameters"}, {body: "parameters"})
-
- assert_equal(:put, req.method)
- assert_equal("/test/all", req.path)
- assert_equal({:"query" => "parameters"}.to_a, req.query_params.to_a)
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
- assert_equal(JSON.parse("{\"body\":\"parameters\"}"), JSON.parse(req.body))
- end
-
- # getIndexUsage with minimal parameters
- def test_get_index_usage
- req = @client.get_index_usage_with_http_info(
- "queries_operations",
- "myIndexName",
- "2024-04-03T12:46:43Z",
- "2024-04-05T12:46:43Z"
- )
-
- assert_equal(:get, req.method)
- assert_equal("/1/usage/queries_operations/myIndexName", req.path)
- assert_equal(
- {:"startDate" => "2024-04-03T12%3A46%3A43Z", :"endDate" => "2024-04-05T12%3A46%3A43Z"}.to_a,
- req.query_params.to_a
- )
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
- # getUsage with minimal parameters
- def test_get_usage
- req = @client.get_usage_with_http_info("queries_operations", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z")
-
- assert_equal(:get, req.method)
- assert_equal("/1/usage/queries_operations", req.path)
- assert_equal(
- {:"startDate" => "2024-04-03T12%3A46%3A43Z", :"endDate" => "2024-04-05T12%3A46%3A43Z"}.to_a,
- req.query_params.to_a
- )
- assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
-
- assert(req.body.nil?, "body is not nil")
- end
-
-end
From 4fda204a23389ec1852ef95f2642f70b4e1ef993 Mon Sep 17 00:00:00 2001
From: shortcuts
Date: Wed, 11 Sep 2024 16:11:31 +0200
Subject: [PATCH 5/9] chore: usage
---
.github/ISSUE_TEMPLATE/Bug_report.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/ISSUE_TEMPLATE/Bug_report.yml b/.github/ISSUE_TEMPLATE/Bug_report.yml
index f9e1951210..5e850cbd08 100644
--- a/.github/ISSUE_TEMPLATE/Bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/Bug_report.yml
@@ -55,7 +55,6 @@ body:
- Query-Suggestions
- Recommend
- Search
- - Usage
- Crawler
validations:
required: true
From 68309ed7fbec639580ed2a22e78d5aacf8e3899e Mon Sep 17 00:00:00 2001
From: shortcuts
Date: Wed, 11 Sep 2024 16:12:17 +0200
Subject: [PATCH 6/9] chore: more
---
.../algoliasearch/Clients/UsageClient.cs | 415 ---
.../Clients/UsageConfiguration.cs | 48 -
.../algoliasearch/Models/Usage/ErrorBase.cs | 101 -
.../algoliasearch/Models/Usage/ErrorItem.cs | 125 -
.../Models/Usage/ForbiddenError.cs | 112 -
.../algoliasearch/Models/Usage/Granularity.cs | 31 -
.../algoliasearch/Models/Usage/IndexUsage.cs | 88 -
.../Models/Usage/InvalidRequestError.cs | 112 -
.../algoliasearch/Models/Usage/Statistic.cs | 523 ----
.../Models/Usage/StatisticEntry.cs | 98 -
.../Models/Usage/StatisticValue.cs | 210 --
.../java/com/algolia/api/UsageClient.java | 2685 -----------------
.../com/algolia/client/api/UsageClient.kt | 170 --
.../lib/Configuration/UsageConfig.php | 10 -
.../lib/Model/Usage/ErrorBase.php | 226 --
.../lib/Model/Usage/ErrorItem.php | 326 --
.../lib/Model/Usage/ForbiddenError.php | 288 --
.../lib/Model/Usage/Granularity.php | 33 -
.../lib/Model/Usage/IndexUsage.php | 224 --
.../lib/Model/Usage/InvalidRequestError.php | 288 --
.../lib/Model/Usage/Statistic.php | 279 --
.../lib/Model/Usage/StatisticEntry.php | 256 --
.../lib/Model/Usage/StatisticValue.php | 188 --
.../scala/algoliasearch/api/UsageClient.scala | 405 ---
.../java/src/test/java/com/algolia/Usage.java | 108 -
snippets/scala/src/main/scala/Usage.scala | 144 -
snippets/swift/Sources/Usage.swift | 116 -
.../csharp/src/generated/client/Usage.test.cs | 163 -
.../src/generated/requests/Usage.test.cs | 576 ----
.../java/com/algolia/client/Usage.test.java | 176 --
.../java/com/algolia/requests/Usage.test.java | 715 -----
.../kotlin/com/algolia/client/UsageTest.kt | 164 -
.../kotlin/com/algolia/requests/UsageTest.kt | 510 ----
tests/output/php/src/client/UsageTest.php | 216 --
tests/output/php/src/requests/UsageTest.php | 554 ----
.../algoliasearch/client/UsageTest.scala | 171 --
.../algoliasearch/requests/UsageTest.scala | 572 ----
.../swift/Tests/client/UsageTests.swift | 175 --
.../swift/Tests/requests/UsageTests.swift | 755 -----
39 files changed, 12356 deletions(-)
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageClient.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageConfiguration.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorBase.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorItem.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ForbiddenError.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Granularity.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/IndexUsage.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/InvalidRequestError.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Statistic.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticEntry.cs
delete mode 100644 clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticValue.cs
delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/UsageClient.java
delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/UsageClient.kt
delete mode 100644 clients/algoliasearch-client-php/lib/Configuration/UsageConfig.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/ErrorBase.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/ErrorItem.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/ForbiddenError.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/Granularity.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/IndexUsage.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/InvalidRequestError.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/Statistic.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/StatisticEntry.php
delete mode 100644 clients/algoliasearch-client-php/lib/Model/Usage/StatisticValue.php
delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/UsageClient.scala
delete mode 100644 snippets/java/src/test/java/com/algolia/Usage.java
delete mode 100644 snippets/scala/src/main/scala/Usage.scala
delete mode 100644 snippets/swift/Sources/Usage.swift
delete mode 100644 tests/output/csharp/src/generated/client/Usage.test.cs
delete mode 100644 tests/output/csharp/src/generated/requests/Usage.test.cs
delete mode 100644 tests/output/java/src/test/java/com/algolia/client/Usage.test.java
delete mode 100644 tests/output/java/src/test/java/com/algolia/requests/Usage.test.java
delete mode 100644 tests/output/kotlin/src/commonTest/kotlin/com/algolia/client/UsageTest.kt
delete mode 100644 tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/UsageTest.kt
delete mode 100644 tests/output/php/src/client/UsageTest.php
delete mode 100644 tests/output/php/src/requests/UsageTest.php
delete mode 100644 tests/output/scala/src/test/scala/algoliasearch/client/UsageTest.scala
delete mode 100644 tests/output/scala/src/test/scala/algoliasearch/requests/UsageTest.scala
delete mode 100644 tests/output/swift/Tests/client/UsageTests.swift
delete mode 100644 tests/output/swift/Tests/requests/UsageTests.swift
diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageClient.cs b/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageClient.cs
deleted file mode 100644
index bbc7df7b0d..0000000000
--- a/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageClient.cs
+++ /dev/null
@@ -1,415 +0,0 @@
-//
-// 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.
-//
-using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
-using Algolia.Search.Models.Usage;
-using Algolia.Search.Transport;
-using Algolia.Search.Http;
-using Algolia.Search.Utils;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Abstractions;
-
-namespace Algolia.Search.Clients;
-
-
-///
-/// Represents a collection of functions to interact with the API endpoints
-///
-public interface IUsageClient
-{
- ///
- /// This method allow you to send requests to the Algolia REST API.
- ///
- /// Path of the endpoint, anything after \"/1\" must be specified.
- /// Query parameters to apply to the current query. (optional)
- /// Add extra http header or query parameters to Algolia.
- /// Cancellation Token to cancel the request.
- /// Thrown when arguments are not correct
- /// Thrown when the API call was rejected by Algolia
- /// Thrown when the client failed to call the endpoint
- /// Task of object
- Task