From 3a4867b082b65cbadaff4549c0490a1f4d807f67 Mon Sep 17 00:00:00 2001 From: Kai Welke Date: Wed, 11 Sep 2024 15:12:56 +0200 Subject: [PATCH 1/9] fix(specs): tag group for usage api --- specs/usage/spec.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/usage/spec.yml b/specs/usage/spec.yml index 70c21f0645..deddb3c7e1 100644 --- a/specs/usage/spec.yml +++ b/specs/usage/spec.yml @@ -49,6 +49,10 @@ 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 ### From 622fb7f35e807de43b5720e8a7d02724436f78ee Mon Sep 17 00:00:00 2001 From: shortcuts Date: Wed, 11 Sep 2024 15:23:47 +0200 Subject: [PATCH 2/9] chore: global change? --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 71dc85a968..89d23741e8 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@algolia/api-client-automation", "version": "0.0.1", "private": true, + "description": "The best repository", "workspaces": [ "scripts/", "playground/javascript/node/", From 648f022dfc515467cba7c2c0371dd36352570213 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 11 Sep 2024 15:55:56 +0200 Subject: [PATCH 3/9] run all --- .github/workflows/check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5a4e400a9c..46720af37b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,6 +40,8 @@ jobs: setup: runs-on: ubuntu-22.04 timeout-minutes: 10 + env: + CACHE_VERSION: 1 # bump this to run all clients on the CI. steps: - name: debugging - dump GitHub context env: From 4685f904220b325b99a5a54555bddfc16f2734ce Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 11 Sep 2024 16:09:11 +0200 Subject: [PATCH 4/9] remove usage --- .../algolia/usage/api_usage.go | 1025 --------- .../algolia/usage/client.go | 276 --- .../algolia/usage/configuration.go | 11 - .../algolia/usage/model_error_base.go | 133 -- .../algolia/usage/model_error_item.go | 208 -- .../algolia/usage/model_forbidden_error.go | 177 -- .../algolia/usage/model_granularity.go | 65 - .../algolia/usage/model_index_usage.go | 89 - .../usage/model_invalid_request_error.go | 177 -- .../algolia/usage/model_statistic.go | 229 -- .../algolia/usage/model_statistic_entry.go | 134 -- .../algolia/usage/model_statistic_value.go | 85 - .../com/algolia/model/usage/ErrorBase.java | 78 - .../com/algolia/model/usage/ErrorItem.java | 112 - .../algolia/model/usage/ForbiddenError.java | 106 - .../com/algolia/model/usage/Granularity.java | 40 - .../com/algolia/model/usage/IndexUsage.java | 72 - .../model/usage/InvalidRequestError.java | 106 - .../com/algolia/model/usage/Statistic.java | 204 -- .../algolia/model/usage/StatisticEntry.java | 77 - .../algolia/model/usage/StatisticValue.java | 111 - .../packages/client-usage/LICENSE | 21 - .../packages/client-usage/README.md | 69 - .../packages/client-usage/builds/browser.ts | 48 - .../packages/client-usage/builds/fetch.ts | 46 - .../packages/client-usage/builds/node.ts | 46 - .../packages/client-usage/index.d.ts | 2 - .../packages/client-usage/index.js | 2 - .../client-usage/model/clientMethodProps.ts | 116 - .../packages/client-usage/model/errorBase.ts | 8 - .../packages/client-usage/model/errorItem.ts | 11 - .../packages/client-usage/model/forbidden.ts | 7 - .../client-usage/model/forbiddenError.ts | 11 - .../client-usage/model/granularity.ts | 3 - .../packages/client-usage/model/index.ts | 14 - .../packages/client-usage/model/indexUsage.ts | 7 - .../client-usage/model/invalidRequest.ts | 7 - .../client-usage/model/invalidRequestError.ts | 11 - .../packages/client-usage/model/statistic.ts | 87 - .../client-usage/model/statisticEntry.ts | 12 - .../client-usage/model/statisticValue.ts | 3 - .../packages/client-usage/package.json | 67 - .../packages/client-usage/rollup.config.js | 16 - .../packages/client-usage/src/usageClient.ts | 330 --- .../packages/client-usage/tsconfig.json | 8 - .../packages/client-usage/tsup.config.ts | 59 - .../algolia/client/model/usage/ErrorBase.kt | 46 - .../algolia/client/model/usage/ErrorItem.kt | 25 - .../client/model/usage/ForbiddenError.kt | 22 - .../algolia/client/model/usage/Granularity.kt | 16 - .../algolia/client/model/usage/IndexUsage.kt | 16 - .../client/model/usage/InvalidRequestError.kt | 22 - .../algolia/client/model/usage/Statistic.kt | 262 --- .../client/model/usage/StatisticEntry.kt | 20 - .../client/model/usage/StatisticValue.kt | 49 - .../lib/Api/UsageClient.php | 423 ---- .../algoliasearch/usage/__init__.py | 8 - .../algoliasearch/usage/client.py | 1407 ------------ .../algoliasearch/usage/config.py | 35 - .../algoliasearch/usage/models/__init__.py | 8 - .../algoliasearch/usage/models/error_base.py | 82 - .../algoliasearch/usage/models/error_item.py | 77 - .../usage/models/forbidden_error.py | 88 - .../algoliasearch/usage/models/granularity.py | 33 - .../algoliasearch/usage/models/index_usage.py | 84 - .../usage/models/invalid_request_error.py | 88 - .../algoliasearch/usage/models/statistic.py | 131 -- .../usage/models/statistic_entry.py | 85 - .../usage/models/statistic_value.py | 101 - .../lib/algolia/api/usage_client.rb | 349 --- .../lib/algolia/models/usage/error_base.rb | 212 -- .../lib/algolia/models/usage/error_item.rb | 240 --- .../algolia/models/usage/forbidden_error.rb | 231 -- .../lib/algolia/models/usage/granularity.rb | 32 - .../lib/algolia/models/usage/index_usage.rb | 213 -- .../models/usage/invalid_request_error.rb | 231 -- .../lib/algolia/models/usage/statistic.rb | 199 -- .../algolia/models/usage/statistic_entry.rb | 221 -- .../algolia/models/usage/statistic_value.rb | 108 - .../scala/algoliasearch/usage/ErrorBase.scala | 58 - .../scala/algoliasearch/usage/ErrorItem.scala | 25 - .../scala/algoliasearch/usage/Forbidden.scala | 22 - .../algoliasearch/usage/ForbiddenError.scala | 24 - .../algoliasearch/usage/Granularity.scala | 49 - .../algoliasearch/usage/IndexUsage.scala | 22 - .../algoliasearch/usage/InvalidRequest.scala | 22 - .../usage/InvalidRequestError.scala | 24 - .../algoliasearch/usage/JsonSupport.scala | 33 - .../scala/algoliasearch/usage/Statistic.scala | 380 ---- .../algoliasearch/usage/StatisticEntry.scala | 26 - .../algoliasearch/usage/StatisticValue.scala | 54 - .../Sources/Usage/Models/ErrorItem.swift | 56 - .../Sources/Usage/Models/ForbiddenError.swift | 50 - .../Sources/Usage/Models/Granularity.swift | 14 - .../Sources/Usage/Models/IndexUsage.swift | 38 - .../Sources/Usage/Models/InvalidRequest.swift | 38 - .../Usage/Models/InvalidRequestError.swift | 50 - .../Sources/Usage/Models/Statistic.swift | 96 - .../Sources/Usage/Models/StatisticEntry.swift | 45 - .../Sources/Usage/Models/StatisticValue.swift | 48 - .../Sources/Usage/Models/UsageErrorBase.swift | 86 - .../Sources/Usage/Models/UsageForbidden.swift | 38 - .../Sources/Usage/UsageClient.swift | 881 -------- .../Usage/UsageClientConfiguration.swift | 59 - config/clients.config.json | 31 +- snippets/csharp/src/Usage.cs | 138 -- snippets/go/src/usage.go | 209 -- snippets/guides/usage-snippets.json | 290 --- snippets/javascript/src/usage.ts | 132 -- .../main/kotlin/com/algolia/snippets/Usage.kt | 140 -- snippets/php/src/Usage.php | 170 -- snippets/python/usage.py | 172 -- snippets/ruby/usage.rb | 144 -- specs/bundled/usage.doc.yml | 1904 ----------------- specs/bundled/usage.yml | 875 -------- specs/usage/common/parameters.yml | 158 -- specs/usage/common/schemas/responses.yml | 30 - specs/usage/common/schemas/statistic.yml | 87 - specs/usage/paths/statistic.yml | 25 - specs/usage/paths/statisticIndex.yml | 26 - specs/usage/spec.yml | 75 - tests/CTS/client/usage/api.json | 50 - tests/CTS/client/usage/parameters.json | 32 - tests/CTS/requests/usage/getIndexUsage.json | 19 - tests/CTS/requests/usage/getUsage.json | 18 - tests/output/go/tests/client/usage_test.go | 225 -- tests/output/go/tests/requests/usage_test.go | 436 ---- .../javascript/src/client/usage.test.ts | 144 -- .../javascript/src/requests/usage.test.ts | 287 --- .../output/python/tests/client/usage_test.py | 310 --- .../python/tests/requests/usage_test.py | 885 -------- tests/output/ruby/test/client/usage_test.rb | 153 -- tests/output/ruby/test/requests/usage_test.rb | 321 --- 133 files changed, 9 insertions(+), 19405 deletions(-) delete mode 100644 clients/algoliasearch-client-go/algolia/usage/api_usage.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/client.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/configuration.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_error_base.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_error_item.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_forbidden_error.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_granularity.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_index_usage.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_invalid_request_error.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_statistic.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_statistic_entry.go delete mode 100644 clients/algoliasearch-client-go/algolia/usage/model_statistic_value.go delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorBase.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorItem.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ForbiddenError.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Granularity.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/IndexUsage.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/InvalidRequestError.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Statistic.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticEntry.java delete mode 100644 clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticValue.java delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/LICENSE delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/README.md delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/builds/browser.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/builds/fetch.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/builds/node.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/index.d.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/index.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/clientMethodProps.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/errorBase.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/errorItem.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/forbidden.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/forbiddenError.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/granularity.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/index.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/indexUsage.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequest.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/invalidRequestError.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/statistic.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/statisticEntry.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/model/statisticValue.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/package.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/rollup.config.js delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/src/usageClient.ts delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/tsconfig.json delete mode 100644 clients/algoliasearch-client-javascript/packages/client-usage/tsup.config.ts delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorBase.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ErrorItem.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/ForbiddenError.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Granularity.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/IndexUsage.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/InvalidRequestError.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/Statistic.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticEntry.kt delete mode 100644 clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/usage/StatisticValue.kt delete mode 100644 clients/algoliasearch-client-php/lib/Api/UsageClient.php delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/__init__.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/client.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/config.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/__init__.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/error_base.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/error_item.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/forbidden_error.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/granularity.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/index_usage.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/invalid_request_error.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/statistic.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_entry.py delete mode 100644 clients/algoliasearch-client-python/algoliasearch/usage/models/statistic_value.py delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/api/usage_client.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_base.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/error_item.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/forbidden_error.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/granularity.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/index_usage.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/invalid_request_error.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_entry.rb delete mode 100644 clients/algoliasearch-client-ruby/lib/algolia/models/usage/statistic_value.rb delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorBase.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ErrorItem.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Forbidden.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/ForbiddenError.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Granularity.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/IndexUsage.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequest.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/InvalidRequestError.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/JsonSupport.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/Statistic.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticEntry.scala delete mode 100644 clients/algoliasearch-client-scala/src/main/scala/algoliasearch/usage/StatisticValue.scala delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/ErrorItem.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/ForbiddenError.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/Granularity.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/IndexUsage.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequest.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/InvalidRequestError.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/Statistic.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticEntry.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/StatisticValue.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/UsageErrorBase.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/Models/UsageForbidden.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/UsageClient.swift delete mode 100644 clients/algoliasearch-client-swift/Sources/Usage/UsageClientConfiguration.swift delete mode 100644 snippets/csharp/src/Usage.cs delete mode 100644 snippets/go/src/usage.go delete mode 100644 snippets/guides/usage-snippets.json delete mode 100644 snippets/javascript/src/usage.ts delete mode 100644 snippets/kotlin/src/main/kotlin/com/algolia/snippets/Usage.kt delete mode 100644 snippets/php/src/Usage.php delete mode 100644 snippets/python/usage.py delete mode 100644 snippets/ruby/usage.rb delete mode 100644 specs/bundled/usage.doc.yml delete mode 100644 specs/bundled/usage.yml delete mode 100644 specs/usage/common/parameters.yml delete mode 100644 specs/usage/common/schemas/responses.yml delete mode 100644 specs/usage/common/schemas/statistic.yml delete mode 100644 specs/usage/paths/statistic.yml delete mode 100644 specs/usage/paths/statisticIndex.yml delete mode 100644 specs/usage/spec.yml delete mode 100644 tests/CTS/client/usage/api.json delete mode 100644 tests/CTS/client/usage/parameters.json delete mode 100644 tests/CTS/requests/usage/getIndexUsage.json delete mode 100644 tests/CTS/requests/usage/getUsage.json delete mode 100644 tests/output/go/tests/client/usage_test.go delete mode 100644 tests/output/go/tests/requests/usage_test.go delete mode 100644 tests/output/javascript/src/client/usage.test.ts delete mode 100644 tests/output/javascript/src/requests/usage.test.ts delete mode 100644 tests/output/python/tests/client/usage_test.py delete mode 100644 tests/output/python/tests/requests/usage_test.py delete mode 100644 tests/output/ruby/test/client/usage_test.rb delete mode 100644 tests/output/ruby/test/requests/usage_test.rb diff --git a/clients/algoliasearch-client-go/algolia/usage/api_usage.go b/clients/algoliasearch-client-go/algolia/usage/api_usage.go deleted file mode 100644 index 3b3cfce587..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/api_usage.go +++ /dev/null @@ -1,1025 +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 usage - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "net/url" - "strings" - - "github.com/algolia/algoliasearch-client-go/v4/algolia/utils" -) - -type config struct { - // -- Request options for API calls - context context.Context - queryParams url.Values - headerParams map[string]string -} - -type RequestOption interface { - apply(*config) -} - -type requestOption func(*config) - -func (r requestOption) apply(c *config) { - r(c) -} - -func WithContext(ctx context.Context) requestOption { - return requestOption(func(c *config) { - c.context = ctx - }) -} - -func WithHeaderParam(key string, value any) requestOption { - return requestOption(func(c *config) { - c.headerParams[key] = utils.ParameterToString(value) - }) -} - -func WithQueryParam(key string, value any) requestOption { - return requestOption(func(c *config) { - c.queryParams.Set(utils.QueryParameterToString(key), utils.QueryParameterToString(value)) - }) -} - -func (r *ApiCustomDeleteRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["path"]; ok { - err = json.Unmarshal(v, &r.path) - if err != nil { - err = json.Unmarshal(b, &r.path) - if err != nil { - return fmt.Errorf("cannot unmarshal path: %w", err) - } - } - } - if v, ok := req["parameters"]; ok { - err = json.Unmarshal(v, &r.parameters) - if err != nil { - err = json.Unmarshal(b, &r.parameters) - if err != nil { - return fmt.Errorf("cannot unmarshal parameters: %w", err) - } - } - } - - return nil -} - -// ApiCustomDeleteRequest represents the request with all the parameters for the API call. -type ApiCustomDeleteRequest struct { - path string - parameters map[string]any -} - -// NewApiCustomDeleteRequest creates an instance of the ApiCustomDeleteRequest to be used for the API call. -func (c *APIClient) NewApiCustomDeleteRequest(path string) ApiCustomDeleteRequest { - return ApiCustomDeleteRequest{ - path: path, - } -} - -// WithParameters adds the parameters to the ApiCustomDeleteRequest and returns the request for chaining. -func (r ApiCustomDeleteRequest) WithParameters(parameters map[string]any) ApiCustomDeleteRequest { - r.parameters = parameters - return r -} - -/* -CustomDelete calls the API and returns the raw response from it. - - This method allow you to send requests to the Algolia REST API. - - - Request can be constructed by NewApiCustomDeleteRequest with parameters below. - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) CustomDeleteWithHTTPInfo(r ApiCustomDeleteRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/{path}" - requestPath = strings.ReplaceAll(requestPath, "{path}", utils.ParameterToString(r.path)) - - if r.path == "" { - return nil, nil, reportError("Parameter `path` is required when calling `CustomDelete`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - if !utils.IsNilOrEmpty(r.parameters) { - for k, v := range r.parameters { - conf.queryParams.Set(k, utils.QueryParameterToString(v)) - } - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - req, err := c.prepareRequest(conf.context, requestPath, http.MethodDelete, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -CustomDelete casts the HTTP response body to a defined struct. - -This method allow you to send requests to the Algolia REST API. - -Request can be constructed by NewApiCustomDeleteRequest with parameters below. - - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @return map[string]any -*/ -func (c *APIClient) CustomDelete(r ApiCustomDeleteRequest, opts ...RequestOption) (*map[string]any, error) { - var returnValue *map[string]any - - res, resBody, err := c.CustomDeleteWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} - -func (r *ApiCustomGetRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["path"]; ok { - err = json.Unmarshal(v, &r.path) - if err != nil { - err = json.Unmarshal(b, &r.path) - if err != nil { - return fmt.Errorf("cannot unmarshal path: %w", err) - } - } - } - if v, ok := req["parameters"]; ok { - err = json.Unmarshal(v, &r.parameters) - if err != nil { - err = json.Unmarshal(b, &r.parameters) - if err != nil { - return fmt.Errorf("cannot unmarshal parameters: %w", err) - } - } - } - - return nil -} - -// ApiCustomGetRequest represents the request with all the parameters for the API call. -type ApiCustomGetRequest struct { - path string - parameters map[string]any -} - -// NewApiCustomGetRequest creates an instance of the ApiCustomGetRequest to be used for the API call. -func (c *APIClient) NewApiCustomGetRequest(path string) ApiCustomGetRequest { - return ApiCustomGetRequest{ - path: path, - } -} - -// WithParameters adds the parameters to the ApiCustomGetRequest and returns the request for chaining. -func (r ApiCustomGetRequest) WithParameters(parameters map[string]any) ApiCustomGetRequest { - r.parameters = parameters - return r -} - -/* -CustomGet calls the API and returns the raw response from it. - - This method allow you to send requests to the Algolia REST API. - - - Request can be constructed by NewApiCustomGetRequest with parameters below. - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) CustomGetWithHTTPInfo(r ApiCustomGetRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/{path}" - requestPath = strings.ReplaceAll(requestPath, "{path}", utils.ParameterToString(r.path)) - - if r.path == "" { - return nil, nil, reportError("Parameter `path` is required when calling `CustomGet`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - if !utils.IsNilOrEmpty(r.parameters) { - for k, v := range r.parameters { - conf.queryParams.Set(k, utils.QueryParameterToString(v)) - } - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - req, err := c.prepareRequest(conf.context, requestPath, http.MethodGet, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -CustomGet casts the HTTP response body to a defined struct. - -This method allow you to send requests to the Algolia REST API. - -Request can be constructed by NewApiCustomGetRequest with parameters below. - - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @return map[string]any -*/ -func (c *APIClient) CustomGet(r ApiCustomGetRequest, opts ...RequestOption) (*map[string]any, error) { - var returnValue *map[string]any - - res, resBody, err := c.CustomGetWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} - -func (r *ApiCustomPostRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["path"]; ok { - err = json.Unmarshal(v, &r.path) - if err != nil { - err = json.Unmarshal(b, &r.path) - if err != nil { - return fmt.Errorf("cannot unmarshal path: %w", err) - } - } - } - if v, ok := req["parameters"]; ok { - err = json.Unmarshal(v, &r.parameters) - if err != nil { - err = json.Unmarshal(b, &r.parameters) - if err != nil { - return fmt.Errorf("cannot unmarshal parameters: %w", err) - } - } - } - if v, ok := req["body"]; ok { - err = json.Unmarshal(v, &r.body) - if err != nil { - err = json.Unmarshal(b, &r.body) - if err != nil { - return fmt.Errorf("cannot unmarshal body: %w", err) - } - } - } - - return nil -} - -// ApiCustomPostRequest represents the request with all the parameters for the API call. -type ApiCustomPostRequest struct { - path string - parameters map[string]any - body map[string]any -} - -// NewApiCustomPostRequest creates an instance of the ApiCustomPostRequest to be used for the API call. -func (c *APIClient) NewApiCustomPostRequest(path string) ApiCustomPostRequest { - return ApiCustomPostRequest{ - path: path, - } -} - -// WithParameters adds the parameters to the ApiCustomPostRequest and returns the request for chaining. -func (r ApiCustomPostRequest) WithParameters(parameters map[string]any) ApiCustomPostRequest { - r.parameters = parameters - return r -} - -// WithBody adds the body to the ApiCustomPostRequest and returns the request for chaining. -func (r ApiCustomPostRequest) WithBody(body map[string]any) ApiCustomPostRequest { - r.body = body - return r -} - -/* -CustomPost calls the API and returns the raw response from it. - - This method allow you to send requests to the Algolia REST API. - - - Request can be constructed by NewApiCustomPostRequest with parameters below. - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param body map[string]any - Parameters to send with the custom request. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) CustomPostWithHTTPInfo(r ApiCustomPostRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/{path}" - requestPath = strings.ReplaceAll(requestPath, "{path}", utils.ParameterToString(r.path)) - - if r.path == "" { - return nil, nil, reportError("Parameter `path` is required when calling `CustomPost`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - if !utils.IsNilOrEmpty(r.parameters) { - for k, v := range r.parameters { - conf.queryParams.Set(k, utils.QueryParameterToString(v)) - } - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - // body params - if utils.IsNilOrEmpty(r.body) { - postBody = "{}" - } else { - postBody = r.body - } - req, err := c.prepareRequest(conf.context, requestPath, http.MethodPost, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -CustomPost casts the HTTP response body to a defined struct. - -This method allow you to send requests to the Algolia REST API. - -Request can be constructed by NewApiCustomPostRequest with parameters below. - - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param body map[string]any - Parameters to send with the custom request. - @return map[string]any -*/ -func (c *APIClient) CustomPost(r ApiCustomPostRequest, opts ...RequestOption) (*map[string]any, error) { - var returnValue *map[string]any - - res, resBody, err := c.CustomPostWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} - -func (r *ApiCustomPutRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["path"]; ok { - err = json.Unmarshal(v, &r.path) - if err != nil { - err = json.Unmarshal(b, &r.path) - if err != nil { - return fmt.Errorf("cannot unmarshal path: %w", err) - } - } - } - if v, ok := req["parameters"]; ok { - err = json.Unmarshal(v, &r.parameters) - if err != nil { - err = json.Unmarshal(b, &r.parameters) - if err != nil { - return fmt.Errorf("cannot unmarshal parameters: %w", err) - } - } - } - if v, ok := req["body"]; ok { - err = json.Unmarshal(v, &r.body) - if err != nil { - err = json.Unmarshal(b, &r.body) - if err != nil { - return fmt.Errorf("cannot unmarshal body: %w", err) - } - } - } - - return nil -} - -// ApiCustomPutRequest represents the request with all the parameters for the API call. -type ApiCustomPutRequest struct { - path string - parameters map[string]any - body map[string]any -} - -// NewApiCustomPutRequest creates an instance of the ApiCustomPutRequest to be used for the API call. -func (c *APIClient) NewApiCustomPutRequest(path string) ApiCustomPutRequest { - return ApiCustomPutRequest{ - path: path, - } -} - -// WithParameters adds the parameters to the ApiCustomPutRequest and returns the request for chaining. -func (r ApiCustomPutRequest) WithParameters(parameters map[string]any) ApiCustomPutRequest { - r.parameters = parameters - return r -} - -// WithBody adds the body to the ApiCustomPutRequest and returns the request for chaining. -func (r ApiCustomPutRequest) WithBody(body map[string]any) ApiCustomPutRequest { - r.body = body - return r -} - -/* -CustomPut calls the API and returns the raw response from it. - - This method allow you to send requests to the Algolia REST API. - - - Request can be constructed by NewApiCustomPutRequest with parameters below. - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param body map[string]any - Parameters to send with the custom request. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) CustomPutWithHTTPInfo(r ApiCustomPutRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/{path}" - requestPath = strings.ReplaceAll(requestPath, "{path}", utils.ParameterToString(r.path)) - - if r.path == "" { - return nil, nil, reportError("Parameter `path` is required when calling `CustomPut`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - if !utils.IsNilOrEmpty(r.parameters) { - for k, v := range r.parameters { - conf.queryParams.Set(k, utils.QueryParameterToString(v)) - } - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - // body params - if utils.IsNilOrEmpty(r.body) { - postBody = "{}" - } else { - postBody = r.body - } - req, err := c.prepareRequest(conf.context, requestPath, http.MethodPut, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -CustomPut casts the HTTP response body to a defined struct. - -This method allow you to send requests to the Algolia REST API. - -Request can be constructed by NewApiCustomPutRequest with parameters below. - - @param path string - Path of the endpoint, anything after \"/1\" must be specified. - @param parameters map[string]any - Query parameters to apply to the current query. - @param body map[string]any - Parameters to send with the custom request. - @return map[string]any -*/ -func (c *APIClient) CustomPut(r ApiCustomPutRequest, opts ...RequestOption) (*map[string]any, error) { - var returnValue *map[string]any - - res, resBody, err := c.CustomPutWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} - -func (r *ApiGetIndexUsageRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["statistic"]; ok { - err = json.Unmarshal(v, &r.statistic) - if err != nil { - err = json.Unmarshal(b, &r.statistic) - if err != nil { - return fmt.Errorf("cannot unmarshal statistic: %w", err) - } - } - } - if v, ok := req["indexName"]; ok { - err = json.Unmarshal(v, &r.indexName) - if err != nil { - err = json.Unmarshal(b, &r.indexName) - if err != nil { - return fmt.Errorf("cannot unmarshal indexName: %w", err) - } - } - } - if v, ok := req["startDate"]; ok { - err = json.Unmarshal(v, &r.startDate) - if err != nil { - err = json.Unmarshal(b, &r.startDate) - if err != nil { - return fmt.Errorf("cannot unmarshal startDate: %w", err) - } - } - } - if v, ok := req["endDate"]; ok { - err = json.Unmarshal(v, &r.endDate) - if err != nil { - err = json.Unmarshal(b, &r.endDate) - if err != nil { - return fmt.Errorf("cannot unmarshal endDate: %w", err) - } - } - } - if v, ok := req["granularity"]; ok { - err = json.Unmarshal(v, &r.granularity) - if err != nil { - err = json.Unmarshal(b, &r.granularity) - if err != nil { - return fmt.Errorf("cannot unmarshal granularity: %w", err) - } - } - } - - return nil -} - -// ApiGetIndexUsageRequest represents the request with all the parameters for the API call. -type ApiGetIndexUsageRequest struct { - statistic Statistic - indexName string - startDate string - endDate string - granularity Granularity -} - -// NewApiGetIndexUsageRequest creates an instance of the ApiGetIndexUsageRequest to be used for the API call. -func (c *APIClient) NewApiGetIndexUsageRequest(statistic Statistic, indexName string, startDate string, endDate string) ApiGetIndexUsageRequest { - return ApiGetIndexUsageRequest{ - statistic: statistic, - indexName: indexName, - startDate: startDate, - endDate: endDate, - } -} - -// WithGranularity adds the granularity to the ApiGetIndexUsageRequest and returns the request for chaining. -func (r ApiGetIndexUsageRequest) WithGranularity(granularity Granularity) ApiGetIndexUsageRequest { - r.granularity = granularity - return r -} - -/* -GetIndexUsage calls the API and returns the raw response from it. - - Retrieves the selected usage statistics for one index. - - - - Request can be constructed by NewApiGetIndexUsageRequest with parameters below. - @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. - @param indexName string - Name of the index on which to perform the operation. - @param startDate string - Start date of the period to analyze, in RFC 3339 format. - @param endDate string - End date of the period to analyze, in RFC 3339 format. - @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. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) GetIndexUsageWithHTTPInfo(r ApiGetIndexUsageRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/1/usage/{statistic}/{indexName}" - requestPath = strings.ReplaceAll(requestPath, "{statistic}", url.PathEscape(utils.ParameterToString(r.statistic))) - requestPath = strings.ReplaceAll(requestPath, "{indexName}", url.PathEscape(utils.ParameterToString(r.indexName))) - - if r.indexName == "" { - return nil, nil, reportError("Parameter `indexName` is required when calling `GetIndexUsage`.") - } - if r.startDate == "" { - return nil, nil, reportError("Parameter `startDate` is required when calling `GetIndexUsage`.") - } - if r.endDate == "" { - return nil, nil, reportError("Parameter `endDate` is required when calling `GetIndexUsage`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - conf.queryParams.Set("startDate", utils.QueryParameterToString(r.startDate)) - conf.queryParams.Set("endDate", utils.QueryParameterToString(r.endDate)) - if !utils.IsNilOrEmpty(r.granularity) { - conf.queryParams.Set("granularity", utils.QueryParameterToString(r.granularity)) - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - req, err := c.prepareRequest(conf.context, requestPath, http.MethodGet, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -GetIndexUsage casts the HTTP response body to a defined struct. - -Retrieves the selected usage statistics for one index. - -Request can be constructed by NewApiGetIndexUsageRequest with parameters below. - - @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. - @param indexName string - Name of the index on which to perform the operation. - @param startDate string - Start date of the period to analyze, in RFC 3339 format. - @param endDate string - End date of the period to analyze, in RFC 3339 format. - @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. - @return IndexUsage -*/ -func (c *APIClient) GetIndexUsage(r ApiGetIndexUsageRequest, opts ...RequestOption) (*IndexUsage, error) { - var returnValue *IndexUsage - - res, resBody, err := c.GetIndexUsageWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} - -func (r *ApiGetUsageRequest) UnmarshalJSON(b []byte) error { - req := map[string]json.RawMessage{} - err := json.Unmarshal(b, &req) - if err != nil { - return fmt.Errorf("cannot unmarshal request: %w", err) - } - if v, ok := req["statistic"]; ok { - err = json.Unmarshal(v, &r.statistic) - if err != nil { - err = json.Unmarshal(b, &r.statistic) - if err != nil { - return fmt.Errorf("cannot unmarshal statistic: %w", err) - } - } - } - if v, ok := req["startDate"]; ok { - err = json.Unmarshal(v, &r.startDate) - if err != nil { - err = json.Unmarshal(b, &r.startDate) - if err != nil { - return fmt.Errorf("cannot unmarshal startDate: %w", err) - } - } - } - if v, ok := req["endDate"]; ok { - err = json.Unmarshal(v, &r.endDate) - if err != nil { - err = json.Unmarshal(b, &r.endDate) - if err != nil { - return fmt.Errorf("cannot unmarshal endDate: %w", err) - } - } - } - if v, ok := req["granularity"]; ok { - err = json.Unmarshal(v, &r.granularity) - if err != nil { - err = json.Unmarshal(b, &r.granularity) - if err != nil { - return fmt.Errorf("cannot unmarshal granularity: %w", err) - } - } - } - - return nil -} - -// ApiGetUsageRequest represents the request with all the parameters for the API call. -type ApiGetUsageRequest struct { - statistic Statistic - startDate string - endDate string - granularity Granularity -} - -// NewApiGetUsageRequest creates an instance of the ApiGetUsageRequest to be used for the API call. -func (c *APIClient) NewApiGetUsageRequest(statistic Statistic, startDate string, endDate string) ApiGetUsageRequest { - return ApiGetUsageRequest{ - statistic: statistic, - startDate: startDate, - endDate: endDate, - } -} - -// WithGranularity adds the granularity to the ApiGetUsageRequest and returns the request for chaining. -func (r ApiGetUsageRequest) WithGranularity(granularity Granularity) ApiGetUsageRequest { - r.granularity = granularity - return r -} - -/* -GetUsage calls the API and returns the raw response from it. - - Retrieves usage statistics evaluated over a specified period. - - - - Request can be constructed by NewApiGetUsageRequest with parameters below. - @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. - @param startDate string - Start date of the period to analyze, in RFC 3339 format. - @param endDate string - End date of the period to analyze, in RFC 3339 format. - @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. - @param opts ...RequestOption - Optional parameters for the API call - @return *http.Response - The raw response from the API - @return []byte - The raw response body from the API - @return error - An error if the API call fails -*/ -func (c *APIClient) GetUsageWithHTTPInfo(r ApiGetUsageRequest, opts ...RequestOption) (*http.Response, []byte, error) { - requestPath := "/1/usage/{statistic}" - requestPath = strings.ReplaceAll(requestPath, "{statistic}", url.PathEscape(utils.ParameterToString(r.statistic))) - - if r.startDate == "" { - return nil, nil, reportError("Parameter `startDate` is required when calling `GetUsage`.") - } - if r.endDate == "" { - return nil, nil, reportError("Parameter `endDate` is required when calling `GetUsage`.") - } - - conf := config{ - context: context.Background(), - queryParams: url.Values{}, - headerParams: map[string]string{}, - } - - conf.queryParams.Set("startDate", utils.QueryParameterToString(r.startDate)) - conf.queryParams.Set("endDate", utils.QueryParameterToString(r.endDate)) - if !utils.IsNilOrEmpty(r.granularity) { - conf.queryParams.Set("granularity", utils.QueryParameterToString(r.granularity)) - } - - // optional params if any - for _, opt := range opts { - opt.apply(&conf) - } - - var postBody any - - req, err := c.prepareRequest(conf.context, requestPath, http.MethodGet, postBody, conf.headerParams, conf.queryParams) - if err != nil { - return nil, nil, err - } - - return c.callAPI(req, false) -} - -/* -GetUsage casts the HTTP response body to a defined struct. - -Retrieves usage statistics evaluated over a specified period. - -Request can be constructed by NewApiGetUsageRequest with parameters below. - - @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. - @param startDate string - Start date of the period to analyze, in RFC 3339 format. - @param endDate string - End date of the period to analyze, in RFC 3339 format. - @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. - @return IndexUsage -*/ -func (c *APIClient) GetUsage(r ApiGetUsageRequest, opts ...RequestOption) (*IndexUsage, error) { - var returnValue *IndexUsage - - res, resBody, err := c.GetUsageWithHTTPInfo(r, opts...) - if err != nil { - return returnValue, err - } - if res == nil { - return returnValue, reportError("res is nil") - } - - if res.StatusCode >= 300 { - newErr := &APIError{ - Message: string(resBody), - Status: res.StatusCode, - } - - var v ErrorBase - err = c.decode(&v, resBody) - if err != nil { - newErr.Message = err.Error() - return returnValue, newErr - } - - return returnValue, newErr - } - - err = c.decode(&returnValue, resBody) - if err != nil { - return returnValue, reportError("cannot decode result: %w", err) - } - - return returnValue, nil -} diff --git a/clients/algoliasearch-client-go/algolia/usage/client.go b/clients/algoliasearch-client-go/algolia/usage/client.go deleted file mode 100644 index 764b8a6aa8..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/client.go +++ /dev/null @@ -1,276 +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 usage - -import ( - "bytes" - "compress/gzip" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "net/url" - "runtime" - "strings" - - "github.com/go-playground/validator/v10" - - "github.com/algolia/algoliasearch-client-go/v4/algolia/call" - "github.com/algolia/algoliasearch-client-go/v4/algolia/compression" - "github.com/algolia/algoliasearch-client-go/v4/algolia/transport" -) - -// APIClient manages communication with the Usage API API v1.0.0 -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - appID string - cfg *UsageConfiguration - transport *transport.Transport -} - -// NewClient creates a new API client with appID and apiKey. -func NewClient(appID, apiKey string) (*APIClient, error) { - return NewClientWithConfig(UsageConfiguration{ - Configuration: transport.Configuration{ - AppID: appID, - ApiKey: apiKey, - DefaultHeader: make(map[string]string), - UserAgent: getUserAgent(), - Requester: transport.NewDefaultRequester(nil), - }, - }) -} - -// NewClientWithConfig creates a new API client with the given configuration to fully customize the client behaviour. -func NewClientWithConfig(cfg UsageConfiguration) (*APIClient, error) { - if cfg.AppID == "" { - return nil, errors.New("`appId` is missing.") - } - if cfg.ApiKey == "" { - return nil, errors.New("`apiKey` is missing.") - } - if len(cfg.Hosts) == 0 { - cfg.Hosts = getDefaultHosts() - } - if cfg.UserAgent == "" { - cfg.UserAgent = getUserAgent() - } - - return &APIClient{ - appID: cfg.AppID, - cfg: &cfg, - transport: transport.New( - cfg.Configuration, - ), - }, nil -} - -func getDefaultHosts() []transport.StatefulHost { - return []transport.StatefulHost{ - transport.NewStatefulHost("https", "usage.algolia.com", call.IsReadWrite), - } -} - -func getUserAgent() string { - return fmt.Sprintf("Algolia for Go (4.3.0); Go (%s); Usage (4.3.0)", runtime.Version()) -} - -// AddDefaultHeader adds a new HTTP header to the default header in the request. -func (c *APIClient) AddDefaultHeader(key string, value string) { - c.cfg.DefaultHeader[key] = value -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request, useReadTransporter bool) (*http.Response, []byte, error) { - callKind := call.Write - if useReadTransporter || request.Method == http.MethodGet { - callKind = call.Read - } - - resp, body, err := c.transport.Request(request.Context(), request, callKind) - if err != nil { - return nil, nil, fmt.Errorf("failed to do request: %w", err) - } - - return resp, body, nil -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior. -func (c *APIClient) GetConfiguration() *UsageConfiguration { - return c.cfg -} - -// Allow update of stored API key used to authenticate requests. -func (c *APIClient) SetClientApiKey(apiKey string) error { - if c.cfg == nil { - return errors.New("client config is not set") - } - - c.cfg.ApiKey = apiKey - - return nil -} - -// prepareRequest build the request. -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody any, - headerParams map[string]string, - queryParams url.Values, -) (req *http.Request, err error) { - body, err := setBody(postBody, c.cfg.Compression) - if err != nil { - return nil, fmt.Errorf("failed to set the body: %w", err) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, fmt.Errorf("failed to parse the path: %w", err) - } - - var queryString []string - for k, v := range queryParams { - for _, value := range v { - queryString = append(queryString, k+"="+value) - } - } - - url.RawQuery = strings.Join(queryString, "&") - - // Generate a new request - - // weird nil typing - var bodyReader io.Reader - if body != nil { - bodyReader = body - } - req, err = http.NewRequest(method, url.String(), bodyReader) - if err != nil { - return nil, fmt.Errorf("failed to create http request: %w", err) - } - - // add header parameters, if any - if len(headerParams) > 0 { - for h, v := range headerParams { - req.Header.Add(h, v) - } - } - - contentType := "application/json" - - // Add the user agent to the request. - req.Header.Add("User-Agent", c.cfg.UserAgent) - req.Header.Add("X-Algolia-Application-Id", c.cfg.AppID) - req.Header.Add("X-Algolia-API-Key", c.cfg.ApiKey) - req.Header.Add("Content-Type", contentType) - req.Header.Add("Accept", contentType) - - if ctx != nil { - // add context to the request - req = req.WithContext(ctx) - } - - for header, value := range c.cfg.DefaultHeader { - req.Header.Add(header, value) - } - - return req, nil -} - -func (c *APIClient) decode(v any, b []byte) error { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - - if actualObj, ok := v.(interface{ GetActualInstance() any }); ok { // oneOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err := unmarshalObj.UnmarshalJSON(b); err != nil { - return fmt.Errorf("failed to unmarshal one of in response body: %w", err) - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err := json.Unmarshal(b, v); err != nil { // simple model - return fmt.Errorf("failed to unmarshal response body: %w", err) - } - - return nil -} - -// Prevent trying to import "fmt". -func reportError(format string, a ...any) error { - return fmt.Errorf(format, a...) -} - -// A wrapper for strict JSON decoding. -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// A wrapper for validating a struct, returns nil if value is not a struct. -func validateStruct(v any) error { - err := validator.New().Struct(v) - validationErrors, ok := err.(validator.ValidationErrors) - if ok && len(validationErrors) > 0 { - return validationErrors - } - - return nil -} - -// Set request body from an any. -func setBody(body any, c compression.Compression) (*bytes.Buffer, error) { - if body == nil { - return nil, nil - } - - bodyBuf := &bytes.Buffer{} - var err error - - switch c { - case compression.GZIP: - gzipWriter := gzip.NewWriter(bodyBuf) - defer gzipWriter.Close() - err = json.NewEncoder(gzipWriter).Encode(body) - default: - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else { - err = json.NewEncoder(bodyBuf).Encode(body) - } - } - - if err != nil { - return nil, fmt.Errorf("failed to encode body: %w", err) - } - - if bodyBuf.Len() == 0 { - return nil, errors.New("Invalid body type, or empty body") - } - return bodyBuf, nil -} - -type APIError struct { - Message string - Status int -} - -func (e APIError) Error() string { - return fmt.Sprintf("API error [%d] %s", e.Status, e.Message) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/configuration.go b/clients/algoliasearch-client-go/algolia/usage/configuration.go deleted file mode 100644 index edecdb552f..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/configuration.go +++ /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. -package usage - -import ( - "github.com/algolia/algoliasearch-client-go/v4/algolia/transport" -) - -// UsageConfiguration stores the configuration of the API client. -type UsageConfiguration struct { - transport.Configuration -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_error_base.go b/clients/algoliasearch-client-go/algolia/usage/model_error_base.go deleted file mode 100644 index 080432cdf4..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_error_base.go +++ /dev/null @@ -1,133 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// ErrorBase Error. -type ErrorBase struct { - Message *string `json:"message,omitempty"` - AdditionalProperties map[string]any -} - -type _ErrorBase ErrorBase - -type ErrorBaseOption func(f *ErrorBase) - -func WithErrorBaseMessage(val string) ErrorBaseOption { - return func(f *ErrorBase) { - f.Message = &val - } -} - -// NewErrorBase instantiates a new ErrorBase object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewErrorBase(opts ...ErrorBaseOption) *ErrorBase { - this := &ErrorBase{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyErrorBase return a pointer to an empty ErrorBase object. -func NewEmptyErrorBase() *ErrorBase { - return &ErrorBase{} -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *ErrorBase) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ErrorBase) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *ErrorBase) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *ErrorBase) SetMessage(v string) *ErrorBase { - o.Message = &v - return o -} - -func (o *ErrorBase) SetAdditionalProperty(key string, value any) *ErrorBase { - if o.AdditionalProperties == nil { - o.AdditionalProperties = make(map[string]any) - } - - o.AdditionalProperties[key] = value - - return o -} - -func (o ErrorBase) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Message != nil { - toSerialize["message"] = o.Message - } - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal ErrorBase: %w", err) - } - - return serialized, nil -} - -func (o *ErrorBase) UnmarshalJSON(bytes []byte) error { - varErrorBase := _ErrorBase{} - - err := json.Unmarshal(bytes, &varErrorBase) - if err != nil { - return fmt.Errorf("failed to unmarshal ErrorBase: %w", err) - } - - *o = ErrorBase(varErrorBase) - - additionalProperties := make(map[string]any) - - err = json.Unmarshal(bytes, &additionalProperties) - if err != nil { - return fmt.Errorf("failed to unmarshal additionalProperties in ErrorBase: %w", err) - } - - delete(additionalProperties, "message") - o.AdditionalProperties = additionalProperties - - return nil -} - -func (o ErrorBase) String() string { - out := "" - out += fmt.Sprintf(" message=%v\n", o.Message) - for key, value := range o.AdditionalProperties { - out += fmt.Sprintf(" %s=%v\n", key, value) - } - return fmt.Sprintf("ErrorBase {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_error_item.go b/clients/algoliasearch-client-go/algolia/usage/model_error_item.go deleted file mode 100644 index be4db45fae..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_error_item.go +++ /dev/null @@ -1,208 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// ErrorItem struct for ErrorItem. -type ErrorItem struct { - Code *string `json:"code,omitempty"` - Message string `json:"message"` - Line *int32 `json:"line,omitempty"` - Position *int32 `json:"position,omitempty"` -} - -type ErrorItemOption func(f *ErrorItem) - -func WithErrorItemCode(val string) ErrorItemOption { - return func(f *ErrorItem) { - f.Code = &val - } -} - -func WithErrorItemLine(val int32) ErrorItemOption { - return func(f *ErrorItem) { - f.Line = &val - } -} - -func WithErrorItemPosition(val int32) ErrorItemOption { - return func(f *ErrorItem) { - f.Position = &val - } -} - -// NewErrorItem instantiates a new ErrorItem object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewErrorItem(message string, opts ...ErrorItemOption) *ErrorItem { - this := &ErrorItem{} - this.Message = message - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyErrorItem return a pointer to an empty ErrorItem object. -func NewEmptyErrorItem() *ErrorItem { - return &ErrorItem{} -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *ErrorItem) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ErrorItem) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *ErrorItem) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *ErrorItem) SetCode(v string) *ErrorItem { - o.Code = &v - return o -} - -// GetMessage returns the Message field value. -func (o *ErrorItem) GetMessage() string { - if o == nil { - var ret string - return ret - } - - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *ErrorItem) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value. -func (o *ErrorItem) SetMessage(v string) *ErrorItem { - o.Message = v - return o -} - -// GetLine returns the Line field value if set, zero value otherwise. -func (o *ErrorItem) GetLine() int32 { - if o == nil || o.Line == nil { - var ret int32 - return ret - } - return *o.Line -} - -// GetLineOk returns a tuple with the Line field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ErrorItem) GetLineOk() (*int32, bool) { - if o == nil || o.Line == nil { - return nil, false - } - return o.Line, true -} - -// HasLine returns a boolean if a field has been set. -func (o *ErrorItem) HasLine() bool { - if o != nil && o.Line != nil { - return true - } - - return false -} - -// SetLine gets a reference to the given int32 and assigns it to the Line field. -func (o *ErrorItem) SetLine(v int32) *ErrorItem { - o.Line = &v - return o -} - -// GetPosition returns the Position field value if set, zero value otherwise. -func (o *ErrorItem) GetPosition() int32 { - if o == nil || o.Position == nil { - var ret int32 - return ret - } - return *o.Position -} - -// GetPositionOk returns a tuple with the Position field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ErrorItem) GetPositionOk() (*int32, bool) { - if o == nil || o.Position == nil { - return nil, false - } - return o.Position, true -} - -// HasPosition returns a boolean if a field has been set. -func (o *ErrorItem) HasPosition() bool { - if o != nil && o.Position != nil { - return true - } - - return false -} - -// SetPosition gets a reference to the given int32 and assigns it to the Position field. -func (o *ErrorItem) SetPosition(v int32) *ErrorItem { - o.Position = &v - return o -} - -func (o ErrorItem) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Code != nil { - toSerialize["code"] = o.Code - } - if true { - toSerialize["message"] = o.Message - } - if o.Line != nil { - toSerialize["line"] = o.Line - } - if o.Position != nil { - toSerialize["position"] = o.Position - } - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal ErrorItem: %w", err) - } - - return serialized, nil -} - -func (o ErrorItem) String() string { - out := "" - out += fmt.Sprintf(" code=%v\n", o.Code) - out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" line=%v\n", o.Line) - out += fmt.Sprintf(" position=%v\n", o.Position) - return fmt.Sprintf("ErrorItem {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_forbidden_error.go b/clients/algoliasearch-client-go/algolia/usage/model_forbidden_error.go deleted file mode 100644 index b1c3a8aa3b..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_forbidden_error.go +++ /dev/null @@ -1,177 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// ForbiddenError struct for ForbiddenError. -type ForbiddenError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Errors []ErrorItem `json:"errors,omitempty"` -} - -type ForbiddenErrorOption func(f *ForbiddenError) - -func WithForbiddenErrorCode(val string) ForbiddenErrorOption { - return func(f *ForbiddenError) { - f.Code = &val - } -} - -func WithForbiddenErrorMessage(val string) ForbiddenErrorOption { - return func(f *ForbiddenError) { - f.Message = &val - } -} - -func WithForbiddenErrorErrors(val []ErrorItem) ForbiddenErrorOption { - return func(f *ForbiddenError) { - f.Errors = val - } -} - -// NewForbiddenError instantiates a new ForbiddenError object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewForbiddenError(opts ...ForbiddenErrorOption) *ForbiddenError { - this := &ForbiddenError{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyForbiddenError return a pointer to an empty ForbiddenError object. -func NewEmptyForbiddenError() *ForbiddenError { - return &ForbiddenError{} -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *ForbiddenError) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ForbiddenError) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *ForbiddenError) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *ForbiddenError) SetCode(v string) *ForbiddenError { - o.Code = &v - return o -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *ForbiddenError) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ForbiddenError) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *ForbiddenError) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *ForbiddenError) SetMessage(v string) *ForbiddenError { - o.Message = &v - return o -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *ForbiddenError) GetErrors() []ErrorItem { - if o == nil || o.Errors == nil { - var ret []ErrorItem - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ForbiddenError) GetErrorsOk() ([]ErrorItem, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *ForbiddenError) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []ErrorItem and assigns it to the Errors field. -func (o *ForbiddenError) SetErrors(v []ErrorItem) *ForbiddenError { - o.Errors = v - return o -} - -func (o ForbiddenError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal ForbiddenError: %w", err) - } - - return serialized, nil -} - -func (o ForbiddenError) String() string { - out := "" - out += fmt.Sprintf(" code=%v\n", o.Code) - out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" errors=%v\n", o.Errors) - return fmt.Sprintf("ForbiddenError {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_granularity.go b/clients/algoliasearch-client-go/algolia/usage/model_granularity.go deleted file mode 100644 index e301230894..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_granularity.go +++ /dev/null @@ -1,65 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// Granularity the model 'Granularity'. -type Granularity string - -// List of granularity. -const ( - GRANULARITY_HOURLY Granularity = "hourly" - GRANULARITY_DAILY Granularity = "daily" -) - -// All allowed values of Granularity enum. -var AllowedGranularityEnumValues = []Granularity{ - "hourly", - "daily", -} - -func (v *Granularity) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return fmt.Errorf("failed to unmarshal value '%s' for enum 'Granularity': %w", string(src), err) - } - enumTypeValue := Granularity(value) - for _, existing := range AllowedGranularityEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid Granularity", value) -} - -// NewGranularityFromValue returns a pointer to a valid Granularity -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewGranularityFromValue(v string) (*Granularity, error) { - ev := Granularity(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Granularity: valid values are %v", v, AllowedGranularityEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v Granularity) IsValid() bool { - for _, existing := range AllowedGranularityEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to granularity value. -func (v Granularity) Ptr() *Granularity { - return &v -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_index_usage.go b/clients/algoliasearch-client-go/algolia/usage/model_index_usage.go deleted file mode 100644 index 19fe1b7e46..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_index_usage.go +++ /dev/null @@ -1,89 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// IndexUsage struct for IndexUsage. -type IndexUsage struct { - Statistics []StatisticEntry `json:"statistics,omitempty"` -} - -type IndexUsageOption func(f *IndexUsage) - -func WithIndexUsageStatistics(val []StatisticEntry) IndexUsageOption { - return func(f *IndexUsage) { - f.Statistics = val - } -} - -// NewIndexUsage instantiates a new IndexUsage object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewIndexUsage(opts ...IndexUsageOption) *IndexUsage { - this := &IndexUsage{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyIndexUsage return a pointer to an empty IndexUsage object. -func NewEmptyIndexUsage() *IndexUsage { - return &IndexUsage{} -} - -// GetStatistics returns the Statistics field value if set, zero value otherwise. -func (o *IndexUsage) GetStatistics() []StatisticEntry { - if o == nil || o.Statistics == nil { - var ret []StatisticEntry - return ret - } - return o.Statistics -} - -// GetStatisticsOk returns a tuple with the Statistics field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *IndexUsage) GetStatisticsOk() ([]StatisticEntry, bool) { - if o == nil || o.Statistics == nil { - return nil, false - } - return o.Statistics, true -} - -// HasStatistics returns a boolean if a field has been set. -func (o *IndexUsage) HasStatistics() bool { - if o != nil && o.Statistics != nil { - return true - } - - return false -} - -// SetStatistics gets a reference to the given []StatisticEntry and assigns it to the Statistics field. -func (o *IndexUsage) SetStatistics(v []StatisticEntry) *IndexUsage { - o.Statistics = v - return o -} - -func (o IndexUsage) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Statistics != nil { - toSerialize["statistics"] = o.Statistics - } - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal IndexUsage: %w", err) - } - - return serialized, nil -} - -func (o IndexUsage) String() string { - out := "" - out += fmt.Sprintf(" statistics=%v\n", o.Statistics) - return fmt.Sprintf("IndexUsage {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_invalid_request_error.go b/clients/algoliasearch-client-go/algolia/usage/model_invalid_request_error.go deleted file mode 100644 index 5c6a335334..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_invalid_request_error.go +++ /dev/null @@ -1,177 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// InvalidRequestError struct for InvalidRequestError. -type InvalidRequestError struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Errors []ErrorItem `json:"errors,omitempty"` -} - -type InvalidRequestErrorOption func(f *InvalidRequestError) - -func WithInvalidRequestErrorCode(val string) InvalidRequestErrorOption { - return func(f *InvalidRequestError) { - f.Code = &val - } -} - -func WithInvalidRequestErrorMessage(val string) InvalidRequestErrorOption { - return func(f *InvalidRequestError) { - f.Message = &val - } -} - -func WithInvalidRequestErrorErrors(val []ErrorItem) InvalidRequestErrorOption { - return func(f *InvalidRequestError) { - f.Errors = val - } -} - -// NewInvalidRequestError instantiates a new InvalidRequestError object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewInvalidRequestError(opts ...InvalidRequestErrorOption) *InvalidRequestError { - this := &InvalidRequestError{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyInvalidRequestError return a pointer to an empty InvalidRequestError object. -func NewEmptyInvalidRequestError() *InvalidRequestError { - return &InvalidRequestError{} -} - -// GetCode returns the Code field value if set, zero value otherwise. -func (o *InvalidRequestError) GetCode() string { - if o == nil || o.Code == nil { - var ret string - return ret - } - return *o.Code -} - -// GetCodeOk returns a tuple with the Code field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InvalidRequestError) GetCodeOk() (*string, bool) { - if o == nil || o.Code == nil { - return nil, false - } - return o.Code, true -} - -// HasCode returns a boolean if a field has been set. -func (o *InvalidRequestError) HasCode() bool { - if o != nil && o.Code != nil { - return true - } - - return false -} - -// SetCode gets a reference to the given string and assigns it to the Code field. -func (o *InvalidRequestError) SetCode(v string) *InvalidRequestError { - o.Code = &v - return o -} - -// GetMessage returns the Message field value if set, zero value otherwise. -func (o *InvalidRequestError) GetMessage() string { - if o == nil || o.Message == nil { - var ret string - return ret - } - return *o.Message -} - -// GetMessageOk returns a tuple with the Message field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InvalidRequestError) GetMessageOk() (*string, bool) { - if o == nil || o.Message == nil { - return nil, false - } - return o.Message, true -} - -// HasMessage returns a boolean if a field has been set. -func (o *InvalidRequestError) HasMessage() bool { - if o != nil && o.Message != nil { - return true - } - - return false -} - -// SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *InvalidRequestError) SetMessage(v string) *InvalidRequestError { - o.Message = &v - return o -} - -// GetErrors returns the Errors field value if set, zero value otherwise. -func (o *InvalidRequestError) GetErrors() []ErrorItem { - if o == nil || o.Errors == nil { - var ret []ErrorItem - return ret - } - return o.Errors -} - -// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *InvalidRequestError) GetErrorsOk() ([]ErrorItem, bool) { - if o == nil || o.Errors == nil { - return nil, false - } - return o.Errors, true -} - -// HasErrors returns a boolean if a field has been set. -func (o *InvalidRequestError) HasErrors() bool { - if o != nil && o.Errors != nil { - return true - } - - return false -} - -// SetErrors gets a reference to the given []ErrorItem and assigns it to the Errors field. -func (o *InvalidRequestError) SetErrors(v []ErrorItem) *InvalidRequestError { - o.Errors = v - return o -} - -func (o InvalidRequestError) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.Code != nil { - toSerialize["code"] = o.Code - } - if o.Message != nil { - toSerialize["message"] = o.Message - } - if o.Errors != nil { - toSerialize["errors"] = o.Errors - } - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal InvalidRequestError: %w", err) - } - - return serialized, nil -} - -func (o InvalidRequestError) String() string { - out := "" - out += fmt.Sprintf(" code=%v\n", o.Code) - out += fmt.Sprintf(" message=%v\n", o.Message) - out += fmt.Sprintf(" errors=%v\n", o.Errors) - return fmt.Sprintf("InvalidRequestError {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_statistic.go b/clients/algoliasearch-client-go/algolia/usage/model_statistic.go deleted file mode 100644 index 56eaa971f7..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_statistic.go +++ /dev/null @@ -1,229 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// Statistic the model 'Statistic'. -type Statistic string - -// List of Statistic. -const ( - STATISTIC_STAR Statistic = "*" - STATISTIC_SEARCH_OPERATIONS Statistic = "search_operations" - STATISTIC_TOTAL_SEARCH_OPERATIONS Statistic = "total_search_operations" - STATISTIC_TOTAL_SEARCH_REQUESTS Statistic = "total_search_requests" - STATISTIC_QUERIES_OPERATIONS Statistic = "queries_operations" - STATISTIC_MULTI_QUERIES_OPERATIONS Statistic = "multi_queries_operations" - STATISTIC_ACL_OPERATIONS Statistic = "acl_operations" - STATISTIC_TOTAL_ACL_OPERATIONS Statistic = "total_acl_operations" - STATISTIC_GET_API_KEYS_OPERATIONS Statistic = "get_api_keys_operations" - STATISTIC_GET_API_KEY_OPERATIONS Statistic = "get_api_key_operations" - STATISTIC_ADD_API_KEY_OPERATIONS Statistic = "add_api_key_operations" - STATISTIC_UPDATE_API_KEY_OPERATIONS Statistic = "update_api_key_operations" - STATISTIC_DELETE_API_KEY_OPERATIONS Statistic = "delete_api_key_operations" - STATISTIC_LIST_API_KEY_OPERATIONS Statistic = "list_api_key_operations" - STATISTIC_INDEXING_OPERATIONS Statistic = "indexing_operations" - STATISTIC_TOTAL_INDEXING_OPERATIONS Statistic = "total_indexing_operations" - STATISTIC_BROWSE_OPERATIONS Statistic = "browse_operations" - STATISTIC_CLEAR_INDEX_OPERATIONS Statistic = "clear_index_operations" - STATISTIC_COPY_MOVE_OPERATIONS Statistic = "copy_move_operations" - STATISTIC_DELETE_INDEX_OPERATIONS Statistic = "delete_index_operations" - STATISTIC_GET_LOG_OPERATIONS Statistic = "get_log_operations" - STATISTIC_GET_SETTINGS_OPERATIONS Statistic = "get_settings_operations" - STATISTIC_SET_SETTINGS_OPERATIONS Statistic = "set_settings_operations" - STATISTIC_LIST_INDICES_OPERATIONS Statistic = "list_indices_operations" - STATISTIC_WAIT_TASK_OPERATIONS Statistic = "wait_task_operations" - STATISTIC_RECORD_OPERATIONS Statistic = "record_operations" - STATISTIC_TOTAL_RECORDS_OPERATIONS Statistic = "total_records_operations" - STATISTIC_ADD_RECORD_OPERATIONS Statistic = "add_record_operations" - STATISTIC_BATCH_OPERATIONS Statistic = "batch_operations" - STATISTIC_DELETE_BY_QUERY_OPERATIONS Statistic = "delete_by_query_operations" - STATISTIC_DELETE_RECORD_OPERATIONS Statistic = "delete_record_operations" - STATISTIC_GET_RECORD_OPERATIONS Statistic = "get_record_operations" - STATISTIC_PARTIAL_UPDATE_RECORD_OPERATIONS Statistic = "partial_update_record_operations" - STATISTIC_UPDATE_RECORD_OPERATIONS Statistic = "update_record_operations" - STATISTIC_SYNONYM_OPERATIONS Statistic = "synonym_operations" - STATISTIC_TOTAL_SYNONYM_OPERATIONS Statistic = "total_synonym_operations" - STATISTIC_BATCH_SYNONYM_OPERATIONS Statistic = "batch_synonym_operations" - STATISTIC_CLEAR_SYNONYM_OPERATIONS Statistic = "clear_synonym_operations" - STATISTIC_DELETE_SYNONYM_OPERATIONS Statistic = "delete_synonym_operations" - STATISTIC_GET_SYNONYM_OPERATIONS Statistic = "get_synonym_operations" - STATISTIC_QUERY_SYNONYM_OPERATIONS Statistic = "query_synonym_operations" - STATISTIC_UPDATE_SYNONYM_OPERATIONS Statistic = "update_synonym_operations" - STATISTIC_RULE_OPERATIONS Statistic = "rule_operations" - STATISTIC_TOTAL_RULES_OPERATIONS Statistic = "total_rules_operations" - STATISTIC_BATCH_RULES_OPERATIONS Statistic = "batch_rules_operations" - STATISTIC_CLEAR_RULES_OPERATIONS Statistic = "clear_rules_operations" - STATISTIC_DELETE_RULES_OPERATIONS Statistic = "delete_rules_operations" - STATISTIC_GET_RULES_OPERATIONS Statistic = "get_rules_operations" - STATISTIC_SAVE_RULES_OPERATIONS Statistic = "save_rules_operations" - STATISTIC_SEARCH_RULES_OPERATIONS Statistic = "search_rules_operations" - STATISTIC_TOTAL_RECOMMEND_REQUESTS Statistic = "total_recommend_requests" - STATISTIC_TOTAL_WRITE_OPERATIONS Statistic = "total_write_operations" - STATISTIC_TOTAL_READ_OPERATIONS Statistic = "total_read_operations" - STATISTIC_TOTAL_OPERATIONS Statistic = "total_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_SEARCH_OPERATIONS Statistic = "querysuggestions_total_search_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_SEARCH_REQUESTS Statistic = "querysuggestions_total_search_requests" - STATISTIC_QUERYSUGGESTIONS_TOTAL_ACL_OPERATIONS Statistic = "querysuggestions_total_acl_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_INDEXING_OPERATIONS Statistic = "querysuggestions_total_indexing_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_RECORDS_OPERATIONS Statistic = "querysuggestions_total_records_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_SYNONYM_OPERATIONS Statistic = "querysuggestions_total_synonym_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_RULES_OPERATIONS Statistic = "querysuggestions_total_rules_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_WRITE_OPERATIONS Statistic = "querysuggestions_total_write_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_READ_OPERATIONS Statistic = "querysuggestions_total_read_operations" - STATISTIC_QUERYSUGGESTIONS_TOTAL_OPERATIONS Statistic = "querysuggestions_total_operations" - STATISTIC_AVG_PROCESSING_TIME Statistic = "avg_processing_time" - STATISTIC__90P_PROCESSING_TIME Statistic = "90p_processing_time" - STATISTIC__99P_PROCESSING_TIME Statistic = "99p_processing_time" - STATISTIC_QUERIES_ABOVE_LAST_MS_PROCESSING_TIME Statistic = "queries_above_last_ms_processing_time" - STATISTIC_RECORDS Statistic = "records" - STATISTIC_DATA_SIZE Statistic = "data_size" - STATISTIC_FILE_SIZE Statistic = "file_size" - STATISTIC_MAX_QPS Statistic = "max_qps" - STATISTIC_REGION_MAX_QPS Statistic = "region_max_qps" - STATISTIC_TOTAL_MAX_QPS Statistic = "total_max_qps" - STATISTIC_USED_SEARCH_CAPACITY Statistic = "used_search_capacity" - STATISTIC_AVG_USED_SEARCH_CAPACITY Statistic = "avg_used_search_capacity" - STATISTIC_REGION_USED_SEARCH_CAPACITY Statistic = "region_used_search_capacity" - STATISTIC_REGION_AVG_USED_SEARCH_CAPACITY Statistic = "region_avg_used_search_capacity" - STATISTIC_TOTAL_USED_SEARCH_CAPACITY Statistic = "total_used_search_capacity" - STATISTIC_TOTAL_AVG_USED_SEARCH_CAPACITY Statistic = "total_avg_used_search_capacity" - STATISTIC_DEGRADED_QUERIES_SSD_USED_QUERIES_IMPACTED Statistic = "degraded_queries_ssd_used_queries_impacted" - STATISTIC_DEGRADED_QUERIES_SSD_USED_SECONDS_IMPACTED Statistic = "degraded_queries_ssd_used_seconds_impacted" - STATISTIC_DEGRADED_QUERIES_MAX_CAPACITY_QUERIES_IMPACTED Statistic = "degraded_queries_max_capacity_queries_impacted" - STATISTIC_DEGRADED_QUERIES_MAX_CAPACITY_SECONDS_IMPACTED Statistic = "degraded_queries_max_capacity_seconds_impacted" -) - -// All allowed values of Statistic enum. -var AllowedStatisticEnumValues = []Statistic{ - "*", - "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", -} - -func (v *Statistic) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return fmt.Errorf("failed to unmarshal value '%s' for enum 'Statistic': %w", string(src), err) - } - enumTypeValue := Statistic(value) - for _, existing := range AllowedStatisticEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid Statistic", value) -} - -// NewStatisticFromValue returns a pointer to a valid Statistic -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewStatisticFromValue(v string) (*Statistic, error) { - ev := Statistic(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Statistic: valid values are %v", v, AllowedStatisticEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v Statistic) IsValid() bool { - for _, existing := range AllowedStatisticEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to Statistic value. -func (v Statistic) Ptr() *Statistic { - return &v -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_statistic_entry.go b/clients/algoliasearch-client-go/algolia/usage/model_statistic_entry.go deleted file mode 100644 index ff536f4ea5..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_statistic_entry.go +++ /dev/null @@ -1,134 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// StatisticEntry struct for StatisticEntry. -type StatisticEntry struct { - // Timestamp, measured in milliseconds since the Unix epoch. - T *int32 `json:"t,omitempty"` - V *StatisticValue `json:"v,omitempty"` -} - -type StatisticEntryOption func(f *StatisticEntry) - -func WithStatisticEntryT(val int32) StatisticEntryOption { - return func(f *StatisticEntry) { - f.T = &val - } -} - -func WithStatisticEntryV(val StatisticValue) StatisticEntryOption { - return func(f *StatisticEntry) { - f.V = &val - } -} - -// NewStatisticEntry instantiates a new StatisticEntry object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed. -func NewStatisticEntry(opts ...StatisticEntryOption) *StatisticEntry { - this := &StatisticEntry{} - for _, opt := range opts { - opt(this) - } - return this -} - -// NewEmptyStatisticEntry return a pointer to an empty StatisticEntry object. -func NewEmptyStatisticEntry() *StatisticEntry { - return &StatisticEntry{} -} - -// GetT returns the T field value if set, zero value otherwise. -func (o *StatisticEntry) GetT() int32 { - if o == nil || o.T == nil { - var ret int32 - return ret - } - return *o.T -} - -// GetTOk returns a tuple with the T field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *StatisticEntry) GetTOk() (*int32, bool) { - if o == nil || o.T == nil { - return nil, false - } - return o.T, true -} - -// HasT returns a boolean if a field has been set. -func (o *StatisticEntry) HasT() bool { - if o != nil && o.T != nil { - return true - } - - return false -} - -// SetT gets a reference to the given int32 and assigns it to the T field. -func (o *StatisticEntry) SetT(v int32) *StatisticEntry { - o.T = &v - return o -} - -// GetV returns the V field value if set, zero value otherwise. -func (o *StatisticEntry) GetV() StatisticValue { - if o == nil || o.V == nil { - var ret StatisticValue - return ret - } - return *o.V -} - -// GetVOk returns a tuple with the V field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *StatisticEntry) GetVOk() (*StatisticValue, bool) { - if o == nil || o.V == nil { - return nil, false - } - return o.V, true -} - -// HasV returns a boolean if a field has been set. -func (o *StatisticEntry) HasV() bool { - if o != nil && o.V != nil { - return true - } - - return false -} - -// SetV gets a reference to the given StatisticValue and assigns it to the V field. -func (o *StatisticEntry) SetV(v *StatisticValue) *StatisticEntry { - o.V = v - return o -} - -func (o StatisticEntry) MarshalJSON() ([]byte, error) { - toSerialize := map[string]any{} - if o.T != nil { - toSerialize["t"] = o.T - } - if o.V != nil { - toSerialize["v"] = o.V - } - serialized, err := json.Marshal(toSerialize) - if err != nil { - return nil, fmt.Errorf("failed to marshal StatisticEntry: %w", err) - } - - return serialized, nil -} - -func (o StatisticEntry) String() string { - out := "" - out += fmt.Sprintf(" t=%v\n", o.T) - out += fmt.Sprintf(" v=%v\n", o.V) - return fmt.Sprintf("StatisticEntry {\n%s}", out) -} diff --git a/clients/algoliasearch-client-go/algolia/usage/model_statistic_value.go b/clients/algoliasearch-client-go/algolia/usage/model_statistic_value.go deleted file mode 100644 index 12d9814568..0000000000 --- a/clients/algoliasearch-client-go/algolia/usage/model_statistic_value.go +++ /dev/null @@ -1,85 +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 usage - -import ( - "encoding/json" - "fmt" -) - -// StatisticValue - struct for StatisticValue. -type StatisticValue struct { - Int32 *int32 - MapmapOfStringint32 *map[string]int32 -} - -// int32AsStatisticValue is a convenience function that returns int32 wrapped in StatisticValue. -func Int32AsStatisticValue(v int32) *StatisticValue { - return &StatisticValue{ - Int32: &v, - } -} - -// map[string]int32AsStatisticValue is a convenience function that returns map[string]int32 wrapped in StatisticValue. -func MapmapOfStringint32AsStatisticValue(v map[string]int32) *StatisticValue { - return &StatisticValue{ - MapmapOfStringint32: &v, - } -} - -// Unmarshal JSON data into one of the pointers in the struct. -func (dst *StatisticValue) UnmarshalJSON(data []byte) error { - var err error - // try to unmarshal data into Int32 - err = newStrictDecoder(data).Decode(&dst.Int32) - if err == nil && validateStruct(dst.Int32) == nil { - return nil // found the correct type - } else { - dst.Int32 = nil - } - // try to unmarshal data into MapmapOfStringint32 - err = newStrictDecoder(data).Decode(&dst.MapmapOfStringint32) - if err == nil && validateStruct(dst.MapmapOfStringint32) == nil { - return nil // found the correct type - } else { - dst.MapmapOfStringint32 = nil - } - - return fmt.Errorf("Data failed to match schemas in oneOf(StatisticValue)") -} - -// Marshal data from the first non-nil pointers in the struct to JSON. -func (src StatisticValue) MarshalJSON() ([]byte, error) { - if src.Int32 != nil { - serialized, err := json.Marshal(&src.Int32) - if err != nil { - return nil, fmt.Errorf("failed to unmarshal one of Int32 of StatisticValue: %w", err) - } - - return serialized, nil - } - - if src.MapmapOfStringint32 != nil { - serialized, err := json.Marshal(&src.MapmapOfStringint32) - if err != nil { - return nil, fmt.Errorf("failed to unmarshal one of MapmapOfStringint32 of StatisticValue: %w", err) - } - - return serialized, nil - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance. -func (obj StatisticValue) GetActualInstance() any { - if obj.Int32 != nil { - return *obj.Int32 - } - - if obj.MapmapOfStringint32 != nil { - return *obj.MapmapOfStringint32 - } - - // all schemas are nil - return nil -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorBase.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorBase.java deleted file mode 100644 index 3e3bf4c09b..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorBase.java +++ /dev/null @@ -1,78 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** Error. */ -public class ErrorBase { - - @JsonProperty("message") - private String message; - - private Map additionalProperties = new HashMap<>(); - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public ErrorBase setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - return this; - } - - public ErrorBase setMessage(String message) { - this.message = message; - return this; - } - - /** Get message */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorBase errorBase = (ErrorBase) o; - return Objects.equals(this.message, errorBase.message) && super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(message, super.hashCode()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorBase {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorItem.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorItem.java deleted file mode 100644 index c406b5dc2e..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ErrorItem.java +++ /dev/null @@ -1,112 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.Objects; - -/** ErrorItem */ -public class ErrorItem { - - @JsonProperty("code") - private String code; - - @JsonProperty("message") - private String message; - - @JsonProperty("line") - private Integer line; - - @JsonProperty("position") - private Integer position; - - public ErrorItem setCode(String code) { - this.code = code; - return this; - } - - /** Get code */ - @javax.annotation.Nullable - public String getCode() { - return code; - } - - public ErrorItem setMessage(String message) { - this.message = message; - return this; - } - - /** Get message */ - @javax.annotation.Nonnull - public String getMessage() { - return message; - } - - public ErrorItem setLine(Integer line) { - this.line = line; - return this; - } - - /** Get line */ - @javax.annotation.Nullable - public Integer getLine() { - return line; - } - - public ErrorItem setPosition(Integer position) { - this.position = position; - return this; - } - - /** Get position */ - @javax.annotation.Nullable - public Integer getPosition() { - return position; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ErrorItem errorItem = (ErrorItem) o; - return ( - Objects.equals(this.code, errorItem.code) && - Objects.equals(this.message, errorItem.message) && - Objects.equals(this.line, errorItem.line) && - Objects.equals(this.position, errorItem.position) - ); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, line, position); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ErrorItem {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" line: ").append(toIndentedString(line)).append("\n"); - sb.append(" position: ").append(toIndentedString(position)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ForbiddenError.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ForbiddenError.java deleted file mode 100644 index a5b4fa0349..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/ForbiddenError.java +++ /dev/null @@ -1,106 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** ForbiddenError */ -public class ForbiddenError { - - @JsonProperty("code") - private String code; - - @JsonProperty("message") - private String message; - - @JsonProperty("errors") - private List errors; - - public ForbiddenError setCode(String code) { - this.code = code; - return this; - } - - /** Get code */ - @javax.annotation.Nullable - public String getCode() { - return code; - } - - public ForbiddenError setMessage(String message) { - this.message = message; - return this; - } - - /** Get message */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public ForbiddenError setErrors(List errors) { - this.errors = errors; - return this; - } - - public ForbiddenError addErrors(ErrorItem errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** Get errors */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ForbiddenError forbiddenError = (ForbiddenError) o; - return ( - Objects.equals(this.code, forbiddenError.code) && - Objects.equals(this.message, forbiddenError.message) && - Objects.equals(this.errors, forbiddenError.errors) - ); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, errors); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ForbiddenError {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Granularity.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Granularity.java deleted file mode 100644 index d3c14b4403..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Granularity.java +++ /dev/null @@ -1,40 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; - -/** Gets or Sets granularity */ -public enum Granularity { - HOURLY("hourly"), - - DAILY("daily"); - - private final String value; - - Granularity(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Granularity fromValue(String value) { - for (Granularity b : Granularity.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/IndexUsage.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/IndexUsage.java deleted file mode 100644 index 62facd5207..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/IndexUsage.java +++ /dev/null @@ -1,72 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** IndexUsage */ -public class IndexUsage { - - @JsonProperty("statistics") - private List statistics; - - public IndexUsage setStatistics(List statistics) { - this.statistics = statistics; - return this; - } - - public IndexUsage addStatistics(StatisticEntry statisticsItem) { - if (this.statistics == null) { - this.statistics = new ArrayList<>(); - } - this.statistics.add(statisticsItem); - return this; - } - - /** Get statistics */ - @javax.annotation.Nullable - public List getStatistics() { - return statistics; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IndexUsage indexUsage = (IndexUsage) o; - return Objects.equals(this.statistics, indexUsage.statistics); - } - - @Override - public int hashCode() { - return Objects.hash(statistics); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IndexUsage {\n"); - sb.append(" statistics: ").append(toIndentedString(statistics)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/InvalidRequestError.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/InvalidRequestError.java deleted file mode 100644 index 22d7bb7914..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/InvalidRequestError.java +++ /dev/null @@ -1,106 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** InvalidRequestError */ -public class InvalidRequestError { - - @JsonProperty("code") - private String code; - - @JsonProperty("message") - private String message; - - @JsonProperty("errors") - private List errors; - - public InvalidRequestError setCode(String code) { - this.code = code; - return this; - } - - /** Get code */ - @javax.annotation.Nullable - public String getCode() { - return code; - } - - public InvalidRequestError setMessage(String message) { - this.message = message; - return this; - } - - /** Get message */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public InvalidRequestError setErrors(List errors) { - this.errors = errors; - return this; - } - - public InvalidRequestError addErrors(ErrorItem errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** Get errors */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InvalidRequestError invalidRequestError = (InvalidRequestError) o; - return ( - Objects.equals(this.code, invalidRequestError.code) && - Objects.equals(this.message, invalidRequestError.message) && - Objects.equals(this.errors, invalidRequestError.errors) - ); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, errors); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InvalidRequestError {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Statistic.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Statistic.java deleted file mode 100644 index 19e3d7bfdc..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/Statistic.java +++ /dev/null @@ -1,204 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; - -/** Gets or Sets Statistic */ -public enum Statistic { - ALL("*"), - - 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"), - - NINETY_P_PROCESSING_TIME("90p_processing_time"), - - NINETY_NINE_P_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"); - - private final String value; - - Statistic(String value) { - this.value = value; - } - - @JsonValue - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - @JsonCreator - public static Statistic fromValue(String value) { - for (Statistic b : Statistic.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticEntry.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticEntry.java deleted file mode 100644 index c25ec57b2b..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticEntry.java +++ /dev/null @@ -1,77 +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.model.usage; - -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.util.Objects; - -/** StatisticEntry */ -public class StatisticEntry { - - @JsonProperty("t") - private Integer t; - - @JsonProperty("v") - private StatisticValue v; - - public StatisticEntry setT(Integer t) { - this.t = t; - return this; - } - - /** Timestamp, measured in milliseconds since the Unix epoch. */ - @javax.annotation.Nullable - public Integer getT() { - return t; - } - - public StatisticEntry setV(StatisticValue v) { - this.v = v; - return this; - } - - /** Get v */ - @javax.annotation.Nullable - public StatisticValue getV() { - return v; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - StatisticEntry statisticEntry = (StatisticEntry) o; - return Objects.equals(this.t, statisticEntry.t) && Objects.equals(this.v, statisticEntry.v); - } - - @Override - public int hashCode() { - return Objects.hash(t, v); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StatisticEntry {\n"); - sb.append(" t: ").append(toIndentedString(t)).append("\n"); - sb.append(" v: ").append(toIndentedString(v)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } -} diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticValue.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticValue.java deleted file mode 100644 index 09e90ccb46..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/usage/StatisticValue.java +++ /dev/null @@ -1,111 +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.model.usage; - -import com.algolia.exceptions.AlgoliaRuntimeException; -import com.fasterxml.jackson.annotation.*; -import com.fasterxml.jackson.core.*; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.annotation.*; -import java.io.IOException; -import java.util.Map; -import java.util.logging.Logger; - -/** StatisticValue */ -@JsonDeserialize(using = StatisticValue.Deserializer.class) -public interface StatisticValue { - // StatisticValue as Integer wrapper. - static StatisticValue of(Integer value) { - return new IntegerWrapper(value); - } - - // StatisticValue as Map wrapper. - static StatisticValue of(Map value) { - return new MapOfStringIntegerWrapper(value); - } - - // StatisticValue as Integer wrapper. - @JsonSerialize(using = IntegerWrapper.Serializer.class) - class IntegerWrapper implements StatisticValue { - - private final Integer value; - - IntegerWrapper(Integer value) { - this.value = value; - } - - public Integer getValue() { - return value; - } - - static class Serializer extends JsonSerializer { - - @Override - public void serialize(IntegerWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { - gen.writeObject(value.getValue()); - } - } - } - - // StatisticValue as Map wrapper. - @JsonSerialize(using = MapOfStringIntegerWrapper.Serializer.class) - class MapOfStringIntegerWrapper implements StatisticValue { - - private final Map value; - - MapOfStringIntegerWrapper(Map value) { - this.value = value; - } - - public Map getValue() { - return value; - } - - static class Serializer extends JsonSerializer { - - @Override - public void serialize(MapOfStringIntegerWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { - gen.writeObject(value.getValue()); - } - } - } - - class Deserializer extends JsonDeserializer { - - private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); - - @Override - public StatisticValue deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { - JsonNode tree = jp.readValueAsTree(); - // deserialize Integer - if (tree.isInt()) { - try (JsonParser parser = tree.traverse(jp.getCodec())) { - Integer value = parser.readValueAs(Integer.class); - return new StatisticValue.IntegerWrapper(value); - } catch (Exception e) { - // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf Integer (error: " + e.getMessage() + ") (type: Integer)"); - } - } - // deserialize Map - if (tree.isObject()) { - try (JsonParser parser = tree.traverse(jp.getCodec())) { - Map value = parser.readValueAs(new TypeReference>() {}); - return new StatisticValue.MapOfStringIntegerWrapper(value); - } catch (Exception e) { - // deserialization failed, continue - LOGGER.finest("Failed to deserialize oneOf Map (error: " + e.getMessage() + ") (type: Map)"); - } - } - throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); - } - - /** Handle deserialization of the 'null' value. */ - @Override - public StatisticValue getNullValue(DeserializationContext ctxt) throws JsonMappingException { - throw new JsonMappingException(ctxt.getParser(), "StatisticValue cannot be null"); - } - } -} diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/LICENSE b/clients/algoliasearch-client-javascript/packages/client-usage/LICENSE deleted file mode 100644 index fddf416f92..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-usage/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013-Present Algolia - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/clients/algoliasearch-client-javascript/packages/client-usage/README.md b/clients/algoliasearch-client-javascript/packages/client-usage/README.md deleted file mode 100644 index 90d75fdecf..0000000000 --- a/clients/algoliasearch-client-javascript/packages/client-usage/README.md +++ /dev/null @@ -1,69 +0,0 @@ -

- - Algolia for JavaScript - - -

The perfect starting point to integrate Algolia within your JavaScript project

- -

- NPM version - NPM downloads - jsDelivr Downloads - License -

-

- -

- Documentation • - InstantSearch • - Community Forum • - Stack Overflow • - Report a bug • - FAQ • - Support -

- -## ✨ 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 CustomDeleteAsync(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// This method allow you to send requests to the Algolia REST API. (Synchronous version) - /// - /// 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 - /// object - object CustomDelete(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// 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 CustomGetAsync(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// This method allow you to send requests to the Algolia REST API. (Synchronous version) - /// - /// 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 - /// object - object CustomGet(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// 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) - /// Parameters to send with the custom request. (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 CustomPostAsync(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// This method allow you to send requests to the Algolia REST API. (Synchronous version) - /// - /// Path of the endpoint, anything after \"/1\" must be specified. - /// Query parameters to apply to the current query. (optional) - /// Parameters to send with the custom request. (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 - /// object - object CustomPost(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// 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) - /// Parameters to send with the custom request. (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 CustomPutAsync(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// This method allow you to send requests to the Algolia REST API. (Synchronous version) - /// - /// Path of the endpoint, anything after \"/1\" must be specified. - /// Query parameters to apply to the current query. (optional) - /// Parameters to send with the custom request. (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 - /// object - object CustomPut(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// Retrieves the selected usage statistics for one index. - /// - /// 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. - /// Name of the index on which to perform the operation. - /// Start date of the period to analyze, in RFC 3339 format. - /// End date of the period to analyze, in RFC 3339 format. - /// 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) - /// 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 IndexUsage - Task GetIndexUsageAsync(Statistic statistic, string indexName, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// Retrieves the selected usage statistics for one index. (Synchronous version) - /// - /// 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. - /// Name of the index on which to perform the operation. - /// Start date of the period to analyze, in RFC 3339 format. - /// End date of the period to analyze, in RFC 3339 format. - /// 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) - /// 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 - /// IndexUsage - IndexUsage GetIndexUsage(Statistic statistic, string indexName, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// Retrieves usage statistics evaluated over a specified period. - /// - /// 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 of the period to analyze, in RFC 3339 format. - /// End date of the period to analyze, in RFC 3339 format. - /// 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) - /// 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 IndexUsage - Task GetUsageAsync(Statistic statistic, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default); - - /// - /// Retrieves usage statistics evaluated over a specified period. (Synchronous version) - /// - /// 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 of the period to analyze, in RFC 3339 format. - /// End date of the period to analyze, in RFC 3339 format. - /// 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) - /// 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 - /// IndexUsage - IndexUsage GetUsage(Statistic statistic, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default); - -} - - - -/// -/// Represents a collection of functions to interact with the API endpoints -/// -public partial class UsageClient : IUsageClient -{ - internal HttpTransport _transport; - private readonly ILogger _logger; - - /// - /// Create a new Usage client for the given appID and apiKey. - /// - /// Your application - /// Your API key - /// Logger factory - - public UsageClient(string applicationId, string apiKey, ILoggerFactory loggerFactory = null) : this(new UsageConfig(applicationId, apiKey), new AlgoliaHttpRequester(loggerFactory), loggerFactory) - { - } - - /// - /// Initialize a client with custom config - /// - /// Algolia configuration - /// Logger factory - public UsageClient(UsageConfig config, ILoggerFactory loggerFactory = null) : this(config, new AlgoliaHttpRequester(loggerFactory), loggerFactory) - { - } - - /// - /// Initialize the client with custom config and custom Requester - /// - /// Algolia Config - /// Your Http requester implementation of - /// Logger factory - public UsageClient(UsageConfig config, IHttpRequester httpRequester, ILoggerFactory loggerFactory = null) - { - if (httpRequester == null) - { - throw new ArgumentException("An httpRequester is required"); - } - if (config == null) - { - throw new ArgumentException("A config is required"); - } - if (string.IsNullOrWhiteSpace(config.AppId)) - { - throw new ArgumentException("`AppId` is missing."); - } - if (string.IsNullOrWhiteSpace(config.ApiKey)) - { - throw new ArgumentException("`ApiKey` is missing."); - } - - var factory = loggerFactory ?? NullLoggerFactory.Instance; - _transport = new HttpTransport(config, httpRequester, factory); - _logger = factory.CreateLogger(); - - if (_logger.IsEnabled(Microsoft.Extensions.Logging.LogLevel.Information)) - { - _logger.LogInformation("Algolia Usage client is initialized."); - } - } - - /// - /// Helper to switch the API key sent with each request - /// - /// Your new API Key - /// - public void SetClientApiKey(string apiKey) - { - _transport._algoliaConfig.SetClientApiKey(apiKey); - } - - - - /// - public async Task CustomDeleteAsync(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - if (path == null) - throw new ArgumentException("Parameter `path` is required when calling `CustomDelete`."); - - var requestOptions = new InternalRequestOptions(options); - requestOptions.CustomPathParameters.Add("path", QueryStringHelper.ParameterToString(path)); - - requestOptions.AddCustomQueryParameters(parameters); - return await _transport.ExecuteRequestAsync(new HttpMethod("DELETE"), "/{path}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public object CustomDelete(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => CustomDeleteAsync(path, parameters, options, cancellationToken)); - - - /// - public async Task CustomGetAsync(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - if (path == null) - throw new ArgumentException("Parameter `path` is required when calling `CustomGet`."); - - var requestOptions = new InternalRequestOptions(options); - requestOptions.CustomPathParameters.Add("path", QueryStringHelper.ParameterToString(path)); - - requestOptions.AddCustomQueryParameters(parameters); - return await _transport.ExecuteRequestAsync(new HttpMethod("GET"), "/{path}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public object CustomGet(string path, Dictionary parameters = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => CustomGetAsync(path, parameters, options, cancellationToken)); - - - /// - public async Task CustomPostAsync(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - if (path == null) - throw new ArgumentException("Parameter `path` is required when calling `CustomPost`."); - - var requestOptions = new InternalRequestOptions(options); - requestOptions.CustomPathParameters.Add("path", QueryStringHelper.ParameterToString(path)); - - requestOptions.AddCustomQueryParameters(parameters); - requestOptions.Data = body; - return await _transport.ExecuteRequestAsync(new HttpMethod("POST"), "/{path}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public object CustomPost(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => CustomPostAsync(path, parameters, body, options, cancellationToken)); - - - /// - public async Task CustomPutAsync(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - if (path == null) - throw new ArgumentException("Parameter `path` is required when calling `CustomPut`."); - - var requestOptions = new InternalRequestOptions(options); - requestOptions.CustomPathParameters.Add("path", QueryStringHelper.ParameterToString(path)); - - requestOptions.AddCustomQueryParameters(parameters); - requestOptions.Data = body; - return await _transport.ExecuteRequestAsync(new HttpMethod("PUT"), "/{path}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public object CustomPut(string path, Dictionary parameters = default, object body = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => CustomPutAsync(path, parameters, body, options, cancellationToken)); - - - /// - public async Task GetIndexUsageAsync(Statistic statistic, string indexName, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - - if (indexName == null) - throw new ArgumentException("Parameter `indexName` is required when calling `GetIndexUsage`."); - - - if (startDate == null) - throw new ArgumentException("Parameter `startDate` is required when calling `GetIndexUsage`."); - - - if (endDate == null) - throw new ArgumentException("Parameter `endDate` is required when calling `GetIndexUsage`."); - - var requestOptions = new InternalRequestOptions(options); - - requestOptions.PathParameters.Add("statistic", QueryStringHelper.ParameterToString(statistic)); - requestOptions.PathParameters.Add("indexName", QueryStringHelper.ParameterToString(indexName)); - - requestOptions.AddQueryParameter("startDate", startDate); - requestOptions.AddQueryParameter("endDate", endDate); - requestOptions.AddQueryParameter("granularity", granularity); - return await _transport.ExecuteRequestAsync(new HttpMethod("GET"), "/1/usage/{statistic}/{indexName}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public IndexUsage GetIndexUsage(Statistic statistic, string indexName, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => GetIndexUsageAsync(statistic, indexName, startDate, endDate, granularity, options, cancellationToken)); - - - /// - public async Task GetUsageAsync(Statistic statistic, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default) - { - - - if (startDate == null) - throw new ArgumentException("Parameter `startDate` is required when calling `GetUsage`."); - - - if (endDate == null) - throw new ArgumentException("Parameter `endDate` is required when calling `GetUsage`."); - - var requestOptions = new InternalRequestOptions(options); - - requestOptions.PathParameters.Add("statistic", QueryStringHelper.ParameterToString(statistic)); - - requestOptions.AddQueryParameter("startDate", startDate); - requestOptions.AddQueryParameter("endDate", endDate); - requestOptions.AddQueryParameter("granularity", granularity); - return await _transport.ExecuteRequestAsync(new HttpMethod("GET"), "/1/usage/{statistic}", requestOptions, cancellationToken).ConfigureAwait(false); - } - - - /// - public IndexUsage GetUsage(Statistic statistic, string startDate, string endDate, Granularity? granularity = default, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => GetUsageAsync(statistic, startDate, endDate, granularity, options, cancellationToken)); - -} diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageConfiguration.cs b/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageConfiguration.cs deleted file mode 100644 index 8b7bd33824..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Clients/UsageConfiguration.cs +++ /dev/null @@ -1,48 +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 -* Generated by: https://github.com/openapitools/openapi-generator.git -*/ - - -using System; -using System.Collections.Generic; -using Algolia.Search.Models.Common; -using Algolia.Search.Transport; -using Algolia.Search.Utils; - -namespace Algolia.Search.Clients; - -/// -/// Usage client configuration -/// -public sealed class UsageConfig : AlgoliaConfig -{ - /// - /// The configuration of the Usage client - /// A client should have it's own configuration ie on configuration per client instance - /// - /// Your application ID - /// Your API Key - public UsageConfig(string appId, string apiKey) : base(appId, apiKey, "Usage", "7.3.0") - { - DefaultHosts = GetDefaultHosts(); - Compression = CompressionType.None; - } - private static List GetDefaultHosts() - { - return new List - { - new() - { - Url = "usage.algolia.com", - Up = true, - LastUse = DateTime.UtcNow, - Accept = CallType.Read | CallType.Write - }, - }; - } -} diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorBase.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorBase.cs deleted file mode 100644 index 1ec430131d..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorBase.cs +++ /dev/null @@ -1,101 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// Error. -/// -public partial class ErrorBase -{ - /// - /// Initializes a new instance of the ErrorBase class. - /// - public ErrorBase() - { - AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets Message - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ErrorBase {\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not ErrorBase input) - { - return false; - } - - return - (Message == input.Message || (Message != null && Message.Equals(input.Message))) - && (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any()); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (Message != null) - { - hashCode = (hashCode * 59) + Message.GetHashCode(); - } - if (AdditionalProperties != null) - { - hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorItem.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorItem.cs deleted file mode 100644 index 511b3d3144..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ErrorItem.cs +++ /dev/null @@ -1,125 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// ErrorItem -/// -public partial class ErrorItem -{ - /// - /// Initializes a new instance of the ErrorItem class. - /// - [JsonConstructor] - public ErrorItem() { } - /// - /// Initializes a new instance of the ErrorItem class. - /// - /// message (required). - public ErrorItem(string message) - { - Message = message ?? throw new ArgumentNullException(nameof(message)); - } - - /// - /// Gets or Sets Code - /// - [JsonPropertyName("code")] - public string Code { get; set; } - - /// - /// Gets or Sets Message - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// Gets or Sets Line - /// - [JsonPropertyName("line")] - public int? Line { get; set; } - - /// - /// Gets or Sets Position - /// - [JsonPropertyName("position")] - public int? Position { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ErrorItem {\n"); - sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" Line: ").Append(Line).Append("\n"); - sb.Append(" Position: ").Append(Position).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not ErrorItem input) - { - return false; - } - - return - (Code == input.Code || (Code != null && Code.Equals(input.Code))) && - (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (Line == input.Line || Line.Equals(input.Line)) && - (Position == input.Position || Position.Equals(input.Position)); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (Code != null) - { - hashCode = (hashCode * 59) + Code.GetHashCode(); - } - if (Message != null) - { - hashCode = (hashCode * 59) + Message.GetHashCode(); - } - hashCode = (hashCode * 59) + Line.GetHashCode(); - hashCode = (hashCode * 59) + Position.GetHashCode(); - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ForbiddenError.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ForbiddenError.cs deleted file mode 100644 index 5e51c2c14b..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/ForbiddenError.cs +++ /dev/null @@ -1,112 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// ForbiddenError -/// -public partial class ForbiddenError -{ - /// - /// Initializes a new instance of the ForbiddenError class. - /// - public ForbiddenError() - { - } - - /// - /// Gets or Sets Code - /// - [JsonPropertyName("code")] - public string Code { get; set; } - - /// - /// Gets or Sets Message - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// Gets or Sets Errors - /// - [JsonPropertyName("errors")] - public List Errors { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ForbiddenError {\n"); - sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" Errors: ").Append(Errors).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not ForbiddenError input) - { - return false; - } - - return - (Code == input.Code || (Code != null && Code.Equals(input.Code))) && - (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (Errors == input.Errors || Errors != null && input.Errors != null && Errors.SequenceEqual(input.Errors)); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (Code != null) - { - hashCode = (hashCode * 59) + Code.GetHashCode(); - } - if (Message != null) - { - hashCode = (hashCode * 59) + Message.GetHashCode(); - } - if (Errors != null) - { - hashCode = (hashCode * 59) + Errors.GetHashCode(); - } - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Granularity.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Granularity.cs deleted file mode 100644 index 694fdd6d0d..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Granularity.cs +++ /dev/null @@ -1,31 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// Defines granularity -/// -public enum Granularity -{ - /// - /// Enum Hourly for value: hourly - /// - [JsonPropertyName("hourly")] - Hourly = 1, - - /// - /// Enum Daily for value: daily - /// - [JsonPropertyName("daily")] - Daily = 2 -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/IndexUsage.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/IndexUsage.cs deleted file mode 100644 index 62201065a0..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/IndexUsage.cs +++ /dev/null @@ -1,88 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// IndexUsage -/// -public partial class IndexUsage -{ - /// - /// Initializes a new instance of the IndexUsage class. - /// - public IndexUsage() - { - } - - /// - /// Gets or Sets Statistics - /// - [JsonPropertyName("statistics")] - public List Statistics { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class IndexUsage {\n"); - sb.Append(" Statistics: ").Append(Statistics).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not IndexUsage input) - { - return false; - } - - return - (Statistics == input.Statistics || Statistics != null && input.Statistics != null && Statistics.SequenceEqual(input.Statistics)); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (Statistics != null) - { - hashCode = (hashCode * 59) + Statistics.GetHashCode(); - } - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/InvalidRequestError.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/InvalidRequestError.cs deleted file mode 100644 index 0ed688da7b..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/InvalidRequestError.cs +++ /dev/null @@ -1,112 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// InvalidRequestError -/// -public partial class InvalidRequestError -{ - /// - /// Initializes a new instance of the InvalidRequestError class. - /// - public InvalidRequestError() - { - } - - /// - /// Gets or Sets Code - /// - [JsonPropertyName("code")] - public string Code { get; set; } - - /// - /// Gets or Sets Message - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// Gets or Sets Errors - /// - [JsonPropertyName("errors")] - public List Errors { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class InvalidRequestError {\n"); - sb.Append(" Code: ").Append(Code).Append("\n"); - sb.Append(" Message: ").Append(Message).Append("\n"); - sb.Append(" Errors: ").Append(Errors).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not InvalidRequestError input) - { - return false; - } - - return - (Code == input.Code || (Code != null && Code.Equals(input.Code))) && - (Message == input.Message || (Message != null && Message.Equals(input.Message))) && - (Errors == input.Errors || Errors != null && input.Errors != null && Errors.SequenceEqual(input.Errors)); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (Code != null) - { - hashCode = (hashCode * 59) + Code.GetHashCode(); - } - if (Message != null) - { - hashCode = (hashCode * 59) + Message.GetHashCode(); - } - if (Errors != null) - { - hashCode = (hashCode * 59) + Errors.GetHashCode(); - } - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Statistic.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Statistic.cs deleted file mode 100644 index f5d204106b..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/Statistic.cs +++ /dev/null @@ -1,523 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// Defines Statistic -/// -public enum Statistic -{ - /// - /// Enum Star for value: * - /// - [JsonPropertyName("*")] - Star = 1, - - /// - /// Enum SearchOperations for value: search_operations - /// - [JsonPropertyName("search_operations")] - SearchOperations = 2, - - /// - /// Enum TotalSearchOperations for value: total_search_operations - /// - [JsonPropertyName("total_search_operations")] - TotalSearchOperations = 3, - - /// - /// Enum TotalSearchRequests for value: total_search_requests - /// - [JsonPropertyName("total_search_requests")] - TotalSearchRequests = 4, - - /// - /// Enum QueriesOperations for value: queries_operations - /// - [JsonPropertyName("queries_operations")] - QueriesOperations = 5, - - /// - /// Enum MultiQueriesOperations for value: multi_queries_operations - /// - [JsonPropertyName("multi_queries_operations")] - MultiQueriesOperations = 6, - - /// - /// Enum AclOperations for value: acl_operations - /// - [JsonPropertyName("acl_operations")] - AclOperations = 7, - - /// - /// Enum TotalAclOperations for value: total_acl_operations - /// - [JsonPropertyName("total_acl_operations")] - TotalAclOperations = 8, - - /// - /// Enum GetApiKeysOperations for value: get_api_keys_operations - /// - [JsonPropertyName("get_api_keys_operations")] - GetApiKeysOperations = 9, - - /// - /// Enum GetApiKeyOperations for value: get_api_key_operations - /// - [JsonPropertyName("get_api_key_operations")] - GetApiKeyOperations = 10, - - /// - /// Enum AddApiKeyOperations for value: add_api_key_operations - /// - [JsonPropertyName("add_api_key_operations")] - AddApiKeyOperations = 11, - - /// - /// Enum UpdateApiKeyOperations for value: update_api_key_operations - /// - [JsonPropertyName("update_api_key_operations")] - UpdateApiKeyOperations = 12, - - /// - /// Enum DeleteApiKeyOperations for value: delete_api_key_operations - /// - [JsonPropertyName("delete_api_key_operations")] - DeleteApiKeyOperations = 13, - - /// - /// Enum ListApiKeyOperations for value: list_api_key_operations - /// - [JsonPropertyName("list_api_key_operations")] - ListApiKeyOperations = 14, - - /// - /// Enum IndexingOperations for value: indexing_operations - /// - [JsonPropertyName("indexing_operations")] - IndexingOperations = 15, - - /// - /// Enum TotalIndexingOperations for value: total_indexing_operations - /// - [JsonPropertyName("total_indexing_operations")] - TotalIndexingOperations = 16, - - /// - /// Enum BrowseOperations for value: browse_operations - /// - [JsonPropertyName("browse_operations")] - BrowseOperations = 17, - - /// - /// Enum ClearIndexOperations for value: clear_index_operations - /// - [JsonPropertyName("clear_index_operations")] - ClearIndexOperations = 18, - - /// - /// Enum CopyMoveOperations for value: copy_move_operations - /// - [JsonPropertyName("copy_move_operations")] - CopyMoveOperations = 19, - - /// - /// Enum DeleteIndexOperations for value: delete_index_operations - /// - [JsonPropertyName("delete_index_operations")] - DeleteIndexOperations = 20, - - /// - /// Enum GetLogOperations for value: get_log_operations - /// - [JsonPropertyName("get_log_operations")] - GetLogOperations = 21, - - /// - /// Enum GetSettingsOperations for value: get_settings_operations - /// - [JsonPropertyName("get_settings_operations")] - GetSettingsOperations = 22, - - /// - /// Enum SetSettingsOperations for value: set_settings_operations - /// - [JsonPropertyName("set_settings_operations")] - SetSettingsOperations = 23, - - /// - /// Enum ListIndicesOperations for value: list_indices_operations - /// - [JsonPropertyName("list_indices_operations")] - ListIndicesOperations = 24, - - /// - /// Enum WaitTaskOperations for value: wait_task_operations - /// - [JsonPropertyName("wait_task_operations")] - WaitTaskOperations = 25, - - /// - /// Enum RecordOperations for value: record_operations - /// - [JsonPropertyName("record_operations")] - RecordOperations = 26, - - /// - /// Enum TotalRecordsOperations for value: total_records_operations - /// - [JsonPropertyName("total_records_operations")] - TotalRecordsOperations = 27, - - /// - /// Enum AddRecordOperations for value: add_record_operations - /// - [JsonPropertyName("add_record_operations")] - AddRecordOperations = 28, - - /// - /// Enum BatchOperations for value: batch_operations - /// - [JsonPropertyName("batch_operations")] - BatchOperations = 29, - - /// - /// Enum DeleteByQueryOperations for value: delete_by_query_operations - /// - [JsonPropertyName("delete_by_query_operations")] - DeleteByQueryOperations = 30, - - /// - /// Enum DeleteRecordOperations for value: delete_record_operations - /// - [JsonPropertyName("delete_record_operations")] - DeleteRecordOperations = 31, - - /// - /// Enum GetRecordOperations for value: get_record_operations - /// - [JsonPropertyName("get_record_operations")] - GetRecordOperations = 32, - - /// - /// Enum PartialUpdateRecordOperations for value: partial_update_record_operations - /// - [JsonPropertyName("partial_update_record_operations")] - PartialUpdateRecordOperations = 33, - - /// - /// Enum UpdateRecordOperations for value: update_record_operations - /// - [JsonPropertyName("update_record_operations")] - UpdateRecordOperations = 34, - - /// - /// Enum SynonymOperations for value: synonym_operations - /// - [JsonPropertyName("synonym_operations")] - SynonymOperations = 35, - - /// - /// Enum TotalSynonymOperations for value: total_synonym_operations - /// - [JsonPropertyName("total_synonym_operations")] - TotalSynonymOperations = 36, - - /// - /// Enum BatchSynonymOperations for value: batch_synonym_operations - /// - [JsonPropertyName("batch_synonym_operations")] - BatchSynonymOperations = 37, - - /// - /// Enum ClearSynonymOperations for value: clear_synonym_operations - /// - [JsonPropertyName("clear_synonym_operations")] - ClearSynonymOperations = 38, - - /// - /// Enum DeleteSynonymOperations for value: delete_synonym_operations - /// - [JsonPropertyName("delete_synonym_operations")] - DeleteSynonymOperations = 39, - - /// - /// Enum GetSynonymOperations for value: get_synonym_operations - /// - [JsonPropertyName("get_synonym_operations")] - GetSynonymOperations = 40, - - /// - /// Enum QuerySynonymOperations for value: query_synonym_operations - /// - [JsonPropertyName("query_synonym_operations")] - QuerySynonymOperations = 41, - - /// - /// Enum UpdateSynonymOperations for value: update_synonym_operations - /// - [JsonPropertyName("update_synonym_operations")] - UpdateSynonymOperations = 42, - - /// - /// Enum RuleOperations for value: rule_operations - /// - [JsonPropertyName("rule_operations")] - RuleOperations = 43, - - /// - /// Enum TotalRulesOperations for value: total_rules_operations - /// - [JsonPropertyName("total_rules_operations")] - TotalRulesOperations = 44, - - /// - /// Enum BatchRulesOperations for value: batch_rules_operations - /// - [JsonPropertyName("batch_rules_operations")] - BatchRulesOperations = 45, - - /// - /// Enum ClearRulesOperations for value: clear_rules_operations - /// - [JsonPropertyName("clear_rules_operations")] - ClearRulesOperations = 46, - - /// - /// Enum DeleteRulesOperations for value: delete_rules_operations - /// - [JsonPropertyName("delete_rules_operations")] - DeleteRulesOperations = 47, - - /// - /// Enum GetRulesOperations for value: get_rules_operations - /// - [JsonPropertyName("get_rules_operations")] - GetRulesOperations = 48, - - /// - /// Enum SaveRulesOperations for value: save_rules_operations - /// - [JsonPropertyName("save_rules_operations")] - SaveRulesOperations = 49, - - /// - /// Enum SearchRulesOperations for value: search_rules_operations - /// - [JsonPropertyName("search_rules_operations")] - SearchRulesOperations = 50, - - /// - /// Enum TotalRecommendRequests for value: total_recommend_requests - /// - [JsonPropertyName("total_recommend_requests")] - TotalRecommendRequests = 51, - - /// - /// Enum TotalWriteOperations for value: total_write_operations - /// - [JsonPropertyName("total_write_operations")] - TotalWriteOperations = 52, - - /// - /// Enum TotalReadOperations for value: total_read_operations - /// - [JsonPropertyName("total_read_operations")] - TotalReadOperations = 53, - - /// - /// Enum TotalOperations for value: total_operations - /// - [JsonPropertyName("total_operations")] - TotalOperations = 54, - - /// - /// Enum QuerysuggestionsTotalSearchOperations for value: querysuggestions_total_search_operations - /// - [JsonPropertyName("querysuggestions_total_search_operations")] - QuerysuggestionsTotalSearchOperations = 55, - - /// - /// Enum QuerysuggestionsTotalSearchRequests for value: querysuggestions_total_search_requests - /// - [JsonPropertyName("querysuggestions_total_search_requests")] - QuerysuggestionsTotalSearchRequests = 56, - - /// - /// Enum QuerysuggestionsTotalAclOperations for value: querysuggestions_total_acl_operations - /// - [JsonPropertyName("querysuggestions_total_acl_operations")] - QuerysuggestionsTotalAclOperations = 57, - - /// - /// Enum QuerysuggestionsTotalIndexingOperations for value: querysuggestions_total_indexing_operations - /// - [JsonPropertyName("querysuggestions_total_indexing_operations")] - QuerysuggestionsTotalIndexingOperations = 58, - - /// - /// Enum QuerysuggestionsTotalRecordsOperations for value: querysuggestions_total_records_operations - /// - [JsonPropertyName("querysuggestions_total_records_operations")] - QuerysuggestionsTotalRecordsOperations = 59, - - /// - /// Enum QuerysuggestionsTotalSynonymOperations for value: querysuggestions_total_synonym_operations - /// - [JsonPropertyName("querysuggestions_total_synonym_operations")] - QuerysuggestionsTotalSynonymOperations = 60, - - /// - /// Enum QuerysuggestionsTotalRulesOperations for value: querysuggestions_total_rules_operations - /// - [JsonPropertyName("querysuggestions_total_rules_operations")] - QuerysuggestionsTotalRulesOperations = 61, - - /// - /// Enum QuerysuggestionsTotalWriteOperations for value: querysuggestions_total_write_operations - /// - [JsonPropertyName("querysuggestions_total_write_operations")] - QuerysuggestionsTotalWriteOperations = 62, - - /// - /// Enum QuerysuggestionsTotalReadOperations for value: querysuggestions_total_read_operations - /// - [JsonPropertyName("querysuggestions_total_read_operations")] - QuerysuggestionsTotalReadOperations = 63, - - /// - /// Enum QuerysuggestionsTotalOperations for value: querysuggestions_total_operations - /// - [JsonPropertyName("querysuggestions_total_operations")] - QuerysuggestionsTotalOperations = 64, - - /// - /// Enum AvgProcessingTime for value: avg_processing_time - /// - [JsonPropertyName("avg_processing_time")] - AvgProcessingTime = 65, - - /// - /// Enum _90pProcessingTime for value: 90p_processing_time - /// - [JsonPropertyName("90p_processing_time")] - _90pProcessingTime = 66, - - /// - /// Enum _99pProcessingTime for value: 99p_processing_time - /// - [JsonPropertyName("99p_processing_time")] - _99pProcessingTime = 67, - - /// - /// Enum QueriesAboveLastMsProcessingTime for value: queries_above_last_ms_processing_time - /// - [JsonPropertyName("queries_above_last_ms_processing_time")] - QueriesAboveLastMsProcessingTime = 68, - - /// - /// Enum Records for value: records - /// - [JsonPropertyName("records")] - Records = 69, - - /// - /// Enum DataSize for value: data_size - /// - [JsonPropertyName("data_size")] - DataSize = 70, - - /// - /// Enum FileSize for value: file_size - /// - [JsonPropertyName("file_size")] - FileSize = 71, - - /// - /// Enum MaxQps for value: max_qps - /// - [JsonPropertyName("max_qps")] - MaxQps = 72, - - /// - /// Enum RegionMaxQps for value: region_max_qps - /// - [JsonPropertyName("region_max_qps")] - RegionMaxQps = 73, - - /// - /// Enum TotalMaxQps for value: total_max_qps - /// - [JsonPropertyName("total_max_qps")] - TotalMaxQps = 74, - - /// - /// Enum UsedSearchCapacity for value: used_search_capacity - /// - [JsonPropertyName("used_search_capacity")] - UsedSearchCapacity = 75, - - /// - /// Enum AvgUsedSearchCapacity for value: avg_used_search_capacity - /// - [JsonPropertyName("avg_used_search_capacity")] - AvgUsedSearchCapacity = 76, - - /// - /// Enum RegionUsedSearchCapacity for value: region_used_search_capacity - /// - [JsonPropertyName("region_used_search_capacity")] - RegionUsedSearchCapacity = 77, - - /// - /// Enum RegionAvgUsedSearchCapacity for value: region_avg_used_search_capacity - /// - [JsonPropertyName("region_avg_used_search_capacity")] - RegionAvgUsedSearchCapacity = 78, - - /// - /// Enum TotalUsedSearchCapacity for value: total_used_search_capacity - /// - [JsonPropertyName("total_used_search_capacity")] - TotalUsedSearchCapacity = 79, - - /// - /// Enum TotalAvgUsedSearchCapacity for value: total_avg_used_search_capacity - /// - [JsonPropertyName("total_avg_used_search_capacity")] - TotalAvgUsedSearchCapacity = 80, - - /// - /// Enum DegradedQueriesSsdUsedQueriesImpacted for value: degraded_queries_ssd_used_queries_impacted - /// - [JsonPropertyName("degraded_queries_ssd_used_queries_impacted")] - DegradedQueriesSsdUsedQueriesImpacted = 81, - - /// - /// Enum DegradedQueriesSsdUsedSecondsImpacted for value: degraded_queries_ssd_used_seconds_impacted - /// - [JsonPropertyName("degraded_queries_ssd_used_seconds_impacted")] - DegradedQueriesSsdUsedSecondsImpacted = 82, - - /// - /// Enum DegradedQueriesMaxCapacityQueriesImpacted for value: degraded_queries_max_capacity_queries_impacted - /// - [JsonPropertyName("degraded_queries_max_capacity_queries_impacted")] - DegradedQueriesMaxCapacityQueriesImpacted = 83, - - /// - /// Enum DegradedQueriesMaxCapacitySecondsImpacted for value: degraded_queries_max_capacity_seconds_impacted - /// - [JsonPropertyName("degraded_queries_max_capacity_seconds_impacted")] - DegradedQueriesMaxCapacitySecondsImpacted = 84 -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticEntry.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticEntry.cs deleted file mode 100644 index b63da7b61b..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticEntry.cs +++ /dev/null @@ -1,98 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; - -namespace Algolia.Search.Models.Usage; - -/// -/// StatisticEntry -/// -public partial class StatisticEntry -{ - /// - /// Initializes a new instance of the StatisticEntry class. - /// - public StatisticEntry() - { - } - - /// - /// Timestamp, measured in milliseconds since the Unix epoch. - /// - /// Timestamp, measured in milliseconds since the Unix epoch. - [JsonPropertyName("t")] - public int? T { get; set; } - - /// - /// Gets or Sets V - /// - [JsonPropertyName("v")] - public StatisticValue V { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class StatisticEntry {\n"); - sb.Append(" T: ").Append(T).Append("\n"); - sb.Append(" V: ").Append(V).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return JsonSerializer.Serialize(this, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not StatisticEntry input) - { - return false; - } - - return - (T == input.T || T.Equals(input.T)) && - (V == input.V || (V != null && V.Equals(input.V))); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - hashCode = (hashCode * 59) + T.GetHashCode(); - if (V != null) - { - hashCode = (hashCode * 59) + V.GetHashCode(); - } - return hashCode; - } - } - -} - diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticValue.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticValue.cs deleted file mode 100644 index 2fee556a60..0000000000 --- a/clients/algoliasearch-client-csharp/algoliasearch/Models/Usage/StatisticValue.cs +++ /dev/null @@ -1,210 +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.Text; -using System.Linq; -using System.Text.Json.Serialization; -using System.Collections.Generic; -using Algolia.Search.Serializer; -using System.Text.Json; -using System.IO; -using System.Reflection; -using Algolia.Search.Models.Common; - -namespace Algolia.Search.Models.Usage; - -/// -/// StatisticValue -/// -[JsonConverter(typeof(StatisticValueJsonConverter))] -public partial class StatisticValue : AbstractSchema -{ - /// - /// Initializes a new instance of the StatisticValue class - /// with a int - /// - /// An instance of int. - public StatisticValue(int actualInstance) - { - ActualInstance = actualInstance; - } - - /// - /// Initializes a new instance of the StatisticValue class - /// with a Dictionary{string, int} - /// - /// An instance of Dictionary<string, int>. - public StatisticValue(Dictionary actualInstance) - { - ActualInstance = actualInstance; - } - - - /// - /// Gets or Sets ActualInstance - /// - public sealed override object ActualInstance { get; set; } - - /// - /// Get the actual instance of `int`. If the actual instance is not `int`, - /// the InvalidClassException will be thrown - /// - /// An instance of int - public int AsInt() - { - return (int)ActualInstance; - } - - /// - /// Get the actual instance of `Dictionary{string, int}`. If the actual instance is not `Dictionary{string, int}`, - /// the InvalidClassException will be thrown - /// - /// An instance of Dictionary<string, int> - public Dictionary AsDictionaryInt() - { - return (Dictionary)ActualInstance; - } - - - /// - /// Check if the actual instance is of `int` type. - /// - /// Whether or not the instance is the type - public bool IsInt() - { - return ActualInstance.GetType() == typeof(int); - } - - /// - /// Check if the actual instance is of `Dictionary{string, int}` type. - /// - /// Whether or not the instance is the type - public bool IsDictionaryInt() - { - return ActualInstance.GetType() == typeof(Dictionary); - } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - var sb = new StringBuilder(); - sb.Append("class StatisticValue {\n"); - sb.Append(" ActualInstance: ").Append(ActualInstance).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public override string ToJson() - { - return JsonSerializer.Serialize(ActualInstance, JsonConfig.Options); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object obj) - { - if (obj is not StatisticValue input) - { - return false; - } - - return ActualInstance.Equals(input.ActualInstance); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (ActualInstance != null) - hashCode = hashCode * 59 + ActualInstance.GetHashCode(); - return hashCode; - } - } -} - - - - - -/// -/// Custom JSON converter for StatisticValue -/// -public class StatisticValueJsonConverter : JsonConverter -{ - - /// - /// Check if the object can be converted - /// - /// Object type - /// True if the object can be converted - public override bool CanConvert(Type objectType) - { - return objectType == typeof(StatisticValue); - } - - /// - /// To convert a JSON string into an object - /// - /// JSON reader - /// Object type - /// Serializer options - /// The object converted from the JSON string - public override StatisticValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - var jsonDocument = JsonDocument.ParseValue(ref reader); - var root = jsonDocument.RootElement; - if (root.ValueKind == JsonValueKind.Number) - { - try - { - return new StatisticValue(jsonDocument.Deserialize(JsonConfig.Options)); - } - catch (Exception exception) - { - // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine($"Failed to deserialize into int: {exception}"); - } - } - if (root.ValueKind == JsonValueKind.Object) - { - try - { - return new StatisticValue(jsonDocument.Deserialize>(JsonConfig.Options)); - } - catch (Exception exception) - { - // deserialization failed, try the next one - System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary: {exception}"); - } - } - throw new InvalidDataException($"The JSON string cannot be deserialized into any schema defined."); - } - - /// - /// To write the JSON string - /// - /// JSON writer - /// StatisticValue to be converted into a JSON string - /// JSON Serializer options - public override void Write(Utf8JsonWriter writer, StatisticValue value, JsonSerializerOptions options) - { - writer.WriteRawValue(value.ToJson()); - } -} - diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/UsageClient.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/UsageClient.java deleted file mode 100644 index bbd7ee0875..0000000000 --- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/UsageClient.java +++ /dev/null @@ -1,2685 +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.api; - -import com.algolia.ApiClient; -import com.algolia.config.*; -import com.algolia.config.ClientOptions; -import com.algolia.exceptions.*; -import com.algolia.model.usage.*; -import com.algolia.utils.*; -import com.fasterxml.jackson.core.type.TypeReference; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import javax.annotation.Nonnull; - -public class UsageClient extends ApiClient { - - public UsageClient(String appId, String apiKey) { - this(appId, apiKey, null); - } - - public UsageClient(String appId, String apiKey, ClientOptions options) { - super(appId, apiKey, "Usage", options, getDefaultHosts()); - } - - private static List getDefaultHosts() { - List hosts = new ArrayList<>(); - hosts.add(new Host("usage.algolia.com", EnumSet.of(CallType.READ, CallType.WRITE))); - return hosts; - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customDelete(@Nonnull String path, Map parameters, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - return LaunderThrowable.await(customDeleteAsync(path, parameters, requestOptions)); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customDelete(@Nonnull String path, Map parameters) throws AlgoliaRuntimeException { - return this.customDelete(path, parameters, null); - } - - /** - * 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customDelete(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customDelete(path, null, requestOptions); - } - - /** - * 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customDelete(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customDelete(path, null, null); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customDeleteAsync(@Nonnull String path, Map parameters, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`."); - - HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customDeleteAsync(@Nonnull String path, Map parameters) throws AlgoliaRuntimeException { - return this.customDeleteAsync(path, parameters, null); - } - - /** - * (asynchronously) 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customDeleteAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customDeleteAsync(path, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customDeleteAsync(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customDeleteAsync(path, null, null); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customGet(@Nonnull String path, Map parameters, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - return LaunderThrowable.await(customGetAsync(path, parameters, requestOptions)); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customGet(@Nonnull String path, Map parameters) throws AlgoliaRuntimeException { - return this.customGet(path, parameters, null); - } - - /** - * 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customGet(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customGet(path, null, requestOptions); - } - - /** - * 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customGet(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customGet(path, null, null); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customGetAsync(@Nonnull String path, Map parameters, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`."); - - HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customGetAsync(@Nonnull String path, Map parameters) throws AlgoliaRuntimeException { - return this.customGetAsync(path, parameters, null); - } - - /** - * (asynchronously) 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customGetAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customGetAsync(path, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customGetAsync(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customGetAsync(path, null, null); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPost(@Nonnull String path, Map parameters, Object body, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - return LaunderThrowable.await(customPostAsync(path, parameters, body, requestOptions)); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPost(@Nonnull String path, Map parameters, Object body) throws AlgoliaRuntimeException { - return this.customPost(path, parameters, body, null); - } - - /** - * 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPost(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customPost(path, null, null, requestOptions); - } - - /** - * 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPost(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customPost(path, null, null, null); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPostAsync( - @Nonnull String path, - Map parameters, - Object body, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`."); - - HttpRequest request = HttpRequest.builder() - .setPathEncoded("/{path}", path) - .setMethod("POST") - .setBody(body) - .addQueryParameters(parameters) - .build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPostAsync(@Nonnull String path, Map parameters, Object body) - throws AlgoliaRuntimeException { - return this.customPostAsync(path, parameters, body, null); - } - - /** - * (asynchronously) 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPostAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customPostAsync(path, null, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPostAsync(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customPostAsync(path, null, null, null); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPut(@Nonnull String path, Map parameters, Object body, RequestOptions requestOptions) - throws AlgoliaRuntimeException { - return LaunderThrowable.await(customPutAsync(path, parameters, body, requestOptions)); - } - - /** - * 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPut(@Nonnull String path, Map parameters, Object body) throws AlgoliaRuntimeException { - return this.customPut(path, parameters, body, null); - } - - /** - * 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPut(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customPut(path, null, null, requestOptions); - } - - /** - * 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public Object customPut(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customPut(path, null, null, null); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPutAsync( - @Nonnull String path, - Map parameters, - Object body, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`."); - - HttpRequest request = HttpRequest.builder() - .setPathEncoded("/{path}", path) - .setMethod("PUT") - .setBody(body) - .addQueryParameters(parameters) - .build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param parameters Query parameters to apply to the current query. (optional) - * @param body Parameters to send with the custom request. (optional) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPutAsync(@Nonnull String path, Map parameters, Object body) - throws AlgoliaRuntimeException { - return this.customPutAsync(path, parameters, body, null); - } - - /** - * (asynchronously) 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) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPutAsync(@Nonnull String path, RequestOptions requestOptions) throws AlgoliaRuntimeException { - return this.customPutAsync(path, null, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture customPutAsync(@Nonnull String path) throws AlgoliaRuntimeException { - return this.customPutAsync(path, null, null, null); - } - - /** - * 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getIndexUsage( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return LaunderThrowable.await(getIndexUsageAsync(statistic, indexName, startDate, endDate, granularity, requestOptions)); - } - - /** - * 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getIndexUsage( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity - ) throws AlgoliaRuntimeException { - return this.getIndexUsage(statistic, indexName, startDate, endDate, granularity, null); - } - - /** - * 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getIndexUsage( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return this.getIndexUsage(statistic, indexName, startDate, endDate, null, requestOptions); - } - - /** - * 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getIndexUsage( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate - ) throws AlgoliaRuntimeException { - return this.getIndexUsage(statistic, indexName, startDate, endDate, null, null); - } - - /** - * (asynchronously) 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getIndexUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - Parameters.requireNonNull(statistic, "Parameter `statistic` is required when calling `getIndexUsage`."); - - Parameters.requireNonNull(indexName, "Parameter `indexName` is required when calling `getIndexUsage`."); - - Parameters.requireNonNull(startDate, "Parameter `startDate` is required when calling `getIndexUsage`."); - - Parameters.requireNonNull(endDate, "Parameter `endDate` is required when calling `getIndexUsage`."); - - HttpRequest request = HttpRequest.builder() - .setPath("/1/usage/{statistic}/{indexName}", statistic, indexName) - .setMethod("GET") - .addQueryParameter("startDate", startDate) - .addQueryParameter("endDate", endDate) - .addQueryParameter("granularity", granularity) - .build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getIndexUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity - ) throws AlgoliaRuntimeException { - return this.getIndexUsageAsync(statistic, indexName, startDate, endDate, granularity, null); - } - - /** - * (asynchronously) 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getIndexUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return this.getIndexUsageAsync(statistic, indexName, startDate, endDate, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @param indexName Name of the index on which to perform the operation. (required) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getIndexUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String indexName, - @Nonnull String startDate, - @Nonnull String endDate - ) throws AlgoliaRuntimeException { - return this.getIndexUsageAsync(statistic, indexName, startDate, endDate, null, null); - } - - /** - * 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getUsage( - @Nonnull Statistic statistic, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return LaunderThrowable.await(getUsageAsync(statistic, startDate, endDate, granularity, requestOptions)); - } - - /** - * 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getUsage(@Nonnull Statistic statistic, @Nonnull String startDate, @Nonnull String endDate, Granularity granularity) - throws AlgoliaRuntimeException { - return this.getUsage(statistic, startDate, endDate, granularity, null); - } - - /** - * 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getUsage( - @Nonnull Statistic statistic, - @Nonnull String startDate, - @Nonnull String endDate, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return this.getUsage(statistic, startDate, endDate, null, requestOptions); - } - - /** - * 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public IndexUsage getUsage(@Nonnull Statistic statistic, @Nonnull String startDate, @Nonnull String endDate) - throws AlgoliaRuntimeException { - return this.getUsage(statistic, startDate, endDate, null, null); - } - - /** - * (asynchronously) 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - Parameters.requireNonNull(statistic, "Parameter `statistic` is required when calling `getUsage`."); - - Parameters.requireNonNull(startDate, "Parameter `startDate` is required when calling `getUsage`."); - - Parameters.requireNonNull(endDate, "Parameter `endDate` is required when calling `getUsage`."); - - HttpRequest request = HttpRequest.builder() - .setPath("/1/usage/{statistic}", statistic) - .setMethod("GET") - .addQueryParameter("startDate", startDate) - .addQueryParameter("endDate", endDate) - .addQueryParameter("granularity", granularity) - .build(); - return executeAsync(request, requestOptions, new TypeReference() {}); - } - - /** - * (asynchronously) 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @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. (optional, default to daily) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String startDate, - @Nonnull String endDate, - Granularity granularity - ) throws AlgoliaRuntimeException { - return this.getUsageAsync(statistic, startDate, endDate, granularity, null); - } - - /** - * (asynchronously) 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @param requestOptions The requestOptions to send along with the query, they will be merged with - * the transporter requestOptions. - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getUsageAsync( - @Nonnull Statistic statistic, - @Nonnull String startDate, - @Nonnull String endDate, - RequestOptions requestOptions - ) throws AlgoliaRuntimeException { - return this.getUsageAsync(statistic, startDate, endDate, null, requestOptions); - } - - /** - * (asynchronously) 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) - * @param startDate Start date of the period to analyze, in RFC 3339 format. (required) - * @param endDate End date of the period to analyze, in RFC 3339 format. (required) - * @throws AlgoliaRuntimeException If it fails to process the API call - */ - public CompletableFuture getUsageAsync(@Nonnull Statistic statistic, @Nonnull String startDate, @Nonnull String endDate) - throws AlgoliaRuntimeException { - return this.getUsageAsync(statistic, startDate, endDate, null, null); - } -} diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/UsageClient.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/UsageClient.kt deleted file mode 100644 index 963ff3e889..0000000000 --- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/UsageClient.kt +++ /dev/null @@ -1,170 +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.api - -import com.algolia.client.configuration.* -import com.algolia.client.exception.* -import com.algolia.client.extensions.internal.* -import com.algolia.client.model.usage.* -import com.algolia.client.transport.* -import com.algolia.client.transport.internal.* -import kotlinx.serialization.json.* - -public class UsageClient( - override val appId: String, - override var apiKey: String, - override val options: ClientOptions = ClientOptions(), -) : ApiClient { - - init { - require(appId.isNotBlank()) { "`appId` is missing." } - require(apiKey.isNotBlank()) { "`apiKey` is missing." } - } - - override val requester: Requester = requesterOf(clientName = "Usage", appId = appId, apiKey = apiKey, options = options) { - listOf( - Host("usage.algolia.com"), - ) - } - - /** - * This method allow you to send requests to the Algolia REST API. - * @param path Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters Query parameters to apply to the current query. - * @param requestOptions additional request configuration. - */ - public suspend fun customDelete(path: String, parameters: Map? = null, requestOptions: RequestOptions? = null): JsonObject { - require(path.isNotBlank()) { "Parameter `path` is required when calling `customDelete`." } - val requestConfig = RequestConfig( - method = RequestMethod.DELETE, - path = "/{path}".replace("{path}", path), - query = buildMap { - parameters?.let { putAll(it) } - }, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } - - /** - * This method allow you to send requests to the Algolia REST API. - * @param path Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters Query parameters to apply to the current query. - * @param requestOptions additional request configuration. - */ - public suspend fun customGet(path: String, parameters: Map? = null, requestOptions: RequestOptions? = null): JsonObject { - require(path.isNotBlank()) { "Parameter `path` is required when calling `customGet`." } - val requestConfig = RequestConfig( - method = RequestMethod.GET, - path = "/{path}".replace("{path}", path), - query = buildMap { - parameters?.let { putAll(it) } - }, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } - - /** - * This method allow you to send requests to the Algolia REST API. - * @param path Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters Query parameters to apply to the current query. - * @param body Parameters to send with the custom request. - * @param requestOptions additional request configuration. - */ - public suspend fun customPost(path: String, parameters: Map? = null, body: JsonObject? = null, requestOptions: RequestOptions? = null): JsonObject { - require(path.isNotBlank()) { "Parameter `path` is required when calling `customPost`." } - val requestConfig = RequestConfig( - method = RequestMethod.POST, - path = "/{path}".replace("{path}", path), - query = buildMap { - parameters?.let { putAll(it) } - }, - body = body, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } - - /** - * This method allow you to send requests to the Algolia REST API. - * @param path Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters Query parameters to apply to the current query. - * @param body Parameters to send with the custom request. - * @param requestOptions additional request configuration. - */ - public suspend fun customPut(path: String, parameters: Map? = null, body: JsonObject? = null, requestOptions: RequestOptions? = null): JsonObject { - require(path.isNotBlank()) { "Parameter `path` is required when calling `customPut`." } - val requestConfig = RequestConfig( - method = RequestMethod.PUT, - path = "/{path}".replace("{path}", path), - query = buildMap { - parameters?.let { putAll(it) } - }, - body = body, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } - - /** - * 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. - * @param indexName Name of the index on which to perform the operation. - * @param startDate Start date of the period to analyze, in RFC 3339 format. - * @param endDate End date of the period to analyze, in RFC 3339 format. - * @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. (default to daily) - * @param requestOptions additional request configuration. - */ - public suspend fun getIndexUsage(statistic: Statistic, indexName: String, startDate: String, endDate: String, granularity: Granularity? = null, requestOptions: RequestOptions? = null): IndexUsage { - require(indexName.isNotBlank()) { "Parameter `indexName` is required when calling `getIndexUsage`." } - require(startDate.isNotBlank()) { "Parameter `startDate` is required when calling `getIndexUsage`." } - require(endDate.isNotBlank()) { "Parameter `endDate` is required when calling `getIndexUsage`." } - val requestConfig = RequestConfig( - method = RequestMethod.GET, - path = listOf("1", "usage", "$statistic", "$indexName"), - query = buildMap { - put("startDate", startDate) - put("endDate", endDate) - granularity?.let { put("granularity", it) } - }, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } - - /** - * 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. - * @param startDate Start date of the period to analyze, in RFC 3339 format. - * @param endDate End date of the period to analyze, in RFC 3339 format. - * @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. (default to daily) - * @param requestOptions additional request configuration. - */ - public suspend fun getUsage(statistic: Statistic, startDate: String, endDate: String, granularity: Granularity? = null, requestOptions: RequestOptions? = null): IndexUsage { - require(startDate.isNotBlank()) { "Parameter `startDate` is required when calling `getUsage`." } - require(endDate.isNotBlank()) { "Parameter `endDate` is required when calling `getUsage`." } - val requestConfig = RequestConfig( - method = RequestMethod.GET, - path = listOf("1", "usage", "$statistic"), - query = buildMap { - put("startDate", startDate) - put("endDate", endDate) - granularity?.let { put("granularity", it) } - }, - ) - return requester.execute( - requestConfig = requestConfig, - requestOptions = requestOptions, - ) - } -} diff --git a/clients/algoliasearch-client-php/lib/Configuration/UsageConfig.php b/clients/algoliasearch-client-php/lib/Configuration/UsageConfig.php deleted file mode 100644 index f1a12329b5..0000000000 --- a/clients/algoliasearch-client-php/lib/Configuration/UsageConfig.php +++ /dev/null @@ -1,10 +0,0 @@ - 'string', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 'message' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'message' => 'message', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'message' => 'setMessage', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'message' => 'getMessage', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['message'])) { - $this->container['message'] = $data['message']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - return []; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets message. - * - * @return null|string - */ - public function getMessage() - { - return $this->container['message'] ?? null; - } - - /** - * Sets message. - * - * @param null|string $message message - * - * @return self - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/ErrorItem.php b/clients/algoliasearch-client-php/lib/Model/Usage/ErrorItem.php deleted file mode 100644 index 04e59e775c..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/ErrorItem.php +++ /dev/null @@ -1,326 +0,0 @@ - 'string', - 'message' => 'string', - 'line' => 'int', - 'position' => 'int', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 'code' => null, - 'message' => null, - 'line' => null, - 'position' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'message' => 'message', - 'line' => 'line', - 'position' => 'position', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'message' => 'setMessage', - 'line' => 'setLine', - 'position' => 'setPosition', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - 'message' => 'getMessage', - 'line' => 'getLine', - 'position' => 'getPosition', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['code'])) { - $this->container['code'] = $data['code']; - } - if (isset($data['message'])) { - $this->container['message'] = $data['message']; - } - if (isset($data['line'])) { - $this->container['line'] = $data['line']; - } - if (isset($data['position'])) { - $this->container['position'] = $data['position']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if (!isset($this->container['message']) || null === $this->container['message']) { - $invalidProperties[] = "'message' can't be null"; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets code. - * - * @return null|string - */ - public function getCode() - { - return $this->container['code'] ?? null; - } - - /** - * Sets code. - * - * @param null|string $code code - * - * @return self - */ - public function setCode($code) - { - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets message. - * - * @return string - */ - public function getMessage() - { - return $this->container['message'] ?? null; - } - - /** - * Sets message. - * - * @param string $message message - * - * @return self - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Gets line. - * - * @return null|int - */ - public function getLine() - { - return $this->container['line'] ?? null; - } - - /** - * Sets line. - * - * @param null|int $line line - * - * @return self - */ - public function setLine($line) - { - $this->container['line'] = $line; - - return $this; - } - - /** - * Gets position. - * - * @return null|int - */ - public function getPosition() - { - return $this->container['position'] ?? null; - } - - /** - * Sets position. - * - * @param null|int $position position - * - * @return self - */ - public function setPosition($position) - { - $this->container['position'] = $position; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/ForbiddenError.php b/clients/algoliasearch-client-php/lib/Model/Usage/ForbiddenError.php deleted file mode 100644 index 2a0d3a0c10..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/ForbiddenError.php +++ /dev/null @@ -1,288 +0,0 @@ - 'string', - 'message' => 'string', - 'errors' => '\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[]', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 'code' => null, - 'message' => null, - 'errors' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'message' => 'message', - 'errors' => 'errors', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'message' => 'setMessage', - 'errors' => 'setErrors', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - 'message' => 'getMessage', - 'errors' => 'getErrors', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['code'])) { - $this->container['code'] = $data['code']; - } - if (isset($data['message'])) { - $this->container['message'] = $data['message']; - } - if (isset($data['errors'])) { - $this->container['errors'] = $data['errors']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - return []; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets code. - * - * @return null|string - */ - public function getCode() - { - return $this->container['code'] ?? null; - } - - /** - * Sets code. - * - * @param null|string $code code - * - * @return self - */ - public function setCode($code) - { - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets message. - * - * @return null|string - */ - public function getMessage() - { - return $this->container['message'] ?? null; - } - - /** - * Sets message. - * - * @param null|string $message message - * - * @return self - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Gets errors. - * - * @return null|\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[] - */ - public function getErrors() - { - return $this->container['errors'] ?? null; - } - - /** - * Sets errors. - * - * @param null|\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[] $errors errors - * - * @return self - */ - public function setErrors($errors) - { - $this->container['errors'] = $errors; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/Granularity.php b/clients/algoliasearch-client-php/lib/Model/Usage/Granularity.php deleted file mode 100644 index 41f1d9c26f..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/Granularity.php +++ /dev/null @@ -1,33 +0,0 @@ - '\Algolia\AlgoliaSearch\Model\Usage\StatisticEntry[]', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 'statistics' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'statistics' => 'statistics', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'statistics' => 'setStatistics', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'statistics' => 'getStatistics', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['statistics'])) { - $this->container['statistics'] = $data['statistics']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - return []; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets statistics. - * - * @return null|\Algolia\AlgoliaSearch\Model\Usage\StatisticEntry[] - */ - public function getStatistics() - { - return $this->container['statistics'] ?? null; - } - - /** - * Sets statistics. - * - * @param null|\Algolia\AlgoliaSearch\Model\Usage\StatisticEntry[] $statistics statistics - * - * @return self - */ - public function setStatistics($statistics) - { - $this->container['statistics'] = $statistics; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/InvalidRequestError.php b/clients/algoliasearch-client-php/lib/Model/Usage/InvalidRequestError.php deleted file mode 100644 index 9d43fdd274..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/InvalidRequestError.php +++ /dev/null @@ -1,288 +0,0 @@ - 'string', - 'message' => 'string', - 'errors' => '\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[]', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 'code' => null, - 'message' => null, - 'errors' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'message' => 'message', - 'errors' => 'errors', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'message' => 'setMessage', - 'errors' => 'setErrors', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - 'message' => 'getMessage', - 'errors' => 'getErrors', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['code'])) { - $this->container['code'] = $data['code']; - } - if (isset($data['message'])) { - $this->container['message'] = $data['message']; - } - if (isset($data['errors'])) { - $this->container['errors'] = $data['errors']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - return []; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets code. - * - * @return null|string - */ - public function getCode() - { - return $this->container['code'] ?? null; - } - - /** - * Sets code. - * - * @param null|string $code code - * - * @return self - */ - public function setCode($code) - { - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets message. - * - * @return null|string - */ - public function getMessage() - { - return $this->container['message'] ?? null; - } - - /** - * Sets message. - * - * @param null|string $message message - * - * @return self - */ - public function setMessage($message) - { - $this->container['message'] = $message; - - return $this; - } - - /** - * Gets errors. - * - * @return null|\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[] - */ - public function getErrors() - { - return $this->container['errors'] ?? null; - } - - /** - * Sets errors. - * - * @param null|\Algolia\AlgoliaSearch\Model\Usage\ErrorItem[] $errors errors - * - * @return self - */ - public function setErrors($errors) - { - $this->container['errors'] = $errors; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/Statistic.php b/clients/algoliasearch-client-php/lib/Model/Usage/Statistic.php deleted file mode 100644 index c4230f9407..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/Statistic.php +++ /dev/null @@ -1,279 +0,0 @@ - 'int', - 'v' => '\Algolia\AlgoliaSearch\Model\Usage\StatisticValue', - ]; - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @var string[] - */ - protected static $modelFormats = [ - 't' => null, - 'v' => null, - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @var string[] - */ - protected static $attributeMap = [ - 't' => 't', - 'v' => 'v', - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @var string[] - */ - protected static $setters = [ - 't' => 'setT', - 'v' => 'setV', - ]; - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @var string[] - */ - protected static $getters = [ - 't' => 'getT', - 'v' => 'getV', - ]; - - /** - * Associative array for storing property values. - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor. - * - * @param mixed[] $data Associated array of property values - */ - public function __construct(?array $data = null) - { - if (isset($data['t'])) { - $this->container['t'] = $data['t']; - } - if (isset($data['v'])) { - $this->container['v'] = $data['v']; - } - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name. - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of property to type mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelTypes() - { - return self::$modelTypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization. - * - * @return array - */ - public static function modelFormats() - { - return self::$modelFormats; - } - - /** - * Array of attributes to setter functions (for deserialization of responses). - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests). - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - return []; - } - - /** - * Validate all the properties in the model - * return true if all passed. - * - * @return bool True if all properties are valid - */ - public function valid() - { - return 0 === count($this->listInvalidProperties()); - } - - /** - * Gets t. - * - * @return null|int - */ - public function getT() - { - return $this->container['t'] ?? null; - } - - /** - * Sets t. - * - * @param null|int $t timestamp, measured in milliseconds since the Unix epoch - * - * @return self - */ - public function setT($t) - { - $this->container['t'] = $t; - - return $this; - } - - /** - * Gets v. - * - * @return null|StatisticValue - */ - public function getV() - { - return $this->container['v'] ?? null; - } - - /** - * Sets v. - * - * @param null|StatisticValue $v v - * - * @return self - */ - public function setV($v) - { - $this->container['v'] = $v; - - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-php/lib/Model/Usage/StatisticValue.php b/clients/algoliasearch-client-php/lib/Model/Usage/StatisticValue.php deleted file mode 100644 index 5cc5ca815f..0000000000 --- a/clients/algoliasearch-client-php/lib/Model/Usage/StatisticValue.php +++ /dev/null @@ -1,188 +0,0 @@ -listInvalidProperties()); - } - - /** - * Returns true if offset exists. False otherwise. - * - * @param int $offset Offset - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param int $offset Offset - * - * @return null|mixed - */ - public function offsetGet($offset): mixed - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param null|int $offset Offset - * @param mixed $value Value to be set - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param int $offset Offset - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } -} diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/UsageClient.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/UsageClient.scala deleted file mode 100644 index 2d59b191ed..0000000000 --- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/UsageClient.scala +++ /dev/null @@ -1,405 +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 algoliasearch.api - -import algoliasearch.usage.ErrorBase -import algoliasearch.usage.Forbidden -import algoliasearch.usage.Granularity._ -import algoliasearch.usage.IndexUsage -import algoliasearch.usage.InvalidRequest -import algoliasearch.usage.Statistic._ -import algoliasearch.usage._ -import algoliasearch.ApiClient -import algoliasearch.api.UsageClient.hosts -import algoliasearch.config._ -import algoliasearch.internal.util._ - -import scala.concurrent.{ExecutionContext, Future} -import scala.util.Random - -object UsageClient { - - /** Creates a new SearchApi instance using default hosts. - * - * @param appId - * application ID - * @param apiKey - * api key - * - * @param clientOptions - * client options - */ - def apply( - appId: String, - apiKey: String, - clientOptions: ClientOptions = ClientOptions() - ) = new UsageClient( - appId = appId, - apiKey = apiKey, - clientOptions = clientOptions - ) - - private def hosts(): Seq[Host] = { - List( - Host("usage.algolia.com", Set(CallType.Read, CallType.Write)) - ) - } -} - -class UsageClient( - appId: String, - apiKey: String, - clientOptions: ClientOptions = ClientOptions() -) extends ApiClient( - appId = appId, - apiKey = apiKey, - clientName = "Usage", - defaultHosts = hosts(), - formats = JsonSupport.format, - options = clientOptions - ) { - - /** This method allow you to send requests to the Algolia REST API. - * - * @param path - * Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters - * Query parameters to apply to the current query. - */ - def customDelete[T: Manifest]( - path: String, - parameters: Option[Map[String, Any]] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[T] = Future { - requireNotNull(path, "Parameter `path` is required when calling `customDelete`.") - - val request = HttpRequest - .builder() - .withMethod("DELETE") - .withPath(s"/${path}") - .withQueryParameters(parameters) - .build() - execute[T](request, requestOptions) - } - - /** This method allow you to send requests to the Algolia REST API. - * - * @param path - * Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters - * Query parameters to apply to the current query. - */ - def customGet[T: Manifest]( - path: String, - parameters: Option[Map[String, Any]] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[T] = Future { - requireNotNull(path, "Parameter `path` is required when calling `customGet`.") - - val request = HttpRequest - .builder() - .withMethod("GET") - .withPath(s"/${path}") - .withQueryParameters(parameters) - .build() - execute[T](request, requestOptions) - } - - /** This method allow you to send requests to the Algolia REST API. - * - * @param path - * Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters - * Query parameters to apply to the current query. - * @param body - * Parameters to send with the custom request. - */ - def customPost[T: Manifest]( - path: String, - parameters: Option[Map[String, Any]] = None, - body: Option[Any] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[T] = Future { - requireNotNull(path, "Parameter `path` is required when calling `customPost`.") - - val request = HttpRequest - .builder() - .withMethod("POST") - .withPath(s"/${path}") - .withBody(body) - .withQueryParameters(parameters) - .build() - execute[T](request, requestOptions) - } - - /** This method allow you to send requests to the Algolia REST API. - * - * @param path - * Path of the endpoint, anything after \"/1\" must be specified. - * @param parameters - * Query parameters to apply to the current query. - * @param body - * Parameters to send with the custom request. - */ - def customPut[T: Manifest]( - path: String, - parameters: Option[Map[String, Any]] = None, - body: Option[Any] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[T] = Future { - requireNotNull(path, "Parameter `path` is required when calling `customPut`.") - - val request = HttpRequest - .builder() - .withMethod("PUT") - .withPath(s"/${path}") - .withBody(body) - .withQueryParameters(parameters) - .build() - execute[T](request, requestOptions) - } - - /** 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. - * @param indexName - * Name of the index on which to perform the operation. - * @param startDate - * Start date of the period to analyze, in RFC 3339 format. - * @param endDate - * End date of the period to analyze, in RFC 3339 format. - * @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. - */ - def getIndexUsage( - statistic: Statistic, - indexName: String, - startDate: String, - endDate: String, - granularity: Option[Granularity] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[IndexUsage] = Future { - requireNotNull(statistic, "Parameter `statistic` is required when calling `getIndexUsage`.") - requireNotNull(indexName, "Parameter `indexName` is required when calling `getIndexUsage`.") - requireNotNull(startDate, "Parameter `startDate` is required when calling `getIndexUsage`.") - requireNotNull(endDate, "Parameter `endDate` is required when calling `getIndexUsage`.") - - val request = HttpRequest - .builder() - .withMethod("GET") - .withPath(s"/1/usage/${escape(statistic)}/${escape(indexName)}") - .withQueryParameter("startDate", startDate) - .withQueryParameter("endDate", endDate) - .withQueryParameter("granularity", granularity) - .build() - execute[IndexUsage](request, requestOptions) - } - - /** 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. - * @param startDate - * Start date of the period to analyze, in RFC 3339 format. - * @param endDate - * End date of the period to analyze, in RFC 3339 format. - * @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. - */ - def getUsage( - statistic: Statistic, - startDate: String, - endDate: String, - granularity: Option[Granularity] = None, - requestOptions: Option[RequestOptions] = None - )(implicit ec: ExecutionContext): Future[IndexUsage] = Future { - requireNotNull(statistic, "Parameter `statistic` is required when calling `getUsage`.") - requireNotNull(startDate, "Parameter `startDate` is required when calling `getUsage`.") - requireNotNull(endDate, "Parameter `endDate` is required when calling `getUsage`.") - - val request = HttpRequest - .builder() - .withMethod("GET") - .withPath(s"/1/usage/${escape(statistic)}") - .withQueryParameter("startDate", startDate) - .withQueryParameter("endDate", endDate) - .withQueryParameter("granularity", granularity) - .build() - execute[IndexUsage](request, requestOptions) - } - -} diff --git a/snippets/java/src/test/java/com/algolia/Usage.java b/snippets/java/src/test/java/com/algolia/Usage.java deleted file mode 100644 index b0ae9cd314..0000000000 --- a/snippets/java/src/test/java/com/algolia/Usage.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.algolia.methods.snippets; - -// >IMPORT -import com.algolia.api.UsageClient; -import com.algolia.model.usage.*; - -// IMPORT< - -class SnippetUsageClient { - - // Snippet for the customDelete method. - // - // allow del method for a custom path with minimal parameters - void snippetForCustomDelete() { - // >SEPARATOR customDelete default - // Initialize the client - UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY"); - - // Call the API - client.customDelete("test/minimal"); - // >LOG - // SEPARATOR< - } - - // Snippet for the customGet method. - // - // allow get method for a custom path with minimal parameters - void snippetForCustomGet() { - // >SEPARATOR customGet default - // Initialize the client - UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY"); - - // Call the API - client.customGet("test/minimal"); - // >LOG - // SEPARATOR< - } - - // Snippet for the customPost method. - // - // allow post method for a custom path with minimal parameters - void snippetForCustomPost() { - // >SEPARATOR customPost default - // Initialize the client - UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY"); - - // Call the API - client.customPost("test/minimal"); - // >LOG - // SEPARATOR< - } - - // Snippet for the customPut method. - // - // allow put method for a custom path with minimal parameters - void snippetForCustomPut() { - // >SEPARATOR customPut default - // Initialize the client - UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY"); - - // Call the API - client.customPut("test/minimal"); - // >LOG - // SEPARATOR< - } - - // Snippet for the getIndexUsage method. - // - // getIndexUsage with minimal parameters - void snippetForGetIndexUsage() { - // >SEPARATOR getIndexUsage default - // 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 - // SEPARATOR< - } - - // Snippet for the getUsage method. - // - // getUsage with minimal parameters - void snippetForGetUsage() { - // >SEPARATOR getUsage default - // 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 - // SEPARATOR< - } - - // Snippet for the setClientApiKey method. - // - // switch API key - void snippetForSetClientApiKey() { - // >SEPARATOR setClientApiKey default - // Initialize the client - UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY"); - - // Call the API - client.setClientApiKey("updated-api-key"); - // >LOG - // SEPARATOR< - } -} diff --git a/snippets/scala/src/main/scala/Usage.scala b/snippets/scala/src/main/scala/Usage.scala deleted file mode 100644 index eec48fcec5..0000000000 --- a/snippets/scala/src/main/scala/Usage.scala +++ /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. -package algoliasearch.methods.snippets - -import scala.concurrent.duration.Duration - -// >IMPORT -import algoliasearch.api.UsageClient -// IMPORT< -import algoliasearch.usage.* - -import org.json4s.* -import org.json4s.native.JsonParser.* -import scala.concurrent.{Await, ExecutionContextExecutor} - -class SnippetUsageClient { - implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global - implicit val formats: Formats = org.json4s.DefaultFormats - - /** Snippet for the customDelete method. - * - * allow del method for a custom path with minimal parameters - */ - def snippetForUsageClientCustomDelete(): Unit = { - // >SEPARATOR customDelete default - // 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")) - // SEPARATOR< - } - - /** Snippet for the customGet method. - * - * allow get method for a custom path with minimal parameters - */ - def snippetForUsageClientCustomGet(): Unit = { - // >SEPARATOR customGet default - // 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")) - // SEPARATOR< - } - - /** Snippet for the customPost method. - * - * allow post method for a custom path with minimal parameters - */ - def snippetForUsageClientCustomPost(): Unit = { - // >SEPARATOR customPost default - // 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")) - // SEPARATOR< - } - - /** Snippet for the customPut method. - * - * allow put method for a custom path with minimal parameters - */ - def snippetForUsageClientCustomPut(): Unit = { - // >SEPARATOR customPut default - // 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")) - // SEPARATOR< - } - - /** Snippet for the getIndexUsage method. - * - * getIndexUsage with minimal parameters - */ - def snippetForUsageClientGetIndexUsage(): Unit = { - // >SEPARATOR getIndexUsage default - // 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")) - // SEPARATOR< - } - - /** Snippet for the getUsage method. - * - * getUsage with minimal parameters - */ - def snippetForUsageClientGetUsage(): Unit = { - // >SEPARATOR getUsage default - // 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")) - // SEPARATOR< - } - -} diff --git a/snippets/swift/Sources/Usage.swift b/snippets/swift/Sources/Usage.swift deleted file mode 100644 index 5d06e81c9b..0000000000 --- a/snippets/swift/Sources/Usage.swift +++ /dev/null @@ -1,116 +0,0 @@ -#if canImport(Core) - import Core -#endif -// >IMPORT -import Usage - -// IMPORT< - -final class UsageClientSnippet { - /// Snippet for the customDelete method. - /// - /// allow del method for a custom path with minimal parameters - func snippetForCustomDelete() async throws { - // >SEPARATOR customDelete default - // 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 - // SEPARATOR< - } - - /// Snippet for the customGet method. - /// - /// allow get method for a custom path with minimal parameters - func snippetForCustomGet() async throws { - // >SEPARATOR customGet default - // 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 - // SEPARATOR< - } - - /// Snippet for the customPost method. - /// - /// allow post method for a custom path with minimal parameters - func snippetForCustomPost() async throws { - // >SEPARATOR customPost default - // 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 - // SEPARATOR< - } - - /// Snippet for the customPut method. - /// - /// allow put method for a custom path with minimal parameters - func snippetForCustomPut() async throws { - // >SEPARATOR customPut default - // 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 - // SEPARATOR< - } - - /// Snippet for the getIndexUsage method. - /// - /// getIndexUsage with minimal parameters - func snippetForGetIndexUsage() async throws { - // >SEPARATOR getIndexUsage default - // 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 - // SEPARATOR< - } - - /// Snippet for the getUsage method. - /// - /// getUsage with minimal parameters - func snippetForGetUsage() async throws { - // >SEPARATOR getUsage default - // 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 - // SEPARATOR< - } - - /// Snippet for the setClientApiKey method. - /// - /// switch API key - func snippetForSetClientApiKey() async throws { - // >SEPARATOR setClientApiKey default - // Initialize the client - let client = try UsageClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY") - - // Call the API - try client.setClientApiKey(apiKey: "updated-api-key") - // >LOG - // SEPARATOR< - } -} diff --git a/tests/output/csharp/src/generated/client/Usage.test.cs b/tests/output/csharp/src/generated/client/Usage.test.cs deleted file mode 100644 index ec4c37e1e6..0000000000 --- a/tests/output/csharp/src/generated/client/Usage.test.cs +++ /dev/null @@ -1,163 +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.Text.Json; -using System.Text.RegularExpressions; -using Algolia.Search.Clients; -using Algolia.Search.Http; -using Algolia.Search.Models.Common; -using Algolia.Search.Models.Usage; -using Algolia.Search.Serializer; -using Algolia.Search.Tests.Utils; -using Algolia.Search.Transport; -using Quibble.Xunit; -using Xunit; - -namespace Algolia.Search.client; - -public class UsageClientTests -{ - private readonly EchoHttpRequester _echo; - private Exception _ex; - - public UsageClientTests() - { - _echo = new EchoHttpRequester(); - } - - [Fact] - public void Dispose() { } - - [Fact(DisplayName = "calls api with correct read host")] - public async Task ApiTest0() - { - var client = new UsageClient(new UsageConfig("test-app-id", "test-api-key"), _echo); - - await client.CustomGetAsync("test"); - EchoResponse result = _echo.LastResponse; - - Assert.Equal("usage.algolia.com", result.Host); - } - - [Fact(DisplayName = "calls api with correct write host")] - public async Task ApiTest1() - { - var client = new UsageClient(new UsageConfig("test-app-id", "test-api-key"), _echo); - - await client.CustomPostAsync("test"); - EchoResponse result = _echo.LastResponse; - - Assert.Equal("usage.algolia.com", result.Host); - } - - [Fact(DisplayName = "calls api with correct user agent")] - public async Task CommonApiTest0() - { - var client = new UsageClient(new UsageConfig("appId", "apiKey"), _echo); - await client.CustomPostAsync("1/test"); - EchoResponse result = _echo.LastResponse; - { - var regexp = new Regex( - "^Algolia for Csharp \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$" - ); - Assert.Matches(regexp, result.Headers["user-agent"]); - } - } - - [Fact(DisplayName = "the user agent contains the latest version")] - public async Task CommonApiTest1() - { - var client = new UsageClient(new UsageConfig("appId", "apiKey"), _echo); - await client.CustomPostAsync("1/test"); - EchoResponse result = _echo.LastResponse; - { - var regexp = new Regex("^Algolia for Csharp \\(7.3.0\\).*"); - Assert.Matches(regexp, result.Headers["user-agent"]); - } - } - - [Fact(DisplayName = "calls api with default read timeouts")] - public async Task CommonApiTest2() - { - var client = new UsageClient(new UsageConfig("appId", "apiKey"), _echo); - await client.CustomGetAsync("1/test"); - EchoResponse result = _echo.LastResponse; - - Assert.Equal(2000, result.ConnectTimeout.TotalMilliseconds); - Assert.Equal(5000, result.ResponseTimeout.TotalMilliseconds); - } - - [Fact(DisplayName = "calls api with default write timeouts")] - public async Task CommonApiTest3() - { - var client = new UsageClient(new UsageConfig("appId", "apiKey"), _echo); - await client.CustomPostAsync("1/test"); - EchoResponse result = _echo.LastResponse; - - Assert.Equal(2000, result.ConnectTimeout.TotalMilliseconds); - Assert.Equal(30000, result.ResponseTimeout.TotalMilliseconds); - } - - [Fact(DisplayName = "client throws with invalid parameters")] - public async Task ParametersTest0() - { - _ex = await Assert.ThrowsAnyAsync(async () => - { - var client = new UsageClient(new UsageConfig("", ""), _echo); - }); - Assert.Equal("`appId` is missing.".ToLowerInvariant(), _ex.Message.ToLowerInvariant()); - - _ex = await Assert.ThrowsAnyAsync(async () => - { - var client = new UsageClient(new UsageConfig("", "my-api-key"), _echo); - }); - Assert.Equal("`appId` is missing.".ToLowerInvariant(), _ex.Message.ToLowerInvariant()); - - _ex = await Assert.ThrowsAnyAsync(async () => - { - var client = new UsageClient(new UsageConfig("my-app-id", ""), _echo); - }); - Assert.Equal("`apiKey` is missing.".ToLowerInvariant(), _ex.Message.ToLowerInvariant()); - } - - [Fact(DisplayName = "switch API key")] - public async Task SetClientApiKeyTest0() - { - UsageConfig _config = new UsageConfig("test-app-id", "test-api-key") - { - CustomHosts = new List - { - new() - { - Scheme = HttpScheme.Http, - Url = "localhost", - Port = 6683, - Up = true, - LastUse = DateTime.UtcNow, - Accept = CallType.Read | CallType.Write, - } - } - }; - var client = new UsageClient(_config); - - { - var res = await client.CustomGetAsync("check-api-key/1"); - - JsonAssert.EqualOverrideDefault( - "{\"headerAPIKeyValue\":\"test-api-key\"}", - JsonSerializer.Serialize(res, JsonConfig.Options), - new JsonDiffConfig(false) - ); - } - { - client.SetClientApiKey("updated-api-key"); - } - { - var res = await client.CustomGetAsync("check-api-key/2"); - - JsonAssert.EqualOverrideDefault( - "{\"headerAPIKeyValue\":\"updated-api-key\"}", - JsonSerializer.Serialize(res, JsonConfig.Options), - new JsonDiffConfig(false) - ); - } - } -} diff --git a/tests/output/csharp/src/generated/requests/Usage.test.cs b/tests/output/csharp/src/generated/requests/Usage.test.cs deleted file mode 100644 index 6ac67a5437..0000000000 --- a/tests/output/csharp/src/generated/requests/Usage.test.cs +++ /dev/null @@ -1,576 +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.Text.Json; -using Algolia.Search.Clients; -using Algolia.Search.Http; -using Algolia.Search.Models.Usage; -using Algolia.Search.Serializer; -using Algolia.Search.Tests.Utils; -using dotenv.net; -using Quibble.Xunit; -using Xunit; -using Action = Algolia.Search.Models.Ingestion.Action; - -namespace Algolia.Search.requests; - -public class UsageClientRequestTests -{ - private readonly UsageClient client; - private readonly EchoHttpRequester _echo; - - public UsageClientRequestTests() - { - _echo = new EchoHttpRequester(); - client = new UsageClient(new UsageConfig("appId", "apiKey"), _echo); - } - - [Fact] - public void Dispose() { } - - [Fact(DisplayName = "allow del method for a custom path with minimal parameters")] - public async Task CustomDeleteTest() - { - await client.CustomDeleteAsync("test/minimal"); - - var req = _echo.LastResponse; - Assert.Equal("/test/minimal", req.Path); - Assert.Equal("DELETE", req.Method.ToString()); - Assert.Null(req.Body); - } - - [Fact(DisplayName = "allow del method for a custom path with all parameters")] - public async Task CustomDeleteTest1() - { - await client.CustomDeleteAsync( - "test/all", - new Dictionary { { "query", "parameters" } } - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/all", req.Path); - Assert.Equal("DELETE", req.Method.ToString()); - Assert.Null(req.Body); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "allow get method for a custom path with minimal parameters")] - public async Task CustomGetTest() - { - await client.CustomGetAsync("test/minimal"); - - var req = _echo.LastResponse; - Assert.Equal("/test/minimal", req.Path); - Assert.Equal("GET", req.Method.ToString()); - Assert.Null(req.Body); - } - - [Fact(DisplayName = "allow get method for a custom path with all parameters")] - public async Task CustomGetTest1() - { - await client.CustomGetAsync( - "test/all", - new Dictionary { { "query", "parameters with space" } } - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/all", req.Path); - Assert.Equal("GET", req.Method.ToString()); - Assert.Null(req.Body); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters%20with%20space\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions should be escaped too")] - public async Task CustomGetTest2() - { - await client.CustomGetAsync( - "test/all", - new Dictionary { { "query", "to be overriden" } }, - new RequestOptionBuilder() - .AddExtraQueryParameters("query", "parameters with space") - .AddExtraQueryParameters("and an array", new List { "array", "with spaces" }) - .AddExtraHeader("x-header-1", "spaces are left alone") - .Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/all", req.Path); - Assert.Equal("GET", req.Method.ToString()); - Assert.Null(req.Body); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters%20with%20space\",\"and%20an%20array\":\"array%2Cwith%20spaces\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - var expectedHeaders = JsonSerializer.Deserialize>( - "{\"x-header-1\":\"spaces are left alone\"}" - ); - var actualHeaders = req.Headers; - foreach (var expectedHeader in expectedHeaders) - { - string actualHeaderValue; - actualHeaders.TryGetValue(expectedHeader.Key, out actualHeaderValue); - Assert.Equal(expectedHeader.Value, actualHeaderValue); - } - } - - [Fact(DisplayName = "allow post method for a custom path with minimal parameters")] - public async Task CustomPostTest() - { - await client.CustomPostAsync("test/minimal"); - - var req = _echo.LastResponse; - Assert.Equal("/test/minimal", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{}", req.Body, new JsonDiffConfig(false)); - } - - [Fact(DisplayName = "allow post method for a custom path with all parameters")] - public async Task CustomPostTest1() - { - await client.CustomPostAsync( - "test/all", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "body", "parameters" } } - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/all", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault( - "{\"body\":\"parameters\"}", - req.Body, - new JsonDiffConfig(false) - ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions can override default query parameters")] - public async Task CustomPostTest2() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraQueryParameters("query", "myQueryParameter").Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"myQueryParameter\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions merges query parameters with default ones")] - public async Task CustomPostTest3() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraQueryParameters("query2", "myQueryParameter").Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"query2\":\"myQueryParameter\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions can override default headers")] - public async Task CustomPostTest4() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraHeader("x-algolia-api-key", "myApiKey").Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - var expectedHeaders = JsonSerializer.Deserialize>( - "{\"x-algolia-api-key\":\"myApiKey\"}" - ); - var actualHeaders = req.Headers; - foreach (var expectedHeader in expectedHeaders) - { - string actualHeaderValue; - actualHeaders.TryGetValue(expectedHeader.Key, out actualHeaderValue); - Assert.Equal(expectedHeader.Value, actualHeaderValue); - } - } - - [Fact(DisplayName = "requestOptions merges headers with default ones")] - public async Task CustomPostTest5() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraHeader("x-algolia-api-key", "myApiKey").Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - var expectedHeaders = JsonSerializer.Deserialize>( - "{\"x-algolia-api-key\":\"myApiKey\"}" - ); - var actualHeaders = req.Headers; - foreach (var expectedHeader in expectedHeaders) - { - string actualHeaderValue; - actualHeaders.TryGetValue(expectedHeader.Key, out actualHeaderValue); - Assert.Equal(expectedHeader.Value, actualHeaderValue); - } - } - - [Fact(DisplayName = "requestOptions queryParameters accepts booleans")] - public async Task CustomPostTest6() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraQueryParameters("isItWorking", true).Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"isItWorking\":\"true\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions queryParameters accepts integers")] - public async Task CustomPostTest7() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder().AddExtraQueryParameters("myParam", 2).Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"myParam\":\"2\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions queryParameters accepts list of string")] - public async Task CustomPostTest8() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder() - .AddExtraQueryParameters("myParam", new List { "b and c", "d" }) - .Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"myParam\":\"b%20and%20c%2Cd\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions queryParameters accepts list of booleans")] - public async Task CustomPostTest9() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder() - .AddExtraQueryParameters("myParam", new List { true, true, false }) - .Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"myParam\":\"true%2Ctrue%2Cfalse\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "requestOptions queryParameters accepts list of integers")] - public async Task CustomPostTest10() - { - await client.CustomPostAsync( - "test/requestOptions", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "facet", "filters" } }, - new RequestOptionBuilder() - .AddExtraQueryParameters("myParam", new List { 1, 2 }) - .Build() - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/requestOptions", req.Path); - Assert.Equal("POST", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{\"facet\":\"filters\"}", req.Body, new JsonDiffConfig(false)); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\",\"myParam\":\"1%2C2\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "allow put method for a custom path with minimal parameters")] - public async Task CustomPutTest() - { - await client.CustomPutAsync("test/minimal"); - - var req = _echo.LastResponse; - Assert.Equal("/test/minimal", req.Path); - Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault("{}", req.Body, new JsonDiffConfig(false)); - } - - [Fact(DisplayName = "allow put method for a custom path with all parameters")] - public async Task CustomPutTest1() - { - await client.CustomPutAsync( - "test/all", - new Dictionary { { "query", "parameters" } }, - new Dictionary { { "body", "parameters" } } - ); - - var req = _echo.LastResponse; - Assert.Equal("/test/all", req.Path); - Assert.Equal("PUT", req.Method.ToString()); - JsonAssert.EqualOverrideDefault( - "{\"body\":\"parameters\"}", - req.Body, - new JsonDiffConfig(false) - ); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"query\":\"parameters\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "getIndexUsage with minimal parameters")] - public async Task GetIndexUsageTest() - { - await client.GetIndexUsageAsync( - Enum.Parse("QueriesOperations"), - "myIndexName", - "2024-04-03T12:46:43Z", - "2024-04-05T12:46:43Z" - ); - - var req = _echo.LastResponse; - Assert.Equal("/1/usage/queries_operations/myIndexName", req.Path); - Assert.Equal("GET", req.Method.ToString()); - Assert.Null(req.Body); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } - - [Fact(DisplayName = "getUsage with minimal parameters")] - public async Task GetUsageTest() - { - await client.GetUsageAsync( - Enum.Parse("QueriesOperations"), - "2024-04-03T12:46:43Z", - "2024-04-05T12:46:43Z" - ); - - var req = _echo.LastResponse; - Assert.Equal("/1/usage/queries_operations", req.Path); - Assert.Equal("GET", req.Method.ToString()); - Assert.Null(req.Body); - var expectedQuery = JsonSerializer.Deserialize>( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}" - ); - Assert.NotNull(expectedQuery); - - var actualQuery = req.QueryParameters; - Assert.Equal(expectedQuery.Count, actualQuery.Count); - - foreach (var actual in actualQuery) - { - expectedQuery.TryGetValue(actual.Key, out var expected); - Assert.Equal(expected, actual.Value); - } - } -} diff --git a/tests/output/java/src/test/java/com/algolia/client/Usage.test.java b/tests/output/java/src/test/java/com/algolia/client/Usage.test.java deleted file mode 100644 index 5b2af5f780..0000000000 --- a/tests/output/java/src/test/java/com/algolia/client/Usage.test.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.algolia.client; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import com.algolia.EchoInterceptor; -import com.algolia.EchoResponse; -import com.algolia.api.UsageClient; -import com.algolia.config.*; -import com.algolia.model.usage.*; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.json.JsonMapper; -import java.util.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.skyscreamer.jsonassert.JSONAssert; -import org.skyscreamer.jsonassert.JSONCompareMode; - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -class UsageClientClientTests { - - private EchoInterceptor echo = new EchoInterceptor(); - private ObjectMapper json; - - @BeforeAll - void init() { - this.json = JsonMapper.builder() - .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - .serializationInclusion(JsonInclude.Include.NON_NULL) - .build(); - } - - UsageClient createClient() { - return new UsageClient("appId", "apiKey", withEchoRequester()); - } - - private ClientOptions withEchoRequester() { - return ClientOptions.builder().setRequesterConfig(requester -> requester.addInterceptor(echo)).build(); - } - - private ClientOptions withCustomHosts(List hosts, boolean gzipEncoding) { - return ClientOptions.builder().setHosts(hosts).setCompressionType(gzipEncoding ? CompressionType.GZIP : CompressionType.NONE).build(); - } - - @Test - @DisplayName("calls api with correct read host") - void apiTest0() { - UsageClient client = new UsageClient("test-app-id", "test-api-key", withEchoRequester()); - client.customGet("test"); - EchoResponse result = echo.getLastResponse(); - assertEquals("usage.algolia.com", result.host); - } - - @Test - @DisplayName("calls api with correct write host") - void apiTest1() { - UsageClient client = new UsageClient("test-app-id", "test-api-key", withEchoRequester()); - client.customPost("test"); - EchoResponse result = echo.getLastResponse(); - assertEquals("usage.algolia.com", result.host); - } - - @Test - @DisplayName("calls api with correct user agent") - void commonApiTest0() { - UsageClient client = createClient(); - - client.customPost("1/test"); - EchoResponse result = echo.getLastResponse(); - { - String regexp = - "^Algolia for Java \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+" + - " (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage" + - " (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+" + - " (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$"; - assertTrue( - result.headers.get("user-agent").matches(regexp), - "Expected " + result.headers.get("user-agent") + " to match the following regex: " + regexp - ); - } - } - - @Test - @DisplayName("the user agent contains the latest version") - void commonApiTest1() { - UsageClient client = createClient(); - - client.customPost("1/test"); - EchoResponse result = echo.getLastResponse(); - { - String regexp = "^Algolia for Java \\(4.3.0\\).*"; - assertTrue( - result.headers.get("user-agent").matches(regexp), - "Expected " + result.headers.get("user-agent") + " to match the following regex: " + regexp - ); - } - } - - @Test - @DisplayName("calls api with default read timeouts") - void commonApiTest2() { - UsageClient client = createClient(); - - client.customGet("1/test"); - EchoResponse result = echo.getLastResponse(); - assertEquals(2000, result.connectTimeout); - assertEquals(5000, result.responseTimeout); - } - - @Test - @DisplayName("calls api with default write timeouts") - void commonApiTest3() { - UsageClient client = createClient(); - - client.customPost("1/test"); - EchoResponse result = echo.getLastResponse(); - assertEquals(2000, result.connectTimeout); - assertEquals(30000, result.responseTimeout); - } - - @Test - @DisplayName("client throws with invalid parameters") - void parametersTest0() { - { - Exception exception = assertThrows(Exception.class, () -> { - UsageClient client = new UsageClient("", "", withEchoRequester()); - }); - assertEquals("`appId` is missing.", exception.getMessage()); - } - { - Exception exception = assertThrows(Exception.class, () -> { - UsageClient client = new UsageClient("", "my-api-key", withEchoRequester()); - }); - assertEquals("`appId` is missing.", exception.getMessage()); - } - { - Exception exception = assertThrows(Exception.class, () -> { - UsageClient client = new UsageClient("my-app-id", "", withEchoRequester()); - }); - assertEquals("`apiKey` is missing.", exception.getMessage()); - } - } - - @Test - @DisplayName("switch API key") - void setClientApiKeyTest0() { - UsageClient client = new UsageClient( - "test-app-id", - "test-api-key", - withCustomHosts(Arrays.asList(new Host("localhost", EnumSet.of(CallType.READ, CallType.WRITE), "http", 6683)), false) - ); - assertDoesNotThrow(() -> { - Object res = client.customGet("check-api-key/1"); - - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"headerAPIKeyValue\":\"test-api-key\"}", json.writeValueAsString(res), JSONCompareMode.STRICT) - ); - }); - assertDoesNotThrow(() -> { - client.setClientApiKey("updated-api-key"); - }); - assertDoesNotThrow(() -> { - Object res = client.customGet("check-api-key/2"); - - assertDoesNotThrow(() -> - JSONAssert.assertEquals("{\"headerAPIKeyValue\":\"updated-api-key\"}", json.writeValueAsString(res), JSONCompareMode.STRICT) - ); - }); - } -} diff --git a/tests/output/java/src/test/java/com/algolia/requests/Usage.test.java b/tests/output/java/src/test/java/com/algolia/requests/Usage.test.java deleted file mode 100644 index c180ccc0da..0000000000 --- a/tests/output/java/src/test/java/com/algolia/requests/Usage.test.java +++ /dev/null @@ -1,715 +0,0 @@ -package com.algolia.requests; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.fail; - -import com.algolia.EchoInterceptor; -import com.algolia.EchoResponse; -import com.algolia.api.UsageClient; -import com.algolia.config.*; -import com.algolia.model.usage.*; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.json.JsonMapper; -import java.util.*; -import org.junit.jupiter.api.*; -import org.skyscreamer.jsonassert.JSONAssert; -import org.skyscreamer.jsonassert.JSONCompareMode; - -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -class UsageClientRequestsTests { - - private UsageClient client; - private EchoInterceptor echo; - private ObjectMapper json; - - @BeforeAll - void init() { - this.json = JsonMapper.builder().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).build(); - this.echo = new EchoInterceptor(); - ClientOptions options = ClientOptions.builder().setRequesterConfig(requester -> requester.addInterceptor(echo)).build(); - this.client = new UsageClient("appId", "apiKey", options); - } - - @AfterAll - void tearUp() throws Exception { - client.close(); - } - - @Test - @DisplayName("allow del method for a custom path with minimal parameters") - void customDeleteTest() { - assertDoesNotThrow(() -> { - client.customDelete("test/minimal"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/minimal", req.path); - assertEquals("DELETE", req.method); - assertNull(req.body); - } - - @Test - @DisplayName("allow del method for a custom path with all parameters") - void customDeleteTest1() { - assertDoesNotThrow(() -> { - client.customDelete( - "test/all", - new HashMap() { - { - put("query", "parameters"); - } - } - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/all", req.path); - assertEquals("DELETE", req.method); - assertNull(req.body); - - try { - Map expectedQuery = json.readValue("{\"query\":\"parameters\"}", new TypeReference>() {}); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("allow get method for a custom path with minimal parameters") - void customGetTest() { - assertDoesNotThrow(() -> { - client.customGet("test/minimal"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/minimal", req.path); - assertEquals("GET", req.method); - assertNull(req.body); - } - - @Test - @DisplayName("allow get method for a custom path with all parameters") - void customGetTest1() { - assertDoesNotThrow(() -> { - client.customGet( - "test/all", - new HashMap() { - { - put("query", "parameters with space"); - } - } - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/all", req.path); - assertEquals("GET", req.method); - assertNull(req.body); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters%20with%20space\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions should be escaped too") - void customGetTest2() { - assertDoesNotThrow(() -> { - client.customGet( - "test/all", - new HashMap() { - { - put("query", "to be overriden"); - } - }, - new RequestOptions() - .addExtraQueryParameters("query", "parameters with space") - .addExtraQueryParameters("and an array", Arrays.asList("array", "with spaces")) - .addExtraHeader("x-header-1", "spaces are left alone") - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/all", req.path); - assertEquals("GET", req.method); - assertNull(req.body); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters%20with%20space\",\"and%20an%20array\":\"array%2Cwith%20spaces\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - - try { - Map expectedHeaders = json.readValue( - "{\"x-header-1\":\"spaces are left alone\"}", - new TypeReference>() {} - ); - Map actualHeaders = req.headers; - - for (Map.Entry p : expectedHeaders.entrySet()) { - assertEquals(p.getValue(), actualHeaders.get(p.getKey())); - } - } catch (JsonProcessingException e) { - fail("failed to parse headers json"); - } - } - - @Test - @DisplayName("allow post method for a custom path with minimal parameters") - void customPostTest() { - assertDoesNotThrow(() -> { - client.customPost("test/minimal"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/minimal", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT)); - } - - @Test - @DisplayName("allow post method for a custom path with all parameters") - void customPostTest1() { - assertDoesNotThrow(() -> { - client.customPost( - "test/all", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("body", "parameters"); - } - } - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/all", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"body\":\"parameters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue("{\"query\":\"parameters\"}", new TypeReference>() {}); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions can override default query parameters") - void customPostTest2() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("query", "myQueryParameter") - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"myQueryParameter\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions merges query parameters with default ones") - void customPostTest3() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("query2", "myQueryParameter") - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"query2\":\"myQueryParameter\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions can override default headers") - void customPostTest4() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraHeader("x-algolia-api-key", "myApiKey") - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue("{\"query\":\"parameters\"}", new TypeReference>() {}); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - - try { - Map expectedHeaders = json.readValue( - "{\"x-algolia-api-key\":\"myApiKey\"}", - new TypeReference>() {} - ); - Map actualHeaders = req.headers; - - for (Map.Entry p : expectedHeaders.entrySet()) { - assertEquals(p.getValue(), actualHeaders.get(p.getKey())); - } - } catch (JsonProcessingException e) { - fail("failed to parse headers json"); - } - } - - @Test - @DisplayName("requestOptions merges headers with default ones") - void customPostTest5() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraHeader("x-algolia-api-key", "myApiKey") - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue("{\"query\":\"parameters\"}", new TypeReference>() {}); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - - try { - Map expectedHeaders = json.readValue( - "{\"x-algolia-api-key\":\"myApiKey\"}", - new TypeReference>() {} - ); - Map actualHeaders = req.headers; - - for (Map.Entry p : expectedHeaders.entrySet()) { - assertEquals(p.getValue(), actualHeaders.get(p.getKey())); - } - } catch (JsonProcessingException e) { - fail("failed to parse headers json"); - } - } - - @Test - @DisplayName("requestOptions queryParameters accepts booleans") - void customPostTest6() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("isItWorking", true) - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"isItWorking\":\"true\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions queryParameters accepts integers") - void customPostTest7() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("myParam", 2) - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"myParam\":\"2\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions queryParameters accepts list of string") - void customPostTest8() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("myParam", Arrays.asList("b and c", "d")) - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"myParam\":\"b%20and%20c%2Cd\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions queryParameters accepts list of booleans") - void customPostTest9() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("myParam", Arrays.asList(true, true, false)) - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"myParam\":\"true%2Ctrue%2Cfalse\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("requestOptions queryParameters accepts list of integers") - void customPostTest10() { - assertDoesNotThrow(() -> { - client.customPost( - "test/requestOptions", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("facet", "filters"); - } - }, - new RequestOptions().addExtraQueryParameters("myParam", Arrays.asList(1, 2)) - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/requestOptions", req.path); - assertEquals("POST", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"facet\":\"filters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue( - "{\"query\":\"parameters\",\"myParam\":\"1%2C2\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("allow put method for a custom path with minimal parameters") - void customPutTest() { - assertDoesNotThrow(() -> { - client.customPut("test/minimal"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/minimal", req.path); - assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{}", req.body, JSONCompareMode.STRICT)); - } - - @Test - @DisplayName("allow put method for a custom path with all parameters") - void customPutTest1() { - assertDoesNotThrow(() -> { - client.customPut( - "test/all", - new HashMap() { - { - put("query", "parameters"); - } - }, - new HashMap() { - { - put("body", "parameters"); - } - } - ); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/test/all", req.path); - assertEquals("PUT", req.method); - assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"body\":\"parameters\"}", req.body, JSONCompareMode.STRICT)); - - try { - Map expectedQuery = json.readValue("{\"query\":\"parameters\"}", new TypeReference>() {}); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("getIndexUsage with minimal parameters") - void getIndexUsageTest() { - assertDoesNotThrow(() -> { - client.getIndexUsage(Statistic.QUERIES_OPERATIONS, "myIndexName", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/1/usage/queries_operations/myIndexName", req.path); - assertEquals("GET", req.method); - assertNull(req.body); - - try { - Map expectedQuery = json.readValue( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } - - @Test - @DisplayName("getUsage with minimal parameters") - void getUsageTest() { - assertDoesNotThrow(() -> { - client.getUsage(Statistic.QUERIES_OPERATIONS, "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z"); - }); - EchoResponse req = echo.getLastResponse(); - assertEquals("/1/usage/queries_operations", req.path); - assertEquals("GET", req.method); - assertNull(req.body); - - try { - Map expectedQuery = json.readValue( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}", - new TypeReference>() {} - ); - Map actualQuery = req.queryParameters; - - assertEquals(expectedQuery.size(), actualQuery.size()); - for (Map.Entry p : actualQuery.entrySet()) { - assertEquals(expectedQuery.get(p.getKey()), p.getValue()); - } - } catch (JsonProcessingException e) { - fail("failed to parse queryParameters json"); - } - } -} diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/client/UsageTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/client/UsageTest.kt deleted file mode 100644 index 39ae7211b1..0000000000 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/client/UsageTest.kt +++ /dev/null @@ -1,164 +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 - -import com.algolia.client.api.UsageClient -import com.algolia.client.configuration.* -import com.algolia.client.extensions.* -import com.algolia.client.model.usage.* -import com.algolia.client.transport.* -import com.algolia.utils.* -import io.ktor.http.* -import kotlinx.coroutines.test.* -import kotlinx.serialization.encodeToString -import kotlinx.serialization.json.* -import kotlin.test.* - -class UsageTest { - - @Test - fun `calls api with correct read host`() = runTest { - val client = UsageClient(appId = "test-app-id", apiKey = "test-api-key") - client.runTest( - call = { - customGet( - path = "test", - ) - }, - intercept = { - assertEquals("usage.algolia.com", it.url.host) - }, - ) - } - - @Test - fun `calls api with correct write host`() = runTest { - val client = UsageClient(appId = "test-app-id", apiKey = "test-api-key") - client.runTest( - call = { - customPost( - path = "test", - ) - }, - intercept = { - assertEquals("usage.algolia.com", it.url.host) - }, - ) - } - - @Test - fun `calls api with correct user agent`() = runTest { - val client = UsageClient(appId = "appId", apiKey = "apiKey") - client.runTest( - call = { - customPost( - path = "1/test", - ) - }, - intercept = { - val regexp = "^Algolia for Kotlin \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$".toRegex() - val header = it.headers["User-Agent"].orEmpty() - assertTrue(actual = header.matches(regexp), message = "Expected $header to match the following regex: $regexp") - }, - ) - } - - @Test - fun `the user agent contains the latest version`() = runTest { - val client = UsageClient(appId = "appId", apiKey = "apiKey") - client.runTest( - call = { - customPost( - path = "1/test", - ) - }, - intercept = { - val regexp = "^Algolia for Kotlin \\(3.3.0\\).*".toRegex() - val header = it.headers["User-Agent"].orEmpty() - assertTrue(actual = header.matches(regexp), message = "Expected $header to match the following regex: $regexp") - }, - ) - } - - @Test - fun `calls api with default read timeouts`() = runTest { - val client = UsageClient(appId = "appId", apiKey = "apiKey") - client.runTest( - call = { - customGet( - path = "1/test", - ) - }, - intercept = { - assertEquals(2000, it.connectTimeout) - assertEquals(5000, it.socketTimeout) - }, - ) - } - - @Test - fun `calls api with default write timeouts`() = runTest { - val client = UsageClient(appId = "appId", apiKey = "apiKey") - client.runTest( - call = { - customPost( - path = "1/test", - ) - }, - intercept = { - assertEquals(2000, it.connectTimeout) - assertEquals(30000, it.socketTimeout) - }, - ) - } - - @Test - fun `client throws with invalid parameters`() = runTest { - assertFails { - val client = UsageClient(appId = "", apiKey = "") - }.let { error -> assertError(error, "`appId` is missing.") } - assertFails { - val client = UsageClient(appId = "", apiKey = "my-api-key") - }.let { error -> assertError(error, "`appId` is missing.") } - assertFails { - val client = UsageClient(appId = "my-app-id", apiKey = "") - }.let { error -> assertError(error, "`apiKey` is missing.") } - } - - @Test - fun `switch API key`() = runTest { - val client = UsageClient(appId = "test-app-id", apiKey = "test-api-key", options = ClientOptions(hosts = listOf(Host(url = "localhost", protocol = "http", port = 6683)))) - client.runTest( - call = { - customGet( - path = "check-api-key/1", - ) - }, - - response = { - val response = Json.encodeToString(it) - assertEquals("{\"headerAPIKeyValue\":\"test-api-key\"}", response) - }, - ) - client.runTest( - call = { - setClientApiKey( - apiKey = "updated-api-key", - ) - }, - intercept = { - }, - ) - client.runTest( - call = { - customGet( - path = "check-api-key/2", - ) - }, - - response = { - val response = Json.encodeToString(it) - assertEquals("{\"headerAPIKeyValue\":\"updated-api-key\"}", response) - }, - ) - } -} diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/UsageTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/UsageTest.kt deleted file mode 100644 index 58d1d74b86..0000000000 --- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/UsageTest.kt +++ /dev/null @@ -1,510 +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.requests - -import com.algolia.client.api.UsageClient -import com.algolia.client.configuration.* -import com.algolia.client.model.usage.* -import com.algolia.client.transport.* -import com.algolia.utils.* -import io.ktor.http.* -import kotlinx.coroutines.test.* -import kotlinx.serialization.json.* -import kotlin.test.* - -class UsageTest { - - val client = UsageClient( - appId = "appId", - apiKey = "apiKey", - ) - - // customDelete - - @Test - fun `allow del method for a custom path with minimal parameters`() = runTest { - client.runTest( - call = { - customDelete( - path = "test/minimal", - ) - }, - intercept = { - assertEquals("/test/minimal".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("DELETE"), it.method) - assertNoBody(it.body) - }, - ) - } - - @Test - fun `allow del method for a custom path with all parameters1`() = runTest { - client.runTest( - call = { - customDelete( - path = "test/all", - parameters = mapOf("query" to "parameters"), - ) - }, - intercept = { - assertEquals("/test/all".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("DELETE"), it.method) - assertQueryParams("""{"query":"parameters"}""", it.url.encodedParameters) - assertNoBody(it.body) - }, - ) - } - - // customGet - - @Test - fun `allow get method for a custom path with minimal parameters`() = runTest { - client.runTest( - call = { - customGet( - path = "test/minimal", - ) - }, - intercept = { - assertEquals("/test/minimal".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("GET"), it.method) - assertNoBody(it.body) - }, - ) - } - - @Test - fun `allow get method for a custom path with all parameters1`() = runTest { - client.runTest( - call = { - customGet( - path = "test/all", - parameters = mapOf("query" to "parameters with space"), - ) - }, - intercept = { - assertEquals("/test/all".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("GET"), it.method) - assertQueryParams("""{"query":"parameters%20with%20space"}""", it.url.encodedParameters) - assertNoBody(it.body) - }, - ) - } - - @Test - fun `requestOptions should be escaped too2`() = runTest { - client.runTest( - call = { - customGet( - path = "test/all", - parameters = mapOf("query" to "to be overriden"), - requestOptions = RequestOptions( - urlParameters = buildMap { - put("query", "parameters with space") - put("and an array", listOf("array", "with spaces")) - }, - headers = buildMap { - put("x-header-1", "spaces are left alone") - }, - ), - ) - }, - intercept = { - assertEquals("/test/all".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("GET"), it.method) - assertContainsAll("""{"x-header-1":"spaces are left alone"}""", it.headers) - assertQueryParams("""{"query":"parameters%20with%20space","and%20an%20array":"array%2Cwith%20spaces"}""", it.url.encodedParameters) - assertNoBody(it.body) - }, - ) - } - - // customPost - - @Test - fun `allow post method for a custom path with minimal parameters`() = runTest { - client.runTest( - call = { - customPost( - path = "test/minimal", - ) - }, - intercept = { - assertEquals("/test/minimal".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertJsonBody("""{}""", it.body) - }, - ) - } - - @Test - fun `allow post method for a custom path with all parameters1`() = runTest { - client.runTest( - call = { - customPost( - path = "test/all", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "body", - JsonPrimitive("parameters"), - ) - }, - ) - }, - intercept = { - assertEquals("/test/all".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters"}""", it.url.encodedParameters) - assertJsonBody("""{"body":"parameters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions can override default query parameters2`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("query", "myQueryParameter") - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"myQueryParameter"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions merges query parameters with default ones3`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("query2", "myQueryParameter") - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","query2":"myQueryParameter"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions can override default headers4`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - headers = buildMap { - put("x-algolia-api-key", "myApiKey") - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertContainsAll("""{"x-algolia-api-key":"myApiKey"}""", it.headers) - assertQueryParams("""{"query":"parameters"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions merges headers with default ones5`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - headers = buildMap { - put("x-algolia-api-key", "myApiKey") - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertContainsAll("""{"x-algolia-api-key":"myApiKey"}""", it.headers) - assertQueryParams("""{"query":"parameters"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions queryParameters accepts booleans6`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("isItWorking", true) - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","isItWorking":"true"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions queryParameters accepts integers7`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("myParam", 2) - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","myParam":"2"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions queryParameters accepts list of string8`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("myParam", listOf("b and c", "d")) - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","myParam":"b%20and%20c%2Cd"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions queryParameters accepts list of booleans9`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("myParam", listOf(true, true, false)) - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","myParam":"true%2Ctrue%2Cfalse"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - @Test - fun `requestOptions queryParameters accepts list of integers10`() = runTest { - client.runTest( - call = { - customPost( - path = "test/requestOptions", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "facet", - JsonPrimitive("filters"), - ) - }, - requestOptions = RequestOptions( - urlParameters = buildMap { - put("myParam", listOf(1, 2)) - }, - ), - ) - }, - intercept = { - assertEquals("/test/requestOptions".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("POST"), it.method) - assertQueryParams("""{"query":"parameters","myParam":"1%2C2"}""", it.url.encodedParameters) - assertJsonBody("""{"facet":"filters"}""", it.body) - }, - ) - } - - // customPut - - @Test - fun `allow put method for a custom path with minimal parameters`() = runTest { - client.runTest( - call = { - customPut( - path = "test/minimal", - ) - }, - intercept = { - assertEquals("/test/minimal".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertJsonBody("""{}""", it.body) - }, - ) - } - - @Test - fun `allow put method for a custom path with all parameters1`() = runTest { - client.runTest( - call = { - customPut( - path = "test/all", - parameters = mapOf("query" to "parameters"), - body = buildJsonObject { - put( - "body", - JsonPrimitive("parameters"), - ) - }, - ) - }, - intercept = { - assertEquals("/test/all".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("PUT"), it.method) - assertQueryParams("""{"query":"parameters"}""", it.url.encodedParameters) - assertJsonBody("""{"body":"parameters"}""", it.body) - }, - ) - } - - // getIndexUsage - - @Test - fun `getIndexUsage with minimal parameters`() = runTest { - client.runTest( - call = { - getIndexUsage( - statistic = Statistic.entries.first { it.value == "queries_operations" }, - indexName = "myIndexName", - startDate = "2024-04-03T12:46:43Z", - endDate = "2024-04-05T12:46:43Z", - ) - }, - intercept = { - assertEquals("/1/usage/queries_operations/myIndexName".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("GET"), it.method) - assertQueryParams("""{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}""", it.url.encodedParameters) - assertNoBody(it.body) - }, - ) - } - - // getUsage - - @Test - fun `getUsage with minimal parameters`() = runTest { - client.runTest( - call = { - getUsage( - statistic = Statistic.entries.first { it.value == "queries_operations" }, - startDate = "2024-04-03T12:46:43Z", - endDate = "2024-04-05T12:46:43Z", - ) - }, - intercept = { - assertEquals("/1/usage/queries_operations".toPathSegments(), it.url.pathSegments) - assertEquals(HttpMethod.parse("GET"), it.method) - assertQueryParams("""{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}""", it.url.encodedParameters) - assertNoBody(it.body) - }, - ) - } -} diff --git a/tests/output/php/src/client/UsageTest.php b/tests/output/php/src/client/UsageTest.php deleted file mode 100644 index be0825af74..0000000000 --- a/tests/output/php/src/client/UsageTest.php +++ /dev/null @@ -1,216 +0,0 @@ -recordedRequest = [ - 'request' => $request, - 'responseTimeout' => $timeout * 1000, - 'connectTimeout' => $connectTimeout * 1000, - ]; - - return new Response(200, [], '{}'); - } - - #[TestDox('calls api with correct read host')] - public function test0api(): void - { - $client = $this->createClient( - 'test-app-id', - 'test-api-key' - ); - $this->assertIsObject($client); - $client->customGet( - 'test', - ); - $this->assertEquals( - 'usage.algolia.com', - $this->recordedRequest['request']->getUri()->getHost() - ); - } - - #[TestDox('calls api with correct write host')] - public function test1api(): void - { - $client = $this->createClient( - 'test-app-id', - 'test-api-key' - ); - $this->assertIsObject($client); - $client->customPost( - 'test', - ); - $this->assertEquals( - 'usage.algolia.com', - $this->recordedRequest['request']->getUri()->getHost() - ); - } - - #[TestDox('calls api with correct user agent')] - public function test0commonApi(): void - { - $client = $this->createClient(self::APP_ID, self::API_KEY); - $client->customPost( - '1/test', - ); - $this->assertTrue( - (bool) preg_match( - '/^Algolia for PHP \(\d+\.\d+\.\d+(-?.*)?\)(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*(; Usage (\(\d+\.\d+\.\d+(-?.*)?\)))(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*$/', - $this->recordedRequest['request']->getHeader('User-Agent')[0] - ) - ); - } - - #[TestDox('the user agent contains the latest version')] - public function test1commonApi(): void - { - $client = $this->createClient(self::APP_ID, self::API_KEY); - $client->customPost( - '1/test', - ); - $this->assertTrue( - (bool) preg_match( - '/^Algolia for PHP \(4.4.0\).*/', - $this->recordedRequest['request']->getHeader('User-Agent')[0] - ) - ); - } - - #[TestDox('calls api with default read timeouts')] - public function test2commonApi(): void - { - $client = $this->createClient(self::APP_ID, self::API_KEY); - $client->customGet( - '1/test', - ); - $this->assertEquals( - 2000, - $this->recordedRequest['connectTimeout'] - ); - - $this->assertEquals( - 5000, - $this->recordedRequest['responseTimeout'] - ); - } - - #[TestDox('calls api with default write timeouts')] - public function test3commonApi(): void - { - $client = $this->createClient(self::APP_ID, self::API_KEY); - $client->customPost( - '1/test', - ); - $this->assertEquals( - 2000, - $this->recordedRequest['connectTimeout'] - ); - - $this->assertEquals( - 30000, - $this->recordedRequest['responseTimeout'] - ); - } - - #[TestDox('client throws with invalid parameters')] - public function test0parameters(): void - { - try { - $client = $this->createClient( - null, - null - ); - - $this->fail('Expected exception to be thrown'); - } catch (\Exception $e) { - $this->assertEquals($e->getMessage(), '`appId` is missing.'); - } - - try { - $client = $this->createClient( - null, - 'my-api-key' - ); - - $this->fail('Expected exception to be thrown'); - } catch (\Exception $e) { - $this->assertEquals($e->getMessage(), '`appId` is missing.'); - } - - try { - $client = $this->createClient( - 'my-app-id', - null - ); - - $this->fail('Expected exception to be thrown'); - } catch (\Exception $e) { - $this->assertEquals($e->getMessage(), '`apiKey` is missing.'); - } - } - - #[TestDox('switch API key')] - public function test0setClientApiKey(): void - { - $client = UsageClient::createWithConfig(UsageConfig::create('test-app-id', 'test-api-key')->setFullHosts(['http://localhost:6683'])); - - $res = $client->customGet( - 'check-api-key/1', - ); - $this->assertEquals( - '{"headerAPIKeyValue":"test-api-key"}', - json_encode($res) - ); - - $client->setClientApiKey( - 'updated-api-key', - ); - - $res = $client->customGet( - 'check-api-key/2', - ); - $this->assertEquals( - '{"headerAPIKeyValue":"updated-api-key"}', - json_encode($res) - ); - } - - /** - * @param mixed $appId - * @param mixed $apiKey - */ - private function createClient($appId, $apiKey): UsageClient - { - $config = UsageConfig::create($appId, $apiKey); - $clusterHosts = UsageClient::getClusterHosts($config); - $api = new ApiWrapper($this, $config, $clusterHosts); - - return new UsageClient($api, $config); - } -} diff --git a/tests/output/php/src/requests/UsageTest.php b/tests/output/php/src/requests/UsageTest.php deleted file mode 100644 index d79a96762b..0000000000 --- a/tests/output/php/src/requests/UsageTest.php +++ /dev/null @@ -1,554 +0,0 @@ -recordedRequests[] = $request; - - return new Response(200, [], '{}'); - } - - #[TestDox('allow del method for a custom path with minimal parameters')] - public function testCustomDelete(): void - { - $client = $this->getClient(); - $client->customDelete( - 'test/minimal', - ); - - $this->assertRequests([ - [ - 'path' => '/test/minimal', - 'method' => 'DELETE', - 'body' => null, - ], - ]); - } - - #[TestDox('allow del method for a custom path with all parameters')] - public function testCustomDelete1(): void - { - $client = $this->getClient(); - $client->customDelete( - 'test/all', - ['query' => 'parameters', - ], - ); - - $this->assertRequests([ - [ - 'path' => '/test/all', - 'method' => 'DELETE', - 'body' => null, - 'queryParameters' => json_decode('{"query":"parameters"}', true), - ], - ]); - } - - #[TestDox('allow get method for a custom path with minimal parameters')] - public function testCustomGet(): void - { - $client = $this->getClient(); - $client->customGet( - 'test/minimal', - ); - - $this->assertRequests([ - [ - 'path' => '/test/minimal', - 'method' => 'GET', - 'body' => null, - ], - ]); - } - - #[TestDox('allow get method for a custom path with all parameters')] - public function testCustomGet1(): void - { - $client = $this->getClient(); - $client->customGet( - 'test/all', - ['query' => 'parameters with space', - ], - ); - - $this->assertRequests([ - [ - 'path' => '/test/all', - 'method' => 'GET', - 'body' => null, - 'queryParameters' => json_decode('{"query":"parameters%20with%20space"}', true), - ], - ]); - } - - #[TestDox('requestOptions should be escaped too')] - public function testCustomGet2(): void - { - $client = $this->getClient(); - $client->customGet( - 'test/all', - ['query' => 'to be overriden', - ], - [ - 'queryParameters' => [ - 'query' => 'parameters with space', - 'and an array' => ['array', 'with spaces', - ], - ], - 'headers' => [ - 'x-header-1' => 'spaces are left alone', - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/all', - 'method' => 'GET', - 'body' => null, - 'queryParameters' => json_decode('{"query":"parameters%20with%20space","and%20an%20array":"array%2Cwith%20spaces"}', true), - 'headers' => json_decode('{"x-header-1":"spaces are left alone"}', true), - ], - ]); - } - - #[TestDox('allow post method for a custom path with minimal parameters')] - public function testCustomPost(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/minimal', - ); - - $this->assertRequests([ - [ - 'path' => '/test/minimal', - 'method' => 'POST', - 'body' => json_decode('{}'), - ], - ]); - } - - #[TestDox('allow post method for a custom path with all parameters')] - public function testCustomPost1(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/all', - ['query' => 'parameters', - ], - ['body' => 'parameters', - ], - ); - - $this->assertRequests([ - [ - 'path' => '/test/all', - 'method' => 'POST', - 'body' => json_decode('{"body":"parameters"}'), - 'queryParameters' => json_decode('{"query":"parameters"}', true), - ], - ]); - } - - #[TestDox('requestOptions can override default query parameters')] - public function testCustomPost2(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'query' => 'myQueryParameter', - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"myQueryParameter"}', true), - ], - ]); - } - - #[TestDox('requestOptions merges query parameters with default ones')] - public function testCustomPost3(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'query2' => 'myQueryParameter', - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","query2":"myQueryParameter"}', true), - ], - ]); - } - - #[TestDox('requestOptions can override default headers')] - public function testCustomPost4(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'headers' => [ - 'x-algolia-api-key' => 'myApiKey', - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters"}', true), - 'headers' => json_decode('{"x-algolia-api-key":"myApiKey"}', true), - ], - ]); - } - - #[TestDox('requestOptions merges headers with default ones')] - public function testCustomPost5(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'headers' => [ - 'x-algolia-api-key' => 'myApiKey', - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters"}', true), - 'headers' => json_decode('{"x-algolia-api-key":"myApiKey"}', true), - ], - ]); - } - - #[TestDox('requestOptions queryParameters accepts booleans')] - public function testCustomPost6(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'isItWorking' => true, - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","isItWorking":"true"}', true), - ], - ]); - } - - #[TestDox('requestOptions queryParameters accepts integers')] - public function testCustomPost7(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'myParam' => 2, - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","myParam":"2"}', true), - ], - ]); - } - - #[TestDox('requestOptions queryParameters accepts list of string')] - public function testCustomPost8(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'myParam' => ['b and c', 'd', - ], - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","myParam":"b%20and%20c%2Cd"}', true), - ], - ]); - } - - #[TestDox('requestOptions queryParameters accepts list of booleans')] - public function testCustomPost9(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'myParam' => [true, true, false, - ], - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","myParam":"true%2Ctrue%2Cfalse"}', true), - ], - ]); - } - - #[TestDox('requestOptions queryParameters accepts list of integers')] - public function testCustomPost10(): void - { - $client = $this->getClient(); - $client->customPost( - 'test/requestOptions', - ['query' => 'parameters', - ], - ['facet' => 'filters', - ], - [ - 'queryParameters' => [ - 'myParam' => [1, 2, - ], - ], - ] - ); - - $this->assertRequests([ - [ - 'path' => '/test/requestOptions', - 'method' => 'POST', - 'body' => json_decode('{"facet":"filters"}'), - 'queryParameters' => json_decode('{"query":"parameters","myParam":"1%2C2"}', true), - ], - ]); - } - - #[TestDox('allow put method for a custom path with minimal parameters')] - public function testCustomPut(): void - { - $client = $this->getClient(); - $client->customPut( - 'test/minimal', - ); - - $this->assertRequests([ - [ - 'path' => '/test/minimal', - 'method' => 'PUT', - 'body' => json_decode('{}'), - ], - ]); - } - - #[TestDox('allow put method for a custom path with all parameters')] - public function testCustomPut1(): void - { - $client = $this->getClient(); - $client->customPut( - 'test/all', - ['query' => 'parameters', - ], - ['body' => 'parameters', - ], - ); - - $this->assertRequests([ - [ - 'path' => '/test/all', - 'method' => 'PUT', - 'body' => json_decode('{"body":"parameters"}'), - 'queryParameters' => json_decode('{"query":"parameters"}', true), - ], - ]); - } - - #[TestDox('getIndexUsage with minimal parameters')] - public function testGetIndexUsage(): void - { - $client = $this->getClient(); - $client->getIndexUsage( - 'queries_operations', - 'myIndexName', - '2024-04-03T12:46:43Z', - '2024-04-05T12:46:43Z', - ); - - $this->assertRequests([ - [ - 'path' => '/1/usage/queries_operations/myIndexName', - 'method' => 'GET', - 'body' => null, - 'queryParameters' => json_decode('{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}', true), - ], - ]); - } - - #[TestDox('getUsage with minimal parameters')] - public function testGetUsage(): void - { - $client = $this->getClient(); - $client->getUsage( - 'queries_operations', - '2024-04-03T12:46:43Z', - '2024-04-05T12:46:43Z', - ); - - $this->assertRequests([ - [ - 'path' => '/1/usage/queries_operations', - 'method' => 'GET', - 'body' => null, - 'queryParameters' => json_decode('{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}', true), - ], - ]); - } - - protected function assertRequests(array $requests): void - { - $this->assertGreaterThan(0, count($requests)); - $this->assertEquals(count($requests), count($this->recordedRequests)); - - foreach ($requests as $i => $request) { - $recordedRequest = $this->recordedRequests[$i]; - - $this->assertEquals($request['method'], $recordedRequest->getMethod()); - - $this->assertEquals($request['path'], $recordedRequest->getUri()->getPath()); - - if (isset($request['body'])) { - $this->assertEquals( - json_encode($request['body']), - $recordedRequest->getBody()->getContents() - ); - } - - if (isset($request['queryParameters'])) { - $this->assertEquals( - Query::build($request['queryParameters'], false), - $recordedRequest->getUri()->getQuery() - ); - } - - if (isset($request['headers'])) { - foreach ($request['headers'] as $key => $value) { - $this->assertArrayHasKey( - $key, - $recordedRequest->getHeaders() - ); - $this->assertEquals( - $recordedRequest->getHeaderLine($key), - $value - ); - } - } - } - } - - protected function getClient(): UsageClient - { - $config = UsageConfig::create('appID', 'apiKey'); - $api = new ApiWrapper($this, $config, ClusterHosts::create('127.0.0.1')); - - return new UsageClient($api, $config); - } -} diff --git a/tests/output/scala/src/test/scala/algoliasearch/client/UsageTest.scala b/tests/output/scala/src/test/scala/algoliasearch/client/UsageTest.scala deleted file mode 100644 index ca1fe3dd03..0000000000 --- a/tests/output/scala/src/test/scala/algoliasearch/client/UsageTest.scala +++ /dev/null @@ -1,171 +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 algoliasearch.client - -import algoliasearch.api.UsageClient -import algoliasearch.config.* -import algoliasearch.{EchoInterceptor, assertError} -import algoliasearch.usage.* -import algoliasearch.exception.* -import org.json4s.* -import org.json4s.native.JsonParser.* -import org.json4s.native.Serialization -import org.json4s.native.Serialization.write -import org.scalatest.funsuite.AnyFunSuite - -import scala.concurrent.duration.Duration -import scala.concurrent.{Await, ExecutionContextExecutor} - -class UsageTest extends AnyFunSuite { - implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global - implicit val formats: Formats = org.json4s.DefaultFormats - - def testClient(appId: String = "appId", apiKey: String = "apiKey"): (UsageClient, EchoInterceptor) = { - val echo = EchoInterceptor() - ( - UsageClient( - appId = appId, - apiKey = apiKey, - clientOptions = ClientOptions - .builder() - .withRequesterConfig(requester => requester.withInterceptor(echo)) - .build() - ), - echo - ) - } - - test("calls api with correct read host") { - - val (client, echo) = testClient(appId = "test-app-id", apiKey = "test-api-key") - - Await.ready( - client.customGet[JObject]( - path = "test" - ), - Duration.Inf - ) - assert(echo.lastResponse.get.host == "usage.algolia.com") - } - - test("calls api with correct write host") { - - val (client, echo) = testClient(appId = "test-app-id", apiKey = "test-api-key") - - Await.ready( - client.customPost[JObject]( - path = "test" - ), - Duration.Inf - ) - assert(echo.lastResponse.get.host == "usage.algolia.com") - } - - test("calls api with correct user agent") { - val (client, echo) = testClient() - - Await.ready( - client.customPost[JObject]( - path = "1/test" - ), - Duration.Inf - ) - val regexp = - """^Algolia for Scala \(\d+\.\d+\.\d+(-?.*)?\)(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*(; Usage (\(\d+\.\d+\.\d+(-?.*)?\)))(; [a-zA-Z. ]+ (\(\d+((\.\d+)?\.\d+)?(-?.*)?\))?)*$""".r - val header = echo.lastResponse.get.headers("user-agent") - assert(header.matches(regexp.regex), s"Expected $header to match the following regex: ${regexp.regex}") - } - - test("the user agent contains the latest version") { - val (client, echo) = testClient() - - Await.ready( - client.customPost[JObject]( - path = "1/test" - ), - Duration.Inf - ) - val regexp = """^Algolia for Scala \(2.3.0\).*""".r - val header = echo.lastResponse.get.headers("user-agent") - assert(header.matches(regexp.regex), s"Expected $header to match the following regex: ${regexp.regex}") - } - - test("calls api with default read timeouts") { - val (client, echo) = testClient() - - Await.ready( - client.customGet[JObject]( - path = "1/test" - ), - Duration.Inf - ) - assert(echo.lastResponse.get.connectTimeout == 2000) - assert(echo.lastResponse.get.responseTimeout == 5000) - } - - test("calls api with default write timeouts") { - val (client, echo) = testClient() - - Await.ready( - client.customPost[JObject]( - path = "1/test" - ), - Duration.Inf - ) - assert(echo.lastResponse.get.connectTimeout == 2000) - assert(echo.lastResponse.get.responseTimeout == 30000) - } - - test("client throws with invalid parameters") { - - assertError("`appId` is missing.") { - val (client, echo) = testClient(appId = "", apiKey = "") - } - - assertError("`appId` is missing.") { - val (client, echo) = testClient(appId = "", apiKey = "my-api-key") - } - - assertError("`apiKey` is missing.") { - val (client, echo) = testClient(appId = "my-app-id", apiKey = "") - } - } - - test("switch API key") { - - val client = UsageClient( - appId = "test-app-id", - apiKey = "test-api-key", - clientOptions = ClientOptions - .builder() - .withHosts(List(Host("localhost", Set(CallType.Read, CallType.Write), "http", Option(6683)))) - .build() - ) - - { - var res = Await.result( - client.customGet[JObject]( - path = "check-api-key/1" - ), - Duration.Inf - ) - assert(write(res) == "{\"headerAPIKeyValue\":\"test-api-key\"}") - } - - { - - client.setClientApiKey( - apiKey = "updated-api-key" - ) - } - - { - var res = Await.result( - client.customGet[JObject]( - path = "check-api-key/2" - ), - Duration.Inf - ) - assert(write(res) == "{\"headerAPIKeyValue\":\"updated-api-key\"}") - } - } -} diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/UsageTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/UsageTest.scala deleted file mode 100644 index 579f3d509d..0000000000 --- a/tests/output/scala/src/test/scala/algoliasearch/requests/UsageTest.scala +++ /dev/null @@ -1,572 +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 algoliasearch.requests - -import algoliasearch.EchoInterceptor -import algoliasearch.api.UsageClient -import algoliasearch.config.* -import algoliasearch.usage.* -import org.json4s.* -import org.json4s.native.JsonParser.* -import org.scalatest.funsuite.AnyFunSuite - -import scala.concurrent.duration.Duration -import scala.concurrent.{Await, ExecutionContextExecutor} - -class UsageTest extends AnyFunSuite { - implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global - implicit val formats: Formats = org.json4s.DefaultFormats - - def testClient(): (UsageClient, EchoInterceptor) = { - val echo = EchoInterceptor() - ( - UsageClient( - appId = "appId", - apiKey = "apiKey", - clientOptions = ClientOptions - .builder() - .withRequesterConfig(requester => requester.withInterceptor(echo)) - .build() - ), - echo - ) - } - - test("allow del method for a custom path with minimal parameters") { - val (client, echo) = testClient() - val future = client.customDelete[JObject]( - path = "test/minimal" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/minimal") - assert(res.method == "DELETE") - assert(res.body.isEmpty) - } - - test("allow del method for a custom path with all parameters1") { - val (client, echo) = testClient() - val future = client.customDelete[JObject]( - path = "test/all", - parameters = Some(Map("query" -> "parameters")) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/all") - assert(res.method == "DELETE") - assert(res.body.isEmpty) - val expectedQuery = parse("""{"query":"parameters"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("allow get method for a custom path with minimal parameters") { - val (client, echo) = testClient() - val future = client.customGet[JObject]( - path = "test/minimal" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/minimal") - assert(res.method == "GET") - assert(res.body.isEmpty) - } - - test("allow get method for a custom path with all parameters1") { - val (client, echo) = testClient() - val future = client.customGet[JObject]( - path = "test/all", - parameters = Some(Map("query" -> "parameters with space")) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/all") - assert(res.method == "GET") - assert(res.body.isEmpty) - val expectedQuery = parse("""{"query":"parameters%20with%20space"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions should be escaped too2") { - val (client, echo) = testClient() - val future = client.customGet[JObject]( - path = "test/all", - parameters = Some(Map("query" -> "to be overriden")), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("query", "parameters with space") - .withQueryParameter("and an array", Seq("array", "with spaces")) - .withHeader("x-header-1", "spaces are left alone") - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/all") - assert(res.method == "GET") - assert(res.body.isEmpty) - val expectedQuery = parse("""{"query":"parameters%20with%20space","and%20an%20array":"array%2Cwith%20spaces"}""") - .asInstanceOf[JObject] - .obj - .toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - val expectedHeaders = parse("""{"x-header-1":"spaces are left alone"}""").asInstanceOf[JObject].obj.toMap - val actualHeaders = res.headers - for ((k, v) <- expectedHeaders) { - assert(actualHeaders.contains(k)) - assert(actualHeaders(k) == v.asInstanceOf[JString].s) - } - } - - test("allow post method for a custom path with minimal parameters") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/minimal" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/minimal") - assert(res.method == "POST") - val expectedBody = parse("""{}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - } - - test("allow post method for a custom path with all parameters1") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/all", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("body", JString("parameters"))))) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/all") - assert(res.method == "POST") - val expectedBody = parse("""{"body":"parameters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions can override default query parameters2") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("query", "myQueryParameter") - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"myQueryParameter"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions merges query parameters with default ones3") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("query2", "myQueryParameter") - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters","query2":"myQueryParameter"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions can override default headers4") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withHeader("x-algolia-api-key", "myApiKey") - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - val expectedHeaders = parse("""{"x-algolia-api-key":"myApiKey"}""").asInstanceOf[JObject].obj.toMap - val actualHeaders = res.headers - for ((k, v) <- expectedHeaders) { - assert(actualHeaders.contains(k)) - assert(actualHeaders(k) == v.asInstanceOf[JString].s) - } - } - - test("requestOptions merges headers with default ones5") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withHeader("x-algolia-api-key", "myApiKey") - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - val expectedHeaders = parse("""{"x-algolia-api-key":"myApiKey"}""").asInstanceOf[JObject].obj.toMap - val actualHeaders = res.headers - for ((k, v) <- expectedHeaders) { - assert(actualHeaders.contains(k)) - assert(actualHeaders(k) == v.asInstanceOf[JString].s) - } - } - - test("requestOptions queryParameters accepts booleans6") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("isItWorking", true) - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters","isItWorking":"true"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions queryParameters accepts integers7") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("myParam", 2) - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters","myParam":"2"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions queryParameters accepts list of string8") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("myParam", Seq("b and c", "d")) - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters","myParam":"b%20and%20c%2Cd"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions queryParameters accepts list of booleans9") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("myParam", Seq(true, true, false)) - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = - parse("""{"query":"parameters","myParam":"true%2Ctrue%2Cfalse"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("requestOptions queryParameters accepts list of integers10") { - val (client, echo) = testClient() - val future = client.customPost[JObject]( - path = "test/requestOptions", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("facet", JString("filters"))))), - requestOptions = Some( - RequestOptions - .builder() - .withQueryParameter("myParam", Seq(1, 2)) - .build() - ) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/requestOptions") - assert(res.method == "POST") - val expectedBody = parse("""{"facet":"filters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters","myParam":"1%2C2"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("allow put method for a custom path with minimal parameters") { - val (client, echo) = testClient() - val future = client.customPut[JObject]( - path = "test/minimal" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/minimal") - assert(res.method == "PUT") - val expectedBody = parse("""{}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - } - - test("allow put method for a custom path with all parameters1") { - val (client, echo) = testClient() - val future = client.customPut[JObject]( - path = "test/all", - parameters = Some(Map("query" -> "parameters")), - body = Some(JObject(List(JField("body", JString("parameters"))))) - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/test/all") - assert(res.method == "PUT") - val expectedBody = parse("""{"body":"parameters"}""") - val actualBody = parse(res.body.get) - assert(actualBody == expectedBody) - val expectedQuery = parse("""{"query":"parameters"}""").asInstanceOf[JObject].obj.toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("getIndexUsage with minimal parameters") { - val (client, echo) = testClient() - val future = client.getIndexUsage( - statistic = Statistic.withName("queries_operations"), - indexName = "myIndexName", - startDate = "2024-04-03T12:46:43Z", - endDate = "2024-04-05T12:46:43Z" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/1/usage/queries_operations/myIndexName") - assert(res.method == "GET") - assert(res.body.isEmpty) - val expectedQuery = parse("""{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}""") - .asInstanceOf[JObject] - .obj - .toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - - test("getUsage with minimal parameters") { - val (client, echo) = testClient() - val future = client.getUsage( - statistic = Statistic.withName("queries_operations"), - startDate = "2024-04-03T12:46:43Z", - endDate = "2024-04-05T12:46:43Z" - ) - - Await.ready(future, Duration.Inf) - val res = echo.lastResponse.get - - assert(res.path == "/1/usage/queries_operations") - assert(res.method == "GET") - assert(res.body.isEmpty) - val expectedQuery = parse("""{"startDate":"2024-04-03T12%3A46%3A43Z","endDate":"2024-04-05T12%3A46%3A43Z"}""") - .asInstanceOf[JObject] - .obj - .toMap - val actualQuery = res.queryParameters - assert(actualQuery.size == expectedQuery.size) - for ((k, v) <- actualQuery) { - assert(expectedQuery.contains(k)) - assert(expectedQuery(k).values == v) - } - } - -} diff --git a/tests/output/swift/Tests/client/UsageTests.swift b/tests/output/swift/Tests/client/UsageTests.swift deleted file mode 100644 index 42506e6a0a..0000000000 --- a/tests/output/swift/Tests/client/UsageTests.swift +++ /dev/null @@ -1,175 +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 XCTest - -import Utils - -@testable import Core -@testable import Usage - -final class UsageClientClientTests: XCTestCase { - let APPLICATION_ID = "my_application_id" - let API_KEY = "my_api_key" - - /// calls api with correct read host - func testApiTest0() async throws { - let configuration = try UsageClientConfiguration(appID: "test-app-id", apiKey: "test-api-key") - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - let response = try await client.customGetWithHTTPInfo(path: "test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertEqual("usage.algolia.com", echoResponse.host) - } - - /// calls api with correct write host - func testApiTest1() async throws { - let configuration = try UsageClientConfiguration(appID: "test-app-id", apiKey: "test-api-key") - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - let response = try await client.customPostWithHTTPInfo(path: "test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertEqual("usage.algolia.com", echoResponse.host) - } - - /// calls api with correct user agent - func testCommonApiTest0() async throws { - let configuration = try UsageClientConfiguration(appID: APPLICATION_ID, apiKey: API_KEY) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo(path: "1/test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let pattern = - "^Algolia for Swift \\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*(; Usage (\\(\\d+\\.\\d+\\.\\d+(-?.*)?\\)))(; [a-zA-Z. ]+ (\\(\\d+((\\.\\d+)?\\.\\d+)?(-?.*)?\\))?)*$" - let rule = StringRule(pattern: pattern) - let userAgent = try XCTUnwrap(echoResponse.headers?["User-Agent"]) - guard let userAgent else { - XCTFail("Expected user-agent header") - return - } - - XCTAssertNoThrow( - try Validator.validate(userAgent, against: rule), - "Expected " + userAgent + " to match the following regex: " + pattern - ) - } - - /// the user agent contains the latest version - func testCommonApiTest1() async throws { - let configuration = try UsageClientConfiguration(appID: APPLICATION_ID, apiKey: API_KEY) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo(path: "1/test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let pattern = "^Algolia for Swift \\(9.3.0\\).*" - let rule = StringRule(pattern: pattern) - let userAgent = try XCTUnwrap(echoResponse.headers?["User-Agent"]) - guard let userAgent else { - XCTFail("Expected user-agent header") - return - } - - XCTAssertNoThrow( - try Validator.validate(userAgent, against: rule), - "Expected " + userAgent + " to match the following regex: " + pattern - ) - } - - /// calls api with default read timeouts - func testCommonApiTest2() async throws { - let configuration = try UsageClientConfiguration(appID: APPLICATION_ID, apiKey: API_KEY) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customGetWithHTTPInfo(path: "1/test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertEqual(TimeInterval(5000 / 1000), echoResponse.timeout) - } - - /// calls api with default write timeouts - func testCommonApiTest3() async throws { - let configuration = try UsageClientConfiguration(appID: APPLICATION_ID, apiKey: API_KEY) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo(path: "1/test") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertEqual(TimeInterval(30000 / 1000), echoResponse.timeout) - } - - /// client throws with invalid parameters - func testParametersTest0() async throws { - do { - let configuration = try UsageClientConfiguration(appID: "", apiKey: "") - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - XCTFail("Expected an error to be thrown") - } catch { - XCTAssertEqual(error.localizedDescription, "`appId` is missing.") - } - do { - let configuration = try UsageClientConfiguration(appID: "", apiKey: "my-api-key") - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - XCTFail("Expected an error to be thrown") - } catch { - XCTAssertEqual(error.localizedDescription, "`appId` is missing.") - } - do { - let configuration = try UsageClientConfiguration(appID: "my-app-id", apiKey: "") - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - XCTFail("Expected an error to be thrown") - } catch { - XCTAssertEqual(error.localizedDescription, "`apiKey` is missing.") - } - } - - /// switch API key - func testSetClientApiKeyTest0() async throws { - let configuration = try UsageClientConfiguration( - appID: "test-app-id", - apiKey: "test-api-key", - hosts: [RetryableHost(url: URL(string: "http://localhost:6683")!)] - ) - let transporter = Transporter(configuration: configuration) - let client = UsageClient(configuration: configuration, transporter: transporter) - do { - let response = try await client.customGetWithHTTPInfo(path: "check-api-key/1") - let responseBodyData = try XCTUnwrap(response.bodyData) - let responseBodyJSON = try XCTUnwrap(responseBodyData.jsonString) - - let comparableData = "{\"headerAPIKeyValue\":\"test-api-key\"}".data(using: .utf8) - let comparableJSON = try XCTUnwrap(comparableData?.jsonString) - XCTAssertEqual(comparableJSON, responseBodyJSON) - } - do { - try client.setClientApiKey(apiKey: "updated-api-key") - } - do { - let response = try await client.customGetWithHTTPInfo(path: "check-api-key/2") - let responseBodyData = try XCTUnwrap(response.bodyData) - let responseBodyJSON = try XCTUnwrap(responseBodyData.jsonString) - - let comparableData = "{\"headerAPIKeyValue\":\"updated-api-key\"}".data(using: .utf8) - let comparableJSON = try XCTUnwrap(comparableData?.jsonString) - XCTAssertEqual(comparableJSON, responseBodyJSON) - } - } -} diff --git a/tests/output/swift/Tests/requests/UsageTests.swift b/tests/output/swift/Tests/requests/UsageTests.swift deleted file mode 100644 index af0787b941..0000000000 --- a/tests/output/swift/Tests/requests/UsageTests.swift +++ /dev/null @@ -1,755 +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 XCTest - -import Utils - -@testable import Core -@testable import Usage - -final class UsageClientRequestsTests: XCTestCase { - static let APPLICATION_ID = "my_application_id" - static let API_KEY = "my_api_key" - - /// allow del method for a custom path with minimal parameters - func testCustomDeleteTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customDeleteWithHTTPInfo(path: "test/minimal") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/test/minimal") - XCTAssertEqual(echoResponse.method, HTTPMethod.delete) - - XCTAssertNil(echoResponse.queryParameters) - } - - /// allow del method for a custom path with all parameters - func testCustomDeleteTest1() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customDeleteWithHTTPInfo( - path: "test/all", - parameters: ["query": AnyCodable("parameters")] - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/test/all") - XCTAssertEqual(echoResponse.method, HTTPMethod.delete) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// allow get method for a custom path with minimal parameters - func testCustomGetTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customGetWithHTTPInfo(path: "test/minimal") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/test/minimal") - XCTAssertEqual(echoResponse.method, HTTPMethod.get) - - XCTAssertNil(echoResponse.queryParameters) - } - - /// allow get method for a custom path with all parameters - func testCustomGetTest1() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customGetWithHTTPInfo( - path: "test/all", - parameters: ["query": AnyCodable("parameters with space")] - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/test/all") - XCTAssertEqual(echoResponse.method, HTTPMethod.get) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters%20with%20space\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions should be escaped too - func testCustomGetTest2() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customGetWithHTTPInfo( - path: "test/all", - parameters: ["query": AnyCodable("to be overriden")], - requestOptions: RequestOptions( - headers: ["x-header-1": "spaces are left alone"], - - queryParameters: ["query": "parameters with space", "and an array": ["array", "with spaces"]] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/test/all") - XCTAssertEqual(echoResponse.method, HTTPMethod.get) - - let expectedQueryParameters = - try XCTUnwrap( - "{\"query\":\"parameters%20with%20space\",\"and%20an%20array\":\"array%2Cwith%20spaces\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - - let expectedHeaders = try XCTUnwrap("{\"x-header-1\":\"spaces are left alone\"}".data(using: .utf8)) - let expectedHeadersMap = try CodableHelper.jsonDecoder.decode([String: String?].self, from: expectedHeaders) - - let echoResponseHeaders = try XCTUnwrap(echoResponse.headers) - for header in expectedHeadersMap { - XCTAssertEqual(echoResponseHeaders[header.key.capitalized], header.value) - } - } - - /// allow post method for a custom path with minimal parameters - func testCustomPostTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo(path: "test/minimal") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/minimal") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - XCTAssertNil(echoResponse.queryParameters) - } - - /// allow post method for a custom path with all parameters - func testCustomPostTest1() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/all", - parameters: ["query": AnyCodable("parameters")], - body: ["body": "parameters"] - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"body\":\"parameters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/all") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions can override default query parameters - func testCustomPostTest2() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["query": "myQueryParameter"] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"myQueryParameter\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions merges query parameters with default ones - func testCustomPostTest3() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["query2": "myQueryParameter"] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"query2\":\"myQueryParameter\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions can override default headers - func testCustomPostTest4() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - headers: ["x-algolia-api-key": "myApiKey"] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - - let expectedHeaders = try XCTUnwrap("{\"x-algolia-api-key\":\"myApiKey\"}".data(using: .utf8)) - let expectedHeadersMap = try CodableHelper.jsonDecoder.decode([String: String?].self, from: expectedHeaders) - - let echoResponseHeaders = try XCTUnwrap(echoResponse.headers) - for header in expectedHeadersMap { - XCTAssertEqual(echoResponseHeaders[header.key.capitalized], header.value) - } - } - - /// requestOptions merges headers with default ones - func testCustomPostTest5() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - headers: ["x-algolia-api-key": "myApiKey"] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - - let expectedHeaders = try XCTUnwrap("{\"x-algolia-api-key\":\"myApiKey\"}".data(using: .utf8)) - let expectedHeadersMap = try CodableHelper.jsonDecoder.decode([String: String?].self, from: expectedHeaders) - - let echoResponseHeaders = try XCTUnwrap(echoResponse.headers) - for header in expectedHeadersMap { - XCTAssertEqual(echoResponseHeaders[header.key.capitalized], header.value) - } - } - - /// requestOptions queryParameters accepts booleans - func testCustomPostTest6() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["isItWorking": true] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"isItWorking\":\"true\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions queryParameters accepts integers - func testCustomPostTest7() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["myParam": 2] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"myParam\":\"2\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions queryParameters accepts list of string - func testCustomPostTest8() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["myParam": ["b and c", "d"]] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"myParam\":\"b%20and%20c%2Cd\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions queryParameters accepts list of booleans - func testCustomPostTest9() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["myParam": [true, true, false]] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"myParam\":\"true%2Ctrue%2Cfalse\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// requestOptions queryParameters accepts list of integers - func testCustomPostTest10() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPostWithHTTPInfo( - path: "test/requestOptions", - parameters: ["query": AnyCodable("parameters")], - body: ["facet": "filters"], - requestOptions: RequestOptions( - queryParameters: ["myParam": [1, 2]] - ) - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"facet\":\"filters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/requestOptions") - XCTAssertEqual(echoResponse.method, HTTPMethod.post) - - let expectedQueryParameters = try XCTUnwrap( - "{\"query\":\"parameters\",\"myParam\":\"1%2C2\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// allow put method for a custom path with minimal parameters - func testCustomPutTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPutWithHTTPInfo(path: "test/minimal") - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/minimal") - XCTAssertEqual(echoResponse.method, HTTPMethod.put) - - XCTAssertNil(echoResponse.queryParameters) - } - - /// allow put method for a custom path with all parameters - func testCustomPutTest1() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.customPutWithHTTPInfo( - path: "test/all", - parameters: ["query": AnyCodable("parameters")], - body: ["body": "parameters"] - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData) - let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString) - - let expectedBodyData = "{\"body\":\"parameters\"}".data(using: .utf8) - let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString) - - XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON) - - XCTAssertEqual(echoResponse.path, "/test/all") - XCTAssertEqual(echoResponse.method, HTTPMethod.put) - - let expectedQueryParameters = try XCTUnwrap("{\"query\":\"parameters\"}".data(using: .utf8)) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// getIndexUsage with minimal parameters - func testGetIndexUsageTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.getIndexUsageWithHTTPInfo( - statistic: Statistic.queriesOperations, - indexName: "myIndexName", - startDate: "2024-04-03T12:46:43Z", - endDate: "2024-04-05T12:46:43Z" - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/1/usage/queries_operations/myIndexName") - XCTAssertEqual(echoResponse.method, HTTPMethod.get) - - let expectedQueryParameters = - try XCTUnwrap( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } - - /// getUsage with minimal parameters - func testGetUsageTest() async throws { - let configuration = try UsageClientConfiguration( - appID: UsageClientRequestsTests.APPLICATION_ID, - apiKey: UsageClientRequestsTests.API_KEY - ) - let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder()) - let client = UsageClient(configuration: configuration, transporter: transporter) - - let response = try await client.getUsageWithHTTPInfo( - statistic: Statistic.queriesOperations, - startDate: "2024-04-03T12:46:43Z", - endDate: "2024-04-05T12:46:43Z" - ) - let responseBodyData = try XCTUnwrap(response.bodyData) - let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData) - - XCTAssertNil(echoResponse.originalBodyData) - - XCTAssertEqual(echoResponse.path, "/1/usage/queries_operations") - XCTAssertEqual(echoResponse.method, HTTPMethod.get) - - let expectedQueryParameters = - try XCTUnwrap( - "{\"startDate\":\"2024-04-03T12%3A46%3A43Z\",\"endDate\":\"2024-04-05T12%3A46%3A43Z\"}" - .data(using: .utf8) - ) - let expectedQueryParametersMap = try CodableHelper.jsonDecoder.decode( - [String: String?].self, - from: expectedQueryParameters - ) - - XCTAssertEqual(echoResponse.queryParameters, expectedQueryParametersMap) - } -} From b176e97dd52575df77347b24daf9683c9b583aee Mon Sep 17 00:00:00 2001 From: shortcuts Date: Wed, 11 Sep 2024 16:14:08 +0200 Subject: [PATCH 7/9] chore: more usage --- snippets/swift/Package.swift | 6 +----- templates/Bug_report.yml | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/snippets/swift/Package.swift b/snippets/swift/Package.swift index cb4c9f69a1..29418dd284 100644 --- a/snippets/swift/Package.swift +++ b/snippets/swift/Package.swift @@ -60,11 +60,7 @@ let package = Package( .product( name: "Search", package: "algoliasearch-client-swift" - ), - .product( - name: "Usage", - package: "algoliasearch-client-swift" - ), + ) ] ), ] diff --git a/templates/Bug_report.yml b/templates/Bug_report.yml index e919fd952d..ecf2dfdbd5 100644 --- a/templates/Bug_report.yml +++ b/templates/Bug_report.yml @@ -39,7 +39,6 @@ body: - Query-Suggestions - Recommend - Search - - Usage - Crawler validations: required: true From ddd3c787907ae75baf86a23fb7deb595a55e39e0 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 11 Sep 2024 16:18:00 +0200 Subject: [PATCH 8/9] remove --- eslint/src/rules/refCommon.ts | 1 - snippets/javascript/package.json | 1 - 2 files changed, 2 deletions(-) diff --git a/eslint/src/rules/refCommon.ts b/eslint/src/rules/refCommon.ts index 5f3c3d1972..b12598907d 100644 --- a/eslint/src/rules/refCommon.ts +++ b/eslint/src/rules/refCommon.ts @@ -13,7 +13,6 @@ const allSpecs = [ 'query-suggestions', 'recommend', 'search', - 'usage', ]; export const refCommon: Rule.RuleModule = { diff --git a/snippets/javascript/package.json b/snippets/javascript/package.json index 144aca30df..aa67a7064a 100644 --- a/snippets/javascript/package.json +++ b/snippets/javascript/package.json @@ -9,7 +9,6 @@ "@algolia/client-personalization": "link:../../clients/algoliasearch-client-javascript/packages/client-personalization", "@algolia/client-query-suggestions": "link:../../clients/algoliasearch-client-javascript/packages/client-query-suggestions", "@algolia/client-search": "link:../../clients/algoliasearch-client-javascript/packages/client-search", - "@algolia/client-usage": "link:../../clients/algoliasearch-client-javascript/packages/client-usage", "@algolia/ingestion": "link:../../clients/algoliasearch-client-javascript/packages/ingestion", "@algolia/monitoring": "link:../../clients/algoliasearch-client-javascript/packages/monitoring", "@algolia/recommend": "link:../../clients/algoliasearch-client-javascript/packages/recommend", From 4b898eb99b0e698858e5464149d5486e2ce5dc21 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 11 Sep 2024 16:23:04 +0200 Subject: [PATCH 9/9] last one --- specs/major-breaking-changes-rename.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/major-breaking-changes-rename.json b/specs/major-breaking-changes-rename.json index 94f06a0d87..2fec9ea362 100644 --- a/specs/major-breaking-changes-rename.json +++ b/specs/major-breaking-changes-rename.json @@ -57,7 +57,7 @@ "index.deleteObjects": "client.deleteObjects", "index.deleteRule": "client.deleteRule", "index.deleteSynonym": "client.deleteSynonym", - "index.exists": "client.getSettings", + "index.exists": "client.indexExists", "index.findObject": "client.searchSingleIndex", "index.getObject": "client.getObject", "index.getObjects": "client.getObjects",