From d28c7f8fd87ff3f96f5775d8c19b6bf520d43735 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 3 Dec 2021 15:15:22 +0100 Subject: [PATCH 01/19] modify spec to fit the java client (should not be done) --- .../client-search/model/baseSearchParams.ts | 2 +- .../client-search/model/models.ts | 1 - .../client-search/src/searchApi.ts | 14 +++++--------- .../recommend/model/baseSearchParams.ts | 2 +- specs/search/common/schemas/IndexSettings.yml | 6 +++--- specs/search/common/schemas/SearchParams.yml | 6 +----- specs/search/paths/search/search.yml | 4 +--- 7 files changed, 12 insertions(+), 23 deletions(-) diff --git a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts index f23907fbe3..e204ff0176 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts @@ -70,7 +70,7 @@ export type BaseSearchParams = { /** * Define the maximum radius for a geo search (in meters). */ - aroundRadius?: number | string | null; + aroundRadius?: number; /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. */ diff --git a/clients/algoliasearch-client-javascript/client-search/model/models.ts b/clients/algoliasearch-client-javascript/client-search/model/models.ts index 2fb37bde75..9598fc4df3 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/models.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/models.ts @@ -26,7 +26,6 @@ export * from './record'; export * from './saveObjectResponse'; export * from './searchHits'; export * from './searchParams'; -export * from './searchParamsAsString'; export * from './searchResponse'; export * from './setSettingsResponse'; export * from './snippetResult'; diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index 9484c7b09e..d9e31c25d3 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -10,7 +10,6 @@ import type { OperationIndexObject } from '../model/operationIndexObject'; import type { OperationIndexResponse } from '../model/operationIndexResponse'; import type { SaveObjectResponse } from '../model/saveObjectResponse'; import type { SearchParams } from '../model/searchParams'; -import type { SearchParamsAsString } from '../model/searchParamsAsString'; import type { SearchResponse } from '../model/searchResponse'; import type { SetSettingsResponse } from '../model/setSettingsResponse'; import { Transporter } from '../utils/Transporter'; @@ -357,11 +356,11 @@ export class SearchApi { * Get search results. * * @param indexName - The index in which to perform the request. - * @param searchParamsAsStringSearchParams - The searchParamsAsStringSearchParams. + * @param searchParams - The searchParams. */ search( indexName: string, - searchParamsAsStringSearchParams: SearchParams | SearchParamsAsString + searchParams: SearchParams ): Promise { const path = '/1/indexes/{indexName}/query'.replace( '{indexName}', @@ -376,19 +375,16 @@ export class SearchApi { ); } - if ( - searchParamsAsStringSearchParams === null || - searchParamsAsStringSearchParams === undefined - ) { + if (searchParams === null || searchParams === undefined) { throw new Error( - 'Required parameter searchParamsAsStringSearchParams was null or undefined when calling search.' + 'Required parameter searchParams was null or undefined when calling search.' ); } const request: Request = { method: 'POST', path, - data: searchParamsAsStringSearchParams, + data: searchParams, }; const requestOptions: RequestOptions = { diff --git a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts index f23907fbe3..e204ff0176 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts @@ -70,7 +70,7 @@ export type BaseSearchParams = { /** * Define the maximum radius for a geo search (in meters). */ - aroundRadius?: number | string | null; + aroundRadius?: number; /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. */ diff --git a/specs/search/common/schemas/IndexSettings.yml b/specs/search/common/schemas/IndexSettings.yml index 49dcf0bde5..b84df1f9f3 100644 --- a/specs/search/common/schemas/IndexSettings.yml +++ b/specs/search/common/schemas/IndexSettings.yml @@ -39,7 +39,7 @@ baseIndexSettings: type: object additionalProperties: true description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. - default: {} + default: null indexLanguages: type: array items: @@ -70,7 +70,7 @@ baseIndexSettings: type: object additionalProperties: true description: Lets you store custom data in your indices. - default: {} + default: null indexSettingsAsSearchParams: type: object @@ -300,4 +300,4 @@ indexSettingsAsSearchParams: renderingContent: type: object description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - default: {} + default: null diff --git a/specs/search/common/schemas/SearchParams.yml b/specs/search/common/schemas/SearchParams.yml index 4a0af449cf..3c5da1ed24 100644 --- a/specs/search/common/schemas/SearchParams.yml +++ b/specs/search/common/schemas/SearchParams.yml @@ -90,11 +90,7 @@ baseSearchParams: default: false aroundRadius: description: Define the maximum radius for a geo search (in meters). - oneOf: - - type: integer - minimum: 1 - - type: string - enum: [all] + type: integer aroundPrecision: type: integer description: Precision of geo search (in meters), to add grouping by geo location to the ranking formula. diff --git a/specs/search/paths/search/search.yml b/specs/search/paths/search/search.yml index ac73618d83..e8c31b1d78 100644 --- a/specs/search/paths/search/search.yml +++ b/specs/search/paths/search/search.yml @@ -10,9 +10,7 @@ post: content: application/json: schema: - oneOf: - - $ref: '../../common/schemas/SearchParams.yml#/searchParamsAsString' - - $ref: '../../common/schemas/SearchParams.yml#/searchParams' + $ref: '../../common/schemas/SearchParams.yml#/searchParams' responses: '200': description: OK From d67192e4bfa652a553c529c2c9a8362b1fd06fd1 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 3 Dec 2021 15:16:40 +0100 Subject: [PATCH 02/19] first draft of java client (a bit modified) --- .gitignore | 1 + .../algoliasearch-client-java-2/.gitignore | 21 + clients/algoliasearch-client-java-2/README.md | 189 ++ .../com/algolia/ApiCallback.java | 62 + .../com/algolia/ApiClient.java | 1311 ++++++++ .../com/algolia/ApiException.java | 90 + .../com/algolia/ApiResponse.java | 59 + .../com/algolia/Configuration.java | 38 + .../com/algolia/GzipRequestInterceptor.java | 85 + .../algoliasearch-core/com/algolia/JSON.java | 403 +++ .../algoliasearch-core/com/algolia/Pair.java | 60 + .../com/algolia/ProgressRequestBody.java | 73 + .../com/algolia/ProgressResponseBody.java | 70 + .../com/algolia/ServerConfiguration.java | 58 + .../com/algolia/ServerVariable.java | 23 + .../com/algolia/StringUtil.java | 82 + .../com/algolia/auth/ApiKeyAuth.java | 76 + .../com/algolia/auth/Authentication.java | 30 + .../com/algolia/model/BaseIndexSettings.java | 493 +++ .../com/algolia/model/BaseSearchParams.java | 1112 +++++++ .../com/algolia/model/BaseSearchResponse.java | 793 +++++ .../model/BaseSearchResponseFacetsStats.java | 185 ++ .../com/algolia/model/BatchObject.java | 110 + .../com/algolia/model/BatchResponse.java | 137 + .../algolia/model/DeleteIndexResponse.java | 128 + .../com/algolia/model/ErrorBase.java | 103 + .../com/algolia/model/HighlightResult.java | 244 ++ .../com/algolia/model/Index.java | 399 +++ .../com/algolia/model/IndexSettings.java | 2200 +++++++++++++ .../model/IndexSettingsAsSearchParams.java | 1775 +++++++++++ .../algolia/model/ListIndicesResponse.java | 138 + .../com/algolia/model/MultipleQueries.java | 261 ++ .../algolia/model/MultipleQueriesObject.java | 182 ++ .../model/MultipleQueriesResponse.java | 109 + .../com/algolia/model/Operation.java | 195 ++ .../algolia/model/OperationIndexObject.java | 262 ++ .../algolia/model/OperationIndexResponse.java | 128 + .../com/algolia/model/RankingInfo.java | 400 +++ .../model/RankingInfoMatchedGeoLocation.java | 156 + .../com/algolia/model/Record.java | 222 ++ .../com/algolia/model/SaveObjectResponse.java | 156 + .../com/algolia/model/SearchHits.java | 109 + .../com/algolia/model/SearchParams.java | 2818 +++++++++++++++++ .../com/algolia/model/SearchResponse.java | 831 +++++ .../algolia/model/SetSettingsResponse.java | 128 + .../com/algolia/model/SnippetResult.java | 176 + .../com/algolia/search/SearchApi.java | 1272 ++++++++ clients/algoliasearch-client-java-2/pom.xml | 224 ++ openapitools.json | 21 +- package.json | 1 + playground/java/pom.xml | 101 + .../java/src/main/java/com/algolia/App.java | 45 + templates/java/Configuration.mustache | 27 + .../java/CustomInstantDeserializer.mustache | 232 ++ templates/java/JSON.mustache | 539 ++++ templates/java/JavaTimeFormatter.mustache | 59 + templates/java/Pair.mustache | 49 + templates/java/ServerConfiguration.mustache | 58 + templates/java/ServerVariable.mustache | 23 + templates/java/StringUtil.mustache | 71 + .../additionalEnumTypeAnnotations.mustache | 2 + .../additionalModelTypeAnnotations.mustache | 2 + templates/java/api.mustache | 121 + templates/java/auth/ApiKeyAuth.mustache | 65 + templates/java/auth/Authentication.mustache | 19 + templates/java/enum_outer_doc.mustache | 7 + templates/java/gitignore.mustache | 21 + templates/java/jackson_annotations.mustache | 19 + .../okhttp-gson/ApiCallback.mustache | 51 + .../libraries/okhttp-gson/ApiClient.mustache | 1345 ++++++++ .../okhttp-gson/ApiResponse.mustache | 58 + .../GzipRequestInterceptor.mustache | 74 + .../okhttp-gson/ProgressRequestBody.mustache | 62 + .../okhttp-gson/ProgressResponseBody.mustache | 59 + .../libraries/okhttp-gson/README.mustache | 175 + .../java/libraries/okhttp-gson/api.mustache | 467 +++ .../okhttp-gson/apiException.mustache | 95 + .../java/libraries/okhttp-gson/pom.mustache | 249 ++ templates/java/licenseInfo.mustache | 11 + templates/java/manifest.mustache | 3 + templates/java/model.mustache | 55 + templates/java/modelEnum.mustache | 100 + templates/java/modelInnerEnum.mustache | 95 + templates/java/oneof_interface.mustache | 6 + templates/java/openapi.mustache | 1 + templates/java/pojo.mustache | 370 +++ templates/java/typeInfoAnnotation.mustache | 16 + templates/java/xmlAnnotation.mustache | 6 + 88 files changed, 22956 insertions(+), 1 deletion(-) create mode 100644 clients/algoliasearch-client-java-2/.gitignore create mode 100644 clients/algoliasearch-client-java-2/README.md create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java create mode 100644 clients/algoliasearch-client-java-2/pom.xml create mode 100644 playground/java/pom.xml create mode 100644 playground/java/src/main/java/com/algolia/App.java create mode 100644 templates/java/Configuration.mustache create mode 100644 templates/java/CustomInstantDeserializer.mustache create mode 100644 templates/java/JSON.mustache create mode 100644 templates/java/JavaTimeFormatter.mustache create mode 100644 templates/java/Pair.mustache create mode 100644 templates/java/ServerConfiguration.mustache create mode 100644 templates/java/ServerVariable.mustache create mode 100644 templates/java/StringUtil.mustache create mode 100644 templates/java/additionalEnumTypeAnnotations.mustache create mode 100644 templates/java/additionalModelTypeAnnotations.mustache create mode 100644 templates/java/api.mustache create mode 100644 templates/java/auth/ApiKeyAuth.mustache create mode 100644 templates/java/auth/Authentication.mustache create mode 100644 templates/java/enum_outer_doc.mustache create mode 100644 templates/java/gitignore.mustache create mode 100644 templates/java/jackson_annotations.mustache create mode 100644 templates/java/libraries/okhttp-gson/ApiCallback.mustache create mode 100644 templates/java/libraries/okhttp-gson/ApiClient.mustache create mode 100644 templates/java/libraries/okhttp-gson/ApiResponse.mustache create mode 100644 templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache create mode 100644 templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache create mode 100644 templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache create mode 100644 templates/java/libraries/okhttp-gson/README.mustache create mode 100644 templates/java/libraries/okhttp-gson/api.mustache create mode 100644 templates/java/libraries/okhttp-gson/apiException.mustache create mode 100644 templates/java/libraries/okhttp-gson/pom.mustache create mode 100644 templates/java/licenseInfo.mustache create mode 100644 templates/java/manifest.mustache create mode 100644 templates/java/model.mustache create mode 100644 templates/java/modelEnum.mustache create mode 100644 templates/java/modelInnerEnum.mustache create mode 100644 templates/java/oneof_interface.mustache create mode 100644 templates/java/openapi.mustache create mode 100644 templates/java/pojo.mustache create mode 100644 templates/java/typeInfoAnnotation.mustache create mode 100644 templates/java/xmlAnnotation.mustache diff --git a/.gitignore b/.gitignore index 2c3bf98dac..db0268e849 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ yarn-error.log **/dist .vscode +target diff --git a/clients/algoliasearch-client-java-2/.gitignore b/clients/algoliasearch-client-java-2/.gitignore new file mode 100644 index 0000000000..a530464afa --- /dev/null +++ b/clients/algoliasearch-client-java-2/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md new file mode 100644 index 0000000000..0ed7d5b650 --- /dev/null +++ b/clients/algoliasearch-client-java-2/README.md @@ -0,0 +1,189 @@ +# algoliasearch-client-java-2 + +Search API +- API version: 0.1.0 + - Build date: 2021-12-03T15:12:45.552525+01:00[Europe/Paris] + +API powering the Search feature of Algolia. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: +1. Java 1.7+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + com.algolia + algoliasearch-client-java-2 + 0.1.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "com.algolia:algoliasearch-client-java-2:0.1.0" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/algoliasearch-client-java-2-0.1.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import com.algolia.ApiClient; +import com.algolia.ApiException; +import com.algolia.Configuration; +import com.algolia.auth.*; +import com.algolia.models.*; +import com.algolia.search.SearchApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure API key authorization: apiKey + ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); + apiKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //apiKey.setApiKeyPrefix("Token"); + + // Configure API key authorization: appId + ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); + appId.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //appId.setApiKeyPrefix("Token"); + + SearchApi apiInstance = new SearchApi(defaultClient); + String indexName = "myIndexName"; // String | The index in which to perform the request. + BatchObject batchObject = new BatchObject(); // BatchObject | + try { + BatchResponse result = apiInstance.batch(indexName, batchObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SearchApi#batch"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*SearchApi* | [**batch**](docs/SearchApi.md#batch) | **POST** /1/indexes/{indexName}/batch | +*SearchApi* | [**deleteIndex**](docs/SearchApi.md#deleteIndex) | **DELETE** /1/indexes/{indexName} | Delete index. +*SearchApi* | [**getSettings**](docs/SearchApi.md#getSettings) | **GET** /1/indexes/{indexName}/settings | +*SearchApi* | [**listIndices**](docs/SearchApi.md#listIndices) | **GET** /1/indexes | List existing indexes. +*SearchApi* | [**multipleQueries**](docs/SearchApi.md#multipleQueries) | **POST** /1/indexes/*/queries | +*SearchApi* | [**operationIndex**](docs/SearchApi.md#operationIndex) | **POST** /1/indexes/{indexName}/operation | Copy/move index. +*SearchApi* | [**saveObject**](docs/SearchApi.md#saveObject) | **POST** /1/indexes/{indexName} | +*SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /1/indexes/{indexName}/query | +*SearchApi* | [**setSettings**](docs/SearchApi.md#setSettings) | **PUT** /1/indexes/{indexName}/settings | + + +## Documentation for Models + + - [BaseIndexSettings](docs/BaseIndexSettings.md) + - [BaseSearchParams](docs/BaseSearchParams.md) + - [BaseSearchResponse](docs/BaseSearchResponse.md) + - [BaseSearchResponseFacetsStats](docs/BaseSearchResponseFacetsStats.md) + - [BatchObject](docs/BatchObject.md) + - [BatchResponse](docs/BatchResponse.md) + - [DeleteIndexResponse](docs/DeleteIndexResponse.md) + - [ErrorBase](docs/ErrorBase.md) + - [HighlightResult](docs/HighlightResult.md) + - [Index](docs/Index.md) + - [IndexSettings](docs/IndexSettings.md) + - [IndexSettingsAsSearchParams](docs/IndexSettingsAsSearchParams.md) + - [ListIndicesResponse](docs/ListIndicesResponse.md) + - [MultipleQueries](docs/MultipleQueries.md) + - [MultipleQueriesObject](docs/MultipleQueriesObject.md) + - [MultipleQueriesResponse](docs/MultipleQueriesResponse.md) + - [Operation](docs/Operation.md) + - [OperationIndexObject](docs/OperationIndexObject.md) + - [OperationIndexResponse](docs/OperationIndexResponse.md) + - [RankingInfo](docs/RankingInfo.md) + - [RankingInfoMatchedGeoLocation](docs/RankingInfoMatchedGeoLocation.md) + - [Record](docs/Record.md) + - [SaveObjectResponse](docs/SaveObjectResponse.md) + - [SearchHits](docs/SearchHits.md) + - [SearchParams](docs/SearchParams.md) + - [SearchResponse](docs/SearchResponse.md) + - [SetSettingsResponse](docs/SetSettingsResponse.md) + - [SnippetResult](docs/SnippetResult.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### apiKey + +- **Type**: API key +- **API key parameter name**: X-Algolia-API-Key +- **Location**: HTTP header + +### appId + +- **Type**: API key +- **API key parameter name**: X-Algolia-Application-Id +- **Location**: HTTP header + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java new file mode 100644 index 0000000000..cd5a695708 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java new file mode 100644 index 0000000000..451be001fa --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -0,0 +1,1311 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.algolia.auth.Authentication; +import com.algolia.auth.ApiKeyAuth; + +public class ApiClient { + + private String basePath = "http://localhost"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("apiKey", new ApiKeyAuth("header", "X-Algolia-API-Key")); + authentications.put("appId", new ApiKeyAuth("header", "X-Algolia-Application-Id")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Basic constructor with custom OkHttpClient + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("apiKey", new ApiKeyAuth("header", "X-Algolia-API-Key")); + authentications.put("appId", new ApiKeyAuth("header", "X-Algolia-Application-Id")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.1.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java new file mode 100644 index 0000000000..a91ca3c379 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -0,0 +1,90 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.util.Map; +import java.util.List; + +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java new file mode 100644 index 0000000000..d584798448 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java @@ -0,0 +1,59 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java new file mode 100644 index 0000000000..6ccb969cd5 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java @@ -0,0 +1,38 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java new file mode 100644 index 0000000000..068722b623 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java @@ -0,0 +1,85 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java new file mode 100644 index 0000000000..e163f78b46 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java @@ -0,0 +1,403 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import com.algolia.model.*; +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +public class JSON { + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + public JSON() { + gson = createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java new file mode 100644 index 0000000000..efdb7750f7 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java @@ -0,0 +1,60 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java new file mode 100644 index 0000000000..6f1a3259dc --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java new file mode 100644 index 0000000000..42ecddfdf0 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java new file mode 100644 index 0000000000..d0efe8e078 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java @@ -0,0 +1,58 @@ +package com.algolia; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java new file mode 100644 index 0000000000..42b70a4fae --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java @@ -0,0 +1,23 @@ +package com.algolia; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java new file mode 100644 index 0000000000..bcd3c61b02 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java @@ -0,0 +1,82 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.util.Collection; +import java.util.Iterator; + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java new file mode 100644 index 0000000000..e7a8b970e0 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java @@ -0,0 +1,76 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; + +import com.algolia.Pair; + +import java.util.Map; +import java.util.List; + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java new file mode 100644 index 0000000000..264c9d42e0 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java @@ -0,0 +1,30 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; + +import com.algolia.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java new file mode 100644 index 0000000000..16450911db --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -0,0 +1,493 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * BaseIndexSettings + */ + +public class BaseIndexSettings { + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) + private List replicas = null; + + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) + private Integer paginationLimitedTo = 1000; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) + private List disableTypoToleranceOnWords = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) + private List attributesToTransliterate = null; + + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) + private List camelCaseAttributes = null; + + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) + private Map decompoundedAttributes = null; + + public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) + private List indexLanguages = null; + + public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) + private Boolean filterPromotes = false; + + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) + private List disablePrefixOnAttributes = null; + + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + private Boolean allowCompressionOfIntegerArray = false; + + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) + private List numericAttributesForFiltering = null; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) + private Map userData = null; + + + public BaseIndexSettings replicas(List replicas) { + + this.replicas = replicas; + return this; + } + + public BaseIndexSettings addReplicasItem(String replicasItem) { + if (this.replicas == null) { + this.replicas = new ArrayList(); + } + this.replicas.add(replicasItem); + return this; + } + + /** + * Creates replicas, exact copies of an index. + * @return replicas + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Creates replicas, exact copies of an index.") + + public List getReplicas() { + return replicas; + } + + + public void setReplicas(List replicas) { + this.replicas = replicas; + } + + + public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { + + this.paginationLimitedTo = paginationLimitedTo; + return this; + } + + /** + * Set the maximum number of hits accessible via pagination. + * @return paginationLimitedTo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the maximum number of hits accessible via pagination.") + + public Integer getPaginationLimitedTo() { + return paginationLimitedTo; + } + + + public void setPaginationLimitedTo(Integer paginationLimitedTo) { + this.paginationLimitedTo = paginationLimitedTo; + } + + + public BaseIndexSettings disableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + + this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; + return this; + } + + public BaseIndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { + if (this.disableTypoToleranceOnWords == null) { + this.disableTypoToleranceOnWords = new ArrayList(); + } + this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); + return this; + } + + /** + * A list of words for which you want to turn off typo tolerance. + * @return disableTypoToleranceOnWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of words for which you want to turn off typo tolerance.") + + public List getDisableTypoToleranceOnWords() { + return disableTypoToleranceOnWords; + } + + + public void setDisableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; + } + + + public BaseIndexSettings attributesToTransliterate(List attributesToTransliterate) { + + this.attributesToTransliterate = attributesToTransliterate; + return this; + } + + public BaseIndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { + if (this.attributesToTransliterate == null) { + this.attributesToTransliterate = new ArrayList(); + } + this.attributesToTransliterate.add(attributesToTransliterateItem); + return this; + } + + /** + * Specify on which attributes to apply transliteration. + * @return attributesToTransliterate + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify on which attributes to apply transliteration.") + + public List getAttributesToTransliterate() { + return attributesToTransliterate; + } + + + public void setAttributesToTransliterate(List attributesToTransliterate) { + this.attributesToTransliterate = attributesToTransliterate; + } + + + public BaseIndexSettings camelCaseAttributes(List camelCaseAttributes) { + + this.camelCaseAttributes = camelCaseAttributes; + return this; + } + + public BaseIndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { + if (this.camelCaseAttributes == null) { + this.camelCaseAttributes = new ArrayList(); + } + this.camelCaseAttributes.add(camelCaseAttributesItem); + return this; + } + + /** + * List of attributes on which to do a decomposition of camel case words. + * @return camelCaseAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which to do a decomposition of camel case words.") + + public List getCamelCaseAttributes() { + return camelCaseAttributes; + } + + + public void setCamelCaseAttributes(List camelCaseAttributes) { + this.camelCaseAttributes = camelCaseAttributes; + } + + + public BaseIndexSettings decompoundedAttributes(Map decompoundedAttributes) { + + this.decompoundedAttributes = decompoundedAttributes; + return this; + } + + public BaseIndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { + if (this.decompoundedAttributes == null) { + this.decompoundedAttributes = new HashMap(); + } + this.decompoundedAttributes.put(key, decompoundedAttributesItem); + return this; + } + + /** + * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. + * @return decompoundedAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.") + + public Map getDecompoundedAttributes() { + return decompoundedAttributes; + } + + + public void setDecompoundedAttributes(Map decompoundedAttributes) { + this.decompoundedAttributes = decompoundedAttributes; + } + + + public BaseIndexSettings indexLanguages(List indexLanguages) { + + this.indexLanguages = indexLanguages; + return this; + } + + public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { + if (this.indexLanguages == null) { + this.indexLanguages = new ArrayList(); + } + this.indexLanguages.add(indexLanguagesItem); + return this; + } + + /** + * Sets the languages at the index level for language-specific processing such as tokenization and normalization. + * @return indexLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization.") + + public List getIndexLanguages() { + return indexLanguages; + } + + + public void setIndexLanguages(List indexLanguages) { + this.indexLanguages = indexLanguages; + } + + + public BaseIndexSettings filterPromotes(Boolean filterPromotes) { + + this.filterPromotes = filterPromotes; + return this; + } + + /** + * Whether promoted results should match the filters of the current search, except for geographic filters. + * @return filterPromotes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether promoted results should match the filters of the current search, except for geographic filters.") + + public Boolean getFilterPromotes() { + return filterPromotes; + } + + + public void setFilterPromotes(Boolean filterPromotes) { + this.filterPromotes = filterPromotes; + } + + + public BaseIndexSettings disablePrefixOnAttributes(List disablePrefixOnAttributes) { + + this.disablePrefixOnAttributes = disablePrefixOnAttributes; + return this; + } + + public BaseIndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { + if (this.disablePrefixOnAttributes == null) { + this.disablePrefixOnAttributes = new ArrayList(); + } + this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable prefix matching. + * @return disablePrefixOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable prefix matching.") + + public List getDisablePrefixOnAttributes() { + return disablePrefixOnAttributes; + } + + + public void setDisablePrefixOnAttributes(List disablePrefixOnAttributes) { + this.disablePrefixOnAttributes = disablePrefixOnAttributes; + } + + + public BaseIndexSettings allowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + + this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + return this; + } + + /** + * Enables compression of large integer arrays. + * @return allowCompressionOfIntegerArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables compression of large integer arrays.") + + public Boolean getAllowCompressionOfIntegerArray() { + return allowCompressionOfIntegerArray; + } + + + public void setAllowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + } + + + public BaseIndexSettings numericAttributesForFiltering(List numericAttributesForFiltering) { + + this.numericAttributesForFiltering = numericAttributesForFiltering; + return this; + } + + public BaseIndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { + if (this.numericAttributesForFiltering == null) { + this.numericAttributesForFiltering = new ArrayList(); + } + this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); + return this; + } + + /** + * List of numeric attributes that can be used as numerical filters. + * @return numericAttributesForFiltering + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of numeric attributes that can be used as numerical filters.") + + public List getNumericAttributesForFiltering() { + return numericAttributesForFiltering; + } + + + public void setNumericAttributesForFiltering(List numericAttributesForFiltering) { + this.numericAttributesForFiltering = numericAttributesForFiltering; + } + + + public BaseIndexSettings userData(Map userData) { + + this.userData = userData; + return this; + } + + public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { + if (this.userData == null) { + this.userData = new HashMap(); + } + this.userData.put(key, userDataItem); + return this; + } + + /** + * Lets you store custom data in your indices. + * @return userData + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Lets you store custom data in your indices.") + + public Map getUserData() { + return userData; + } + + + public void setUserData(Map userData) { + this.userData = userData; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseIndexSettings baseIndexSettings = (BaseIndexSettings) o; + return Objects.equals(this.replicas, baseIndexSettings.replicas) && + Objects.equals(this.paginationLimitedTo, baseIndexSettings.paginationLimitedTo) && + Objects.equals(this.disableTypoToleranceOnWords, baseIndexSettings.disableTypoToleranceOnWords) && + Objects.equals(this.attributesToTransliterate, baseIndexSettings.attributesToTransliterate) && + Objects.equals(this.camelCaseAttributes, baseIndexSettings.camelCaseAttributes) && + Objects.equals(this.decompoundedAttributes, baseIndexSettings.decompoundedAttributes) && + Objects.equals(this.indexLanguages, baseIndexSettings.indexLanguages) && + Objects.equals(this.filterPromotes, baseIndexSettings.filterPromotes) && + Objects.equals(this.disablePrefixOnAttributes, baseIndexSettings.disablePrefixOnAttributes) && + Objects.equals(this.allowCompressionOfIntegerArray, baseIndexSettings.allowCompressionOfIntegerArray) && + Objects.equals(this.numericAttributesForFiltering, baseIndexSettings.numericAttributesForFiltering) && + Objects.equals(this.userData, baseIndexSettings.userData); + } + + @Override + public int hashCode() { + return Objects.hash(replicas, paginationLimitedTo, disableTypoToleranceOnWords, attributesToTransliterate, camelCaseAttributes, decompoundedAttributes, indexLanguages, filterPromotes, disablePrefixOnAttributes, allowCompressionOfIntegerArray, numericAttributesForFiltering, userData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseIndexSettings {\n"); + sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); + sb.append(" paginationLimitedTo: ").append(toIndentedString(paginationLimitedTo)).append("\n"); + sb.append(" disableTypoToleranceOnWords: ").append(toIndentedString(disableTypoToleranceOnWords)).append("\n"); + sb.append(" attributesToTransliterate: ").append(toIndentedString(attributesToTransliterate)).append("\n"); + sb.append(" camelCaseAttributes: ").append(toIndentedString(camelCaseAttributes)).append("\n"); + sb.append(" decompoundedAttributes: ").append(toIndentedString(decompoundedAttributes)).append("\n"); + sb.append(" indexLanguages: ").append(toIndentedString(indexLanguages)).append("\n"); + sb.append(" filterPromotes: ").append(toIndentedString(filterPromotes)).append("\n"); + sb.append(" disablePrefixOnAttributes: ").append(toIndentedString(disablePrefixOnAttributes)).append("\n"); + sb.append(" allowCompressionOfIntegerArray: ").append(toIndentedString(allowCompressionOfIntegerArray)).append("\n"); + sb.append(" numericAttributesForFiltering: ").append(toIndentedString(numericAttributesForFiltering)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).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-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java new file mode 100644 index 0000000000..0352cfc868 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -0,0 +1,1112 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * BaseSearchParams + */ + +public class BaseSearchParams { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) + private String similarQuery = ""; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + private String filters = ""; + + public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) + private List facetFilters = null; + + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = "optionalFilters"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) + private List optionalFilters = null; + + public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) + private List numericFilters = null; + + public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) + private List tagFilters = null; + + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) + private Boolean sumOrFiltersScores = false; + + public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) + private List facets = null; + + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) + private Integer maxValuesPerFacet = 100; + + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) + private Boolean facetingAfterDistinct = false; + + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) + private String sortFacetValuesBy = "count"; + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + private Integer page = 0; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + private Integer offset; + + public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) + private Integer length; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + private String aroundLatLng = ""; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) + private Boolean aroundLatLngViaIP = false; + + public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) + private Integer aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = "aroundPrecision"; + @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) + private Integer aroundPrecision = 10; + + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) + private Integer minimumAroundRadius; + + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) + private List insideBoundingBox = null; + + public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) + private List insidePolygon = null; + + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) + private List naturalLanguages = null; + + public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) + private List ruleContexts = null; + + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) + private Integer personalizationImpact = 100; + + public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + @SerializedName(SERIALIZED_NAME_USER_TOKEN) + private String userToken; + + public static final String SERIALIZED_NAME_GET_RANKING_INFO = "getRankingInfo"; + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) + private Boolean getRankingInfo = false; + + public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) + private Boolean clickAnalytics = false; + + public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + @SerializedName(SERIALIZED_NAME_ANALYTICS) + private Boolean analytics = true; + + public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) + private List analyticsTags = null; + + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) + private Boolean percentileComputation = true; + + public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) + private Boolean enableABTest = true; + + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) + private Boolean enableReRanking = true; + + + public BaseSearchParams query(String query) { + + this.query = query; + return this; + } + + /** + * The text to search in the index. + * @return query + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The text to search in the index.") + + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public BaseSearchParams similarQuery(String similarQuery) { + + this.similarQuery = similarQuery; + return this; + } + + /** + * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. + * @return similarQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.") + + public String getSimilarQuery() { + return similarQuery; + } + + + public void setSimilarQuery(String similarQuery) { + this.similarQuery = similarQuery; + } + + + public BaseSearchParams filters(String filters) { + + this.filters = filters; + return this; + } + + /** + * Filter the query with numeric, facet and/or tag filters. + * @return filters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter the query with numeric, facet and/or tag filters.") + + public String getFilters() { + return filters; + } + + + public void setFilters(String filters) { + this.filters = filters; + } + + + public BaseSearchParams facetFilters(List facetFilters) { + + this.facetFilters = facetFilters; + return this; + } + + public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { + if (this.facetFilters == null) { + this.facetFilters = new ArrayList(); + } + this.facetFilters.add(facetFiltersItem); + return this; + } + + /** + * Filter hits by facet value. + * @return facetFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter hits by facet value.") + + public List getFacetFilters() { + return facetFilters; + } + + + public void setFacetFilters(List facetFilters) { + this.facetFilters = facetFilters; + } + + + public BaseSearchParams optionalFilters(List optionalFilters) { + + this.optionalFilters = optionalFilters; + return this; + } + + public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { + if (this.optionalFilters == null) { + this.optionalFilters = new ArrayList(); + } + this.optionalFilters.add(optionalFiltersItem); + return this; + } + + /** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + * @return optionalFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.") + + public List getOptionalFilters() { + return optionalFilters; + } + + + public void setOptionalFilters(List optionalFilters) { + this.optionalFilters = optionalFilters; + } + + + public BaseSearchParams numericFilters(List numericFilters) { + + this.numericFilters = numericFilters; + return this; + } + + public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { + if (this.numericFilters == null) { + this.numericFilters = new ArrayList(); + } + this.numericFilters.add(numericFiltersItem); + return this; + } + + /** + * Filter on numeric attributes. + * @return numericFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter on numeric attributes.") + + public List getNumericFilters() { + return numericFilters; + } + + + public void setNumericFilters(List numericFilters) { + this.numericFilters = numericFilters; + } + + + public BaseSearchParams tagFilters(List tagFilters) { + + this.tagFilters = tagFilters; + return this; + } + + public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Filter hits by tags. + * @return tagFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter hits by tags.") + + public List getTagFilters() { + return tagFilters; + } + + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + + public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { + + this.sumOrFiltersScores = sumOrFiltersScores; + return this; + } + + /** + * Determines how to calculate the total score for filtering. + * @return sumOrFiltersScores + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Determines how to calculate the total score for filtering.") + + public Boolean getSumOrFiltersScores() { + return sumOrFiltersScores; + } + + + public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { + this.sumOrFiltersScores = sumOrFiltersScores; + } + + + public BaseSearchParams facets(List facets) { + + this.facets = facets; + return this; + } + + public BaseSearchParams addFacetsItem(String facetsItem) { + if (this.facets == null) { + this.facets = new ArrayList(); + } + this.facets.add(facetsItem); + return this; + } + + /** + * Retrieve facets and their facet values. + * @return facets + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Retrieve facets and their facet values.") + + public List getFacets() { + return facets; + } + + + public void setFacets(List facets) { + this.facets = facets; + } + + + public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { + + this.maxValuesPerFacet = maxValuesPerFacet; + return this; + } + + /** + * Maximum number of facet values to return for each facet during a regular search. + * @return maxValuesPerFacet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Maximum number of facet values to return for each facet during a regular search.") + + public Integer getMaxValuesPerFacet() { + return maxValuesPerFacet; + } + + + public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { + this.maxValuesPerFacet = maxValuesPerFacet; + } + + + public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { + + this.facetingAfterDistinct = facetingAfterDistinct; + return this; + } + + /** + * Force faceting to be applied after de-duplication (via the Distinct setting). + * @return facetingAfterDistinct + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Force faceting to be applied after de-duplication (via the Distinct setting).") + + public Boolean getFacetingAfterDistinct() { + return facetingAfterDistinct; + } + + + public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { + this.facetingAfterDistinct = facetingAfterDistinct; + } + + + public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { + + this.sortFacetValuesBy = sortFacetValuesBy; + return this; + } + + /** + * Controls how facet values are fetched. + * @return sortFacetValuesBy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how facet values are fetched.") + + public String getSortFacetValuesBy() { + return sortFacetValuesBy; + } + + + public void setSortFacetValuesBy(String sortFacetValuesBy) { + this.sortFacetValuesBy = sortFacetValuesBy; + } + + + public BaseSearchParams page(Integer page) { + + this.page = page; + return this; + } + + /** + * Specify the page to retrieve. + * @return page + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify the page to retrieve.") + + public Integer getPage() { + return page; + } + + + public void setPage(Integer page) { + this.page = page; + } + + + public BaseSearchParams offset(Integer offset) { + + this.offset = offset; + return this; + } + + /** + * Specify the offset of the first hit to return. + * @return offset + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify the offset of the first hit to return.") + + public Integer getOffset() { + return offset; + } + + + public void setOffset(Integer offset) { + this.offset = offset; + } + + + public BaseSearchParams length(Integer length) { + + this.length = length; + return this; + } + + /** + * Set the number of hits to retrieve (used only with offset). + * minimum: 1 + * maximum: 1000 + * @return length + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the number of hits to retrieve (used only with offset).") + + public Integer getLength() { + return length; + } + + + public void setLength(Integer length) { + this.length = length; + } + + + public BaseSearchParams aroundLatLng(String aroundLatLng) { + + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * Search for entries around a central geolocation, enabling a geo search within a circular area. + * @return aroundLatLng + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search for entries around a central geolocation, enabling a geo search within a circular area.") + + public String getAroundLatLng() { + return aroundLatLng; + } + + + public void setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + } + + + public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { + + this.aroundLatLngViaIP = aroundLatLngViaIP; + return this; + } + + /** + * Search for entries around a given location automatically computed from the requester’s IP address. + * @return aroundLatLngViaIP + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search for entries around a given location automatically computed from the requester’s IP address.") + + public Boolean getAroundLatLngViaIP() { + return aroundLatLngViaIP; + } + + + public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { + this.aroundLatLngViaIP = aroundLatLngViaIP; + } + + + public BaseSearchParams aroundRadius(Integer aroundRadius) { + + this.aroundRadius = aroundRadius; + return this; + } + + /** + * Define the maximum radius for a geo search (in meters). + * @return aroundRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Define the maximum radius for a geo search (in meters).") + + public Integer getAroundRadius() { + return aroundRadius; + } + + + public void setAroundRadius(Integer aroundRadius) { + this.aroundRadius = aroundRadius; + } + + + public BaseSearchParams aroundPrecision(Integer aroundPrecision) { + + this.aroundPrecision = aroundPrecision; + return this; + } + + /** + * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. + * @return aroundPrecision + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula.") + + public Integer getAroundPrecision() { + return aroundPrecision; + } + + + public void setAroundPrecision(Integer aroundPrecision) { + this.aroundPrecision = aroundPrecision; + } + + + public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { + + this.minimumAroundRadius = minimumAroundRadius; + return this; + } + + /** + * Minimum radius (in meters) used for a geo search when aroundRadius is not set. + * minimum: 1 + * @return minimumAroundRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set.") + + public Integer getMinimumAroundRadius() { + return minimumAroundRadius; + } + + + public void setMinimumAroundRadius(Integer minimumAroundRadius) { + this.minimumAroundRadius = minimumAroundRadius; + } + + + public BaseSearchParams insideBoundingBox(List insideBoundingBox) { + + this.insideBoundingBox = insideBoundingBox; + return this; + } + + public BaseSearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { + if (this.insideBoundingBox == null) { + this.insideBoundingBox = new ArrayList(); + } + this.insideBoundingBox.add(insideBoundingBoxItem); + return this; + } + + /** + * Search inside a rectangular area (in geo coordinates). + * @return insideBoundingBox + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search inside a rectangular area (in geo coordinates).") + + public List getInsideBoundingBox() { + return insideBoundingBox; + } + + + public void setInsideBoundingBox(List insideBoundingBox) { + this.insideBoundingBox = insideBoundingBox; + } + + + public BaseSearchParams insidePolygon(List insidePolygon) { + + this.insidePolygon = insidePolygon; + return this; + } + + public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { + if (this.insidePolygon == null) { + this.insidePolygon = new ArrayList(); + } + this.insidePolygon.add(insidePolygonItem); + return this; + } + + /** + * Search inside a polygon (in geo coordinates). + * @return insidePolygon + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") + + public List getInsidePolygon() { + return insidePolygon; + } + + + public void setInsidePolygon(List insidePolygon) { + this.insidePolygon = insidePolygon; + } + + + public BaseSearchParams naturalLanguages(List naturalLanguages) { + + this.naturalLanguages = naturalLanguages; + return this; + } + + public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { + if (this.naturalLanguages == null) { + this.naturalLanguages = new ArrayList(); + } + this.naturalLanguages.add(naturalLanguagesItem); + return this; + } + + /** + * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * @return naturalLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.") + + public List getNaturalLanguages() { + return naturalLanguages; + } + + + public void setNaturalLanguages(List naturalLanguages) { + this.naturalLanguages = naturalLanguages; + } + + + public BaseSearchParams ruleContexts(List ruleContexts) { + + this.ruleContexts = ruleContexts; + return this; + } + + public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { + if (this.ruleContexts == null) { + this.ruleContexts = new ArrayList(); + } + this.ruleContexts.add(ruleContextsItem); + return this; + } + + /** + * Enables contextual rules. + * @return ruleContexts + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables contextual rules.") + + public List getRuleContexts() { + return ruleContexts; + } + + + public void setRuleContexts(List ruleContexts) { + this.ruleContexts = ruleContexts; + } + + + public BaseSearchParams personalizationImpact(Integer personalizationImpact) { + + this.personalizationImpact = personalizationImpact; + return this; + } + + /** + * Define the impact of the Personalization feature. + * @return personalizationImpact + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Define the impact of the Personalization feature.") + + public Integer getPersonalizationImpact() { + return personalizationImpact; + } + + + public void setPersonalizationImpact(Integer personalizationImpact) { + this.personalizationImpact = personalizationImpact; + } + + + public BaseSearchParams userToken(String userToken) { + + this.userToken = userToken; + return this; + } + + /** + * Associates a certain user token with the current search. + * @return userToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Associates a certain user token with the current search.") + + public String getUserToken() { + return userToken; + } + + + public void setUserToken(String userToken) { + this.userToken = userToken; + } + + + public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { + + this.getRankingInfo = getRankingInfo; + return this; + } + + /** + * Retrieve detailed ranking information. + * @return getRankingInfo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Retrieve detailed ranking information.") + + public Boolean getGetRankingInfo() { + return getRankingInfo; + } + + + public void setGetRankingInfo(Boolean getRankingInfo) { + this.getRankingInfo = getRankingInfo; + } + + + public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { + + this.clickAnalytics = clickAnalytics; + return this; + } + + /** + * Enable the Click Analytics feature. + * @return clickAnalytics + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enable the Click Analytics feature.") + + public Boolean getClickAnalytics() { + return clickAnalytics; + } + + + public void setClickAnalytics(Boolean clickAnalytics) { + this.clickAnalytics = clickAnalytics; + } + + + public BaseSearchParams analytics(Boolean analytics) { + + this.analytics = analytics; + return this; + } + + /** + * Whether the current query will be taken into account in the Analytics. + * @return analytics + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the current query will be taken into account in the Analytics.") + + public Boolean getAnalytics() { + return analytics; + } + + + public void setAnalytics(Boolean analytics) { + this.analytics = analytics; + } + + + public BaseSearchParams analyticsTags(List analyticsTags) { + + this.analyticsTags = analyticsTags; + return this; + } + + public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { + if (this.analyticsTags == null) { + this.analyticsTags = new ArrayList(); + } + this.analyticsTags.add(analyticsTagsItem); + return this; + } + + /** + * List of tags to apply to the query for analytics purposes. + * @return analyticsTags + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of tags to apply to the query for analytics purposes.") + + public List getAnalyticsTags() { + return analyticsTags; + } + + + public void setAnalyticsTags(List analyticsTags) { + this.analyticsTags = analyticsTags; + } + + + public BaseSearchParams percentileComputation(Boolean percentileComputation) { + + this.percentileComputation = percentileComputation; + return this; + } + + /** + * Whether to include or exclude a query from the processing-time percentile computation. + * @return percentileComputation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to include or exclude a query from the processing-time percentile computation.") + + public Boolean getPercentileComputation() { + return percentileComputation; + } + + + public void setPercentileComputation(Boolean percentileComputation) { + this.percentileComputation = percentileComputation; + } + + + public BaseSearchParams enableABTest(Boolean enableABTest) { + + this.enableABTest = enableABTest; + return this; + } + + /** + * Whether this search should participate in running AB tests. + * @return enableABTest + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether this search should participate in running AB tests.") + + public Boolean getEnableABTest() { + return enableABTest; + } + + + public void setEnableABTest(Boolean enableABTest) { + this.enableABTest = enableABTest; + } + + + public BaseSearchParams enableReRanking(Boolean enableReRanking) { + + this.enableReRanking = enableReRanking; + return this; + } + + /** + * Whether this search should use AI Re-Ranking. + * @return enableReRanking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") + + public Boolean getEnableReRanking() { + return enableReRanking; + } + + + public void setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseSearchParams baseSearchParams = (BaseSearchParams) o; + return Objects.equals(this.query, baseSearchParams.query) && + Objects.equals(this.similarQuery, baseSearchParams.similarQuery) && + Objects.equals(this.filters, baseSearchParams.filters) && + Objects.equals(this.facetFilters, baseSearchParams.facetFilters) && + Objects.equals(this.optionalFilters, baseSearchParams.optionalFilters) && + Objects.equals(this.numericFilters, baseSearchParams.numericFilters) && + Objects.equals(this.tagFilters, baseSearchParams.tagFilters) && + Objects.equals(this.sumOrFiltersScores, baseSearchParams.sumOrFiltersScores) && + Objects.equals(this.facets, baseSearchParams.facets) && + Objects.equals(this.maxValuesPerFacet, baseSearchParams.maxValuesPerFacet) && + Objects.equals(this.facetingAfterDistinct, baseSearchParams.facetingAfterDistinct) && + Objects.equals(this.sortFacetValuesBy, baseSearchParams.sortFacetValuesBy) && + Objects.equals(this.page, baseSearchParams.page) && + Objects.equals(this.offset, baseSearchParams.offset) && + Objects.equals(this.length, baseSearchParams.length) && + Objects.equals(this.aroundLatLng, baseSearchParams.aroundLatLng) && + Objects.equals(this.aroundLatLngViaIP, baseSearchParams.aroundLatLngViaIP) && + Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && + Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && + Objects.equals(this.minimumAroundRadius, baseSearchParams.minimumAroundRadius) && + Objects.equals(this.insideBoundingBox, baseSearchParams.insideBoundingBox) && + Objects.equals(this.insidePolygon, baseSearchParams.insidePolygon) && + Objects.equals(this.naturalLanguages, baseSearchParams.naturalLanguages) && + Objects.equals(this.ruleContexts, baseSearchParams.ruleContexts) && + Objects.equals(this.personalizationImpact, baseSearchParams.personalizationImpact) && + Objects.equals(this.userToken, baseSearchParams.userToken) && + Objects.equals(this.getRankingInfo, baseSearchParams.getRankingInfo) && + Objects.equals(this.clickAnalytics, baseSearchParams.clickAnalytics) && + Objects.equals(this.analytics, baseSearchParams.analytics) && + Objects.equals(this.analyticsTags, baseSearchParams.analyticsTags) && + Objects.equals(this.percentileComputation, baseSearchParams.percentileComputation) && + Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && + Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking); + } + + @Override + public int hashCode() { + return Objects.hash(query, similarQuery, filters, facetFilters, optionalFilters, numericFilters, tagFilters, sumOrFiltersScores, facets, maxValuesPerFacet, facetingAfterDistinct, sortFacetValuesBy, page, offset, length, aroundLatLng, aroundLatLngViaIP, aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, insidePolygon, naturalLanguages, ruleContexts, personalizationImpact, userToken, getRankingInfo, clickAnalytics, analytics, analyticsTags, percentileComputation, enableABTest, enableReRanking); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSearchParams {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" similarQuery: ").append(toIndentedString(similarQuery)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" facetFilters: ").append(toIndentedString(facetFilters)).append("\n"); + sb.append(" optionalFilters: ").append(toIndentedString(optionalFilters)).append("\n"); + sb.append(" numericFilters: ").append(toIndentedString(numericFilters)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" sumOrFiltersScores: ").append(toIndentedString(sumOrFiltersScores)).append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); + sb.append(" facetingAfterDistinct: ").append(toIndentedString(facetingAfterDistinct)).append("\n"); + sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" aroundLatLngViaIP: ").append(toIndentedString(aroundLatLngViaIP)).append("\n"); + sb.append(" aroundRadius: ").append(toIndentedString(aroundRadius)).append("\n"); + sb.append(" aroundPrecision: ").append(toIndentedString(aroundPrecision)).append("\n"); + sb.append(" minimumAroundRadius: ").append(toIndentedString(minimumAroundRadius)).append("\n"); + sb.append(" insideBoundingBox: ").append(toIndentedString(insideBoundingBox)).append("\n"); + sb.append(" insidePolygon: ").append(toIndentedString(insidePolygon)).append("\n"); + sb.append(" naturalLanguages: ").append(toIndentedString(naturalLanguages)).append("\n"); + sb.append(" ruleContexts: ").append(toIndentedString(ruleContexts)).append("\n"); + sb.append(" personalizationImpact: ").append(toIndentedString(personalizationImpact)).append("\n"); + sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n"); + sb.append(" getRankingInfo: ").append(toIndentedString(getRankingInfo)).append("\n"); + sb.append(" clickAnalytics: ").append(toIndentedString(clickAnalytics)).append("\n"); + sb.append(" analytics: ").append(toIndentedString(analytics)).append("\n"); + sb.append(" analyticsTags: ").append(toIndentedString(analyticsTags)).append("\n"); + sb.append(" percentileComputation: ").append(toIndentedString(percentileComputation)).append("\n"); + sb.append(" enableABTest: ").append(toIndentedString(enableABTest)).append("\n"); + sb.append(" enableReRanking: ").append(toIndentedString(enableReRanking)).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-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java new file mode 100644 index 0000000000..8d3f7a17d8 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -0,0 +1,793 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.BaseSearchResponseFacetsStats; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * BaseSearchResponse + */ + +public class BaseSearchResponse { + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) + private Integer abTestID; + + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) + private Integer abTestVariantID; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + private String aroundLatLng; + + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = "automaticRadius"; + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) + private String automaticRadius; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) + private Boolean exhaustiveFacetsCount; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) + private Boolean exhaustiveNbHits; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) + private Boolean exhaustiveTypo; + + public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) + private Map> facets = null; + + public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + @SerializedName(SERIALIZED_NAME_FACETS_STATS) + private Map facetsStats = null; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) + private String index; + + public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + @SerializedName(SERIALIZED_NAME_INDEX_USED) + private String indexUsed; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + @SerializedName(SERIALIZED_NAME_NB_HITS) + private Integer nbHits; + + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) + private Integer nbPages; + + public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) + private Integer nbSortedHits; + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + private Integer page = 0; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) + private String params; + + public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) + private String parsedQuery; + + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) + private Integer processingTimeMS; + + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) + private String queryAfterRemoval; + + public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + @SerializedName(SERIALIZED_NAME_SERVER_USED) + private String serverUsed; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) + private Map userData = null; + + + public BaseSearchResponse abTestID(Integer abTestID) { + + this.abTestID = abTestID; + return this; + } + + /** + * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. + * @return abTestID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.") + + public Integer getAbTestID() { + return abTestID; + } + + + public void setAbTestID(Integer abTestID) { + this.abTestID = abTestID; + } + + + public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { + + this.abTestVariantID = abTestVariantID; + return this; + } + + /** + * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. + * @return abTestVariantID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.") + + public Integer getAbTestVariantID() { + return abTestVariantID; + } + + + public void setAbTestVariantID(Integer abTestVariantID) { + this.abTestVariantID = abTestVariantID; + } + + + public BaseSearchResponse aroundLatLng(String aroundLatLng) { + + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * The computed geo location. + * @return aroundLatLng + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The computed geo location.") + + public String getAroundLatLng() { + return aroundLatLng; + } + + + public void setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + } + + + public BaseSearchResponse automaticRadius(String automaticRadius) { + + this.automaticRadius = automaticRadius; + return this; + } + + /** + * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. + * @return automaticRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.") + + public String getAutomaticRadius() { + return automaticRadius; + } + + + public void setAutomaticRadius(String automaticRadius) { + this.automaticRadius = automaticRadius; + } + + + public BaseSearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + return this; + } + + /** + * Whether the facet count is exhaustive or approximate. + * @return exhaustiveFacetsCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the facet count is exhaustive or approximate.") + + public Boolean getExhaustiveFacetsCount() { + return exhaustiveFacetsCount; + } + + + public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + } + + + public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { + + this.exhaustiveNbHits = exhaustiveNbHits; + return this; + } + + /** + * Indicate if the nbHits count was exhaustive or approximate + * @return exhaustiveNbHits + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Indicate if the nbHits count was exhaustive or approximate") + + public Boolean getExhaustiveNbHits() { + return exhaustiveNbHits; + } + + + public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { + this.exhaustiveNbHits = exhaustiveNbHits; + } + + + public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { + + this.exhaustiveTypo = exhaustiveTypo; + return this; + } + + /** + * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + * @return exhaustiveTypo + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)") + + public Boolean getExhaustiveTypo() { + return exhaustiveTypo; + } + + + public void setExhaustiveTypo(Boolean exhaustiveTypo) { + this.exhaustiveTypo = exhaustiveTypo; + } + + + public BaseSearchResponse facets(Map> facets) { + + this.facets = facets; + return this; + } + + public BaseSearchResponse putFacetsItem(String key, Map facetsItem) { + if (this.facets == null) { + this.facets = new HashMap>(); + } + this.facets.put(key, facetsItem); + return this; + } + + /** + * A mapping of each facet name to the corresponding facet counts. + * @return facets + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts.") + + public Map> getFacets() { + return facets; + } + + + public void setFacets(Map> facets) { + this.facets = facets; + } + + + public BaseSearchResponse facetsStats(Map facetsStats) { + + this.facetsStats = facetsStats; + return this; + } + + public BaseSearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { + if (this.facetsStats == null) { + this.facetsStats = new HashMap(); + } + this.facetsStats.put(key, facetsStatsItem); + return this; + } + + /** + * Statistics for numerical facets. + * @return facetsStats + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Statistics for numerical facets.") + + public Map getFacetsStats() { + return facetsStats; + } + + + public void setFacetsStats(Map facetsStats) { + this.facetsStats = facetsStats; + } + + + public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { + + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * @return hitsPerPage + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Set the number of hits per page.") + + public Integer getHitsPerPage() { + return hitsPerPage; + } + + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + + public BaseSearchResponse index(String index) { + + this.index = index; + return this; + } + + /** + * Index name used for the query. + * @return index + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "indexName", value = "Index name used for the query.") + + public String getIndex() { + return index; + } + + + public void setIndex(String index) { + this.index = index; + } + + + public BaseSearchResponse indexUsed(String indexUsed) { + + this.indexUsed = indexUsed; + return this; + } + + /** + * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. + * @return indexUsed + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.") + + public String getIndexUsed() { + return indexUsed; + } + + + public void setIndexUsed(String indexUsed) { + this.indexUsed = indexUsed; + } + + + public BaseSearchResponse message(String message) { + + this.message = message; + return this; + } + + /** + * Used to return warnings about the query. + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Used to return warnings about the query.") + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public BaseSearchResponse nbHits(Integer nbHits) { + + this.nbHits = nbHits; + return this; + } + + /** + * Number of hits that the search query matched + * @return nbHits + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "20", required = true, value = "Number of hits that the search query matched") + + public Integer getNbHits() { + return nbHits; + } + + + public void setNbHits(Integer nbHits) { + this.nbHits = nbHits; + } + + + public BaseSearchResponse nbPages(Integer nbPages) { + + this.nbPages = nbPages; + return this; + } + + /** + * Number of pages available for the current query + * @return nbPages + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "1", required = true, value = "Number of pages available for the current query") + + public Integer getNbPages() { + return nbPages; + } + + + public void setNbPages(Integer nbPages) { + this.nbPages = nbPages; + } + + + public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { + + this.nbSortedHits = nbSortedHits; + return this; + } + + /** + * The number of hits selected and sorted by the relevant sort algorithm + * @return nbSortedHits + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm") + + public Integer getNbSortedHits() { + return nbSortedHits; + } + + + public void setNbSortedHits(Integer nbSortedHits) { + this.nbSortedHits = nbSortedHits; + } + + + public BaseSearchResponse page(Integer page) { + + this.page = page; + return this; + } + + /** + * Specify the page to retrieve. + * @return page + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Specify the page to retrieve.") + + public Integer getPage() { + return page; + } + + + public void setPage(Integer page) { + this.page = page; + } + + + public BaseSearchResponse params(String params) { + + this.params = params; + return this; + } + + /** + * A url-encoded string of all search parameters. + * @return params + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "query=a&hitsPerPage=20", required = true, value = "A url-encoded string of all search parameters.") + + public String getParams() { + return params; + } + + + public void setParams(String params) { + this.params = params; + } + + + public BaseSearchResponse parsedQuery(String parsedQuery) { + + this.parsedQuery = parsedQuery; + return this; + } + + /** + * The query string that will be searched, after normalization. + * @return parsedQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The query string that will be searched, after normalization.") + + public String getParsedQuery() { + return parsedQuery; + } + + + public void setParsedQuery(String parsedQuery) { + this.parsedQuery = parsedQuery; + } + + + public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { + + this.processingTimeMS = processingTimeMS; + return this; + } + + /** + * Time the server took to process the request, in milliseconds. + * @return processingTimeMS + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "20", required = true, value = "Time the server took to process the request, in milliseconds.") + + public Integer getProcessingTimeMS() { + return processingTimeMS; + } + + + public void setProcessingTimeMS(Integer processingTimeMS) { + this.processingTimeMS = processingTimeMS; + } + + + public BaseSearchResponse query(String query) { + + this.query = query; + return this; + } + + /** + * The text to search in the index. + * @return query + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The text to search in the index.") + + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { + + this.queryAfterRemoval = queryAfterRemoval; + return this; + } + + /** + * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. + * @return queryAfterRemoval + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.") + + public String getQueryAfterRemoval() { + return queryAfterRemoval; + } + + + public void setQueryAfterRemoval(String queryAfterRemoval) { + this.queryAfterRemoval = queryAfterRemoval; + } + + + public BaseSearchResponse serverUsed(String serverUsed) { + + this.serverUsed = serverUsed; + return this; + } + + /** + * Actual host name of the server that processed the request. + * @return serverUsed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Actual host name of the server that processed the request.") + + public String getServerUsed() { + return serverUsed; + } + + + public void setServerUsed(String serverUsed) { + this.serverUsed = serverUsed; + } + + + public BaseSearchResponse userData(Map userData) { + + this.userData = userData; + return this; + } + + public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { + if (this.userData == null) { + this.userData = new HashMap(); + } + this.userData.put(key, userDataItem); + return this; + } + + /** + * Lets you store custom data in your indices. + * @return userData + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Lets you store custom data in your indices.") + + public Map getUserData() { + return userData; + } + + + public void setUserData(Map userData) { + this.userData = userData; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseSearchResponse baseSearchResponse = (BaseSearchResponse) o; + return Objects.equals(this.abTestID, baseSearchResponse.abTestID) && + Objects.equals(this.abTestVariantID, baseSearchResponse.abTestVariantID) && + Objects.equals(this.aroundLatLng, baseSearchResponse.aroundLatLng) && + Objects.equals(this.automaticRadius, baseSearchResponse.automaticRadius) && + Objects.equals(this.exhaustiveFacetsCount, baseSearchResponse.exhaustiveFacetsCount) && + Objects.equals(this.exhaustiveNbHits, baseSearchResponse.exhaustiveNbHits) && + Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && + Objects.equals(this.facets, baseSearchResponse.facets) && + Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && + Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && + Objects.equals(this.index, baseSearchResponse.index) && + Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && + Objects.equals(this.message, baseSearchResponse.message) && + Objects.equals(this.nbHits, baseSearchResponse.nbHits) && + Objects.equals(this.nbPages, baseSearchResponse.nbPages) && + Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && + Objects.equals(this.page, baseSearchResponse.page) && + Objects.equals(this.params, baseSearchResponse.params) && + Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && + Objects.equals(this.processingTimeMS, baseSearchResponse.processingTimeMS) && + Objects.equals(this.query, baseSearchResponse.query) && + Objects.equals(this.queryAfterRemoval, baseSearchResponse.queryAfterRemoval) && + Objects.equals(this.serverUsed, baseSearchResponse.serverUsed) && + Objects.equals(this.userData, baseSearchResponse.userData); + } + + @Override + public int hashCode() { + return Objects.hash(abTestID, abTestVariantID, aroundLatLng, automaticRadius, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, facets, facetsStats, hitsPerPage, index, indexUsed, message, nbHits, nbPages, nbSortedHits, page, params, parsedQuery, processingTimeMS, query, queryAfterRemoval, serverUsed, userData); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSearchResponse {\n"); + sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); + sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); + sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); + sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); + sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).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-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java new file mode 100644 index 0000000000..088f082087 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -0,0 +1,185 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BaseSearchResponseFacetsStats + */ + +public class BaseSearchResponseFacetsStats { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + private Integer min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + private Integer max; + + public static final String SERIALIZED_NAME_AVG = "avg"; + @SerializedName(SERIALIZED_NAME_AVG) + private Integer avg; + + public static final String SERIALIZED_NAME_SUM = "sum"; + @SerializedName(SERIALIZED_NAME_SUM) + private Integer sum; + + + public BaseSearchResponseFacetsStats min(Integer min) { + + this.min = min; + return this; + } + + /** + * The minimum value in the result set. + * @return min + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The minimum value in the result set.") + + public Integer getMin() { + return min; + } + + + public void setMin(Integer min) { + this.min = min; + } + + + public BaseSearchResponseFacetsStats max(Integer max) { + + this.max = max; + return this; + } + + /** + * The maximum value in the result set. + * @return max + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The maximum value in the result set.") + + public Integer getMax() { + return max; + } + + + public void setMax(Integer max) { + this.max = max; + } + + + public BaseSearchResponseFacetsStats avg(Integer avg) { + + this.avg = avg; + return this; + } + + /** + * The average facet value in the result set. + * @return avg + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The average facet value in the result set.") + + public Integer getAvg() { + return avg; + } + + + public void setAvg(Integer avg) { + this.avg = avg; + } + + + public BaseSearchResponseFacetsStats sum(Integer sum) { + + this.sum = sum; + return this; + } + + /** + * The sum of all values in the result set. + * @return sum + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The sum of all values in the result set.") + + public Integer getSum() { + return sum; + } + + + public void setSum(Integer sum) { + this.sum = sum; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseSearchResponseFacetsStats baseSearchResponseFacetsStats = (BaseSearchResponseFacetsStats) o; + return Objects.equals(this.min, baseSearchResponseFacetsStats.min) && + Objects.equals(this.max, baseSearchResponseFacetsStats.max) && + Objects.equals(this.avg, baseSearchResponseFacetsStats.avg) && + Objects.equals(this.sum, baseSearchResponseFacetsStats.sum); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, avg, sum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSearchResponseFacetsStats {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" avg: ").append(toIndentedString(avg)).append("\n"); + sb.append(" sum: ").append(toIndentedString(sum)).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-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java new file mode 100644 index 0000000000..27d37dfaac --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -0,0 +1,110 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.Operation; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * The `batch` requests. + */ +@ApiModel(description = "The `batch` requests.") + +public class BatchObject { + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + @SerializedName(SERIALIZED_NAME_REQUESTS) + private List requests = null; + + + public BatchObject requests(List requests) { + + this.requests = requests; + return this; + } + + public BatchObject addRequestsItem(Operation requestsItem) { + if (this.requests == null) { + this.requests = new ArrayList(); + } + this.requests.add(requestsItem); + return this; + } + + /** + * Get requests + * @return requests + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getRequests() { + return requests; + } + + + public void setRequests(List requests) { + this.requests = requests; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchObject batchObject = (BatchObject) o; + return Objects.equals(this.requests, batchObject.requests); + } + + @Override + public int hashCode() { + return Objects.hash(requests); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchObject {\n"); + sb.append(" requests: ").append(toIndentedString(requests)).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-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java new file mode 100644 index 0000000000..0ebe939fc8 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -0,0 +1,137 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * BatchResponse + */ + +public class BatchResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_OBJECT_I_DS = "objectIDs"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_DS) + private List objectIDs = null; + + + public BatchResponse taskID(Integer taskID) { + + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * @return taskID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "taskID of the indexing task to wait for.") + + public Integer getTaskID() { + return taskID; + } + + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + + public BatchResponse objectIDs(List objectIDs) { + + this.objectIDs = objectIDs; + return this; + } + + public BatchResponse addObjectIDsItem(String objectIDsItem) { + if (this.objectIDs == null) { + this.objectIDs = new ArrayList(); + } + this.objectIDs.add(objectIDsItem); + return this; + } + + /** + * List of objectID. + * @return objectIDs + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of objectID.") + + public List getObjectIDs() { + return objectIDs; + } + + + public void setObjectIDs(List objectIDs) { + this.objectIDs = objectIDs; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchResponse batchResponse = (BatchResponse) o; + return Objects.equals(this.taskID, batchResponse.taskID) && + Objects.equals(this.objectIDs, batchResponse.objectIDs); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, objectIDs); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb.append(" objectIDs: ").append(toIndentedString(objectIDs)).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-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java new file mode 100644 index 0000000000..15870c7f38 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -0,0 +1,128 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.threeten.bp.OffsetDateTime; + +/** + * DeleteIndexResponse + */ + +public class DeleteIndexResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_DELETE_AT = "deleteAt"; + @SerializedName(SERIALIZED_NAME_DELETE_AT) + private OffsetDateTime deleteAt; + + + public DeleteIndexResponse taskID(Integer taskID) { + + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * @return taskID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "taskID of the indexing task to wait for.") + + public Integer getTaskID() { + return taskID; + } + + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + + public DeleteIndexResponse deleteAt(OffsetDateTime deleteAt) { + + this.deleteAt = deleteAt; + return this; + } + + /** + * Date of deletion (ISO-8601 format). + * @return deleteAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") + + public OffsetDateTime getDeleteAt() { + return deleteAt; + } + + + public void setDeleteAt(OffsetDateTime deleteAt) { + this.deleteAt = deleteAt; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteIndexResponse deleteIndexResponse = (DeleteIndexResponse) o; + return Objects.equals(this.taskID, deleteIndexResponse.taskID) && + Objects.equals(this.deleteAt, deleteIndexResponse.deleteAt); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, deleteAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteIndexResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb.append(" deleteAt: ").append(toIndentedString(deleteAt)).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-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java new file mode 100644 index 0000000000..67e1f67cd1 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -0,0 +1,103 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * Error. + */ +@ApiModel(description = "Error.") + +public class ErrorBase extends HashMap { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + + public ErrorBase message(String message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "Invalid Application-Id or API-Key", value = "") + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = 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-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java new file mode 100644 index 0000000000..7aab8836b2 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -0,0 +1,244 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * HighlightResult + */ + +public class HighlightResult { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + /** + * Indicates how well the attribute matched the search query. + */ + @JsonAdapter(MatchLevelEnum.Adapter.class) + public enum MatchLevelEnum { + NONE("none"), + + PARTIAL("partial"), + + FULL("full"); + + private String value; + + MatchLevelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MatchLevelEnum fromValue(String value) { + for (MatchLevelEnum b : MatchLevelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MatchLevelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MatchLevelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MatchLevelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) + private MatchLevelEnum matchLevel; + + public static final String SERIALIZED_NAME_MATCHED_WORDS = "matchedWords"; + @SerializedName(SERIALIZED_NAME_MATCHED_WORDS) + private List matchedWords = null; + + public static final String SERIALIZED_NAME_FULLY_HIGHLIGHTED = "fullyHighlighted"; + @SerializedName(SERIALIZED_NAME_FULLY_HIGHLIGHTED) + private Boolean fullyHighlighted; + + + public HighlightResult value(String value) { + + this.value = value; + return this; + } + + /** + * Markup text with occurrences highlighted. + * @return value + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "George Clooney", value = "Markup text with occurrences highlighted.") + + public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + } + + + public HighlightResult matchLevel(MatchLevelEnum matchLevel) { + + this.matchLevel = matchLevel; + return this; + } + + /** + * Indicates how well the attribute matched the search query. + * @return matchLevel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Indicates how well the attribute matched the search query.") + + public MatchLevelEnum getMatchLevel() { + return matchLevel; + } + + + public void setMatchLevel(MatchLevelEnum matchLevel) { + this.matchLevel = matchLevel; + } + + + public HighlightResult matchedWords(List matchedWords) { + + this.matchedWords = matchedWords; + return this; + } + + public HighlightResult addMatchedWordsItem(String matchedWordsItem) { + if (this.matchedWords == null) { + this.matchedWords = new ArrayList(); + } + this.matchedWords.add(matchedWordsItem); + return this; + } + + /** + * List of words from the query that matched the object. + * @return matchedWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of words from the query that matched the object.") + + public List getMatchedWords() { + return matchedWords; + } + + + public void setMatchedWords(List matchedWords) { + this.matchedWords = matchedWords; + } + + + public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { + + this.fullyHighlighted = fullyHighlighted; + return this; + } + + /** + * Whether the entire attribute value is highlighted. + * @return fullyHighlighted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the entire attribute value is highlighted.") + + public Boolean getFullyHighlighted() { + return fullyHighlighted; + } + + + public void setFullyHighlighted(Boolean fullyHighlighted) { + this.fullyHighlighted = fullyHighlighted; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HighlightResult highlightResult = (HighlightResult) o; + return Objects.equals(this.value, highlightResult.value) && + Objects.equals(this.matchLevel, highlightResult.matchLevel) && + Objects.equals(this.matchedWords, highlightResult.matchedWords) && + Objects.equals(this.fullyHighlighted, highlightResult.fullyHighlighted); + } + + @Override + public int hashCode() { + return Objects.hash(value, matchLevel, matchedWords, fullyHighlighted); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HighlightResult {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).append("\n"); + sb.append(" matchedWords: ").append(toIndentedString(matchedWords)).append("\n"); + sb.append(" fullyHighlighted: ").append(toIndentedString(fullyHighlighted)).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-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java new file mode 100644 index 0000000000..f8aca281d5 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -0,0 +1,399 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.threeten.bp.OffsetDateTime; + +/** + * Index + */ + +public class Index { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_ENTRIES = "entries"; + @SerializedName(SERIALIZED_NAME_ENTRIES) + private Integer entries; + + public static final String SERIALIZED_NAME_DATA_SIZE = "dataSize"; + @SerializedName(SERIALIZED_NAME_DATA_SIZE) + private Integer dataSize; + + public static final String SERIALIZED_NAME_FILE_SIZE = "fileSize"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) + private Integer fileSize; + + public static final String SERIALIZED_NAME_LAST_BUILD_TIME_S = "lastBuildTimeS"; + @SerializedName(SERIALIZED_NAME_LAST_BUILD_TIME_S) + private Integer lastBuildTimeS; + + public static final String SERIALIZED_NAME_NUMBER_OF_PENDING_TASK = "numberOfPendingTask"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PENDING_TASK) + private Integer numberOfPendingTask; + + public static final String SERIALIZED_NAME_PENDING_TASK = "pendingTask"; + @SerializedName(SERIALIZED_NAME_PENDING_TASK) + private Boolean pendingTask; + + public static final String SERIALIZED_NAME_PRIMARY = "primary"; + @SerializedName(SERIALIZED_NAME_PRIMARY) + private String primary; + + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) + private List replicas = null; + + + public Index name(String name) { + + this.name = name; + return this; + } + + /** + * Index name. + * @return name + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Index name.") + + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Index createdAt(OffsetDateTime createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Index creation date. An empty string means that the index has no records. + * @return createdAt + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Index creation date. An empty string means that the index has no records.") + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public Index updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * @return updatedAt + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Date of last update (ISO-8601 format).") + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public Index entries(Integer entries) { + + this.entries = entries; + return this; + } + + /** + * Number of records contained in the index. + * @return entries + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Number of records contained in the index.") + + public Integer getEntries() { + return entries; + } + + + public void setEntries(Integer entries) { + this.entries = entries; + } + + + public Index dataSize(Integer dataSize) { + + this.dataSize = dataSize; + return this; + } + + /** + * Number of bytes of the index in minified format. + * @return dataSize + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Number of bytes of the index in minified format.") + + public Integer getDataSize() { + return dataSize; + } + + + public void setDataSize(Integer dataSize) { + this.dataSize = dataSize; + } + + + public Index fileSize(Integer fileSize) { + + this.fileSize = fileSize; + return this; + } + + /** + * Number of bytes of the index binary file. + * @return fileSize + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Number of bytes of the index binary file.") + + public Integer getFileSize() { + return fileSize; + } + + + public void setFileSize(Integer fileSize) { + this.fileSize = fileSize; + } + + + public Index lastBuildTimeS(Integer lastBuildTimeS) { + + this.lastBuildTimeS = lastBuildTimeS; + return this; + } + + /** + * Last build time + * @return lastBuildTimeS + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Last build time") + + public Integer getLastBuildTimeS() { + return lastBuildTimeS; + } + + + public void setLastBuildTimeS(Integer lastBuildTimeS) { + this.lastBuildTimeS = lastBuildTimeS; + } + + + public Index numberOfPendingTask(Integer numberOfPendingTask) { + + this.numberOfPendingTask = numberOfPendingTask; + return this; + } + + /** + * Number of pending indexing operations. This value is deprecated and should not be used. + * @return numberOfPendingTask + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Number of pending indexing operations. This value is deprecated and should not be used.") + + public Integer getNumberOfPendingTask() { + return numberOfPendingTask; + } + + + public void setNumberOfPendingTask(Integer numberOfPendingTask) { + this.numberOfPendingTask = numberOfPendingTask; + } + + + public Index pendingTask(Boolean pendingTask) { + + this.pendingTask = pendingTask; + return this; + } + + /** + * A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. + * @return pendingTask + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "A boolean which says whether the index has pending tasks. This value is deprecated and should not be used.") + + public Boolean getPendingTask() { + return pendingTask; + } + + + public void setPendingTask(Boolean pendingTask) { + this.pendingTask = pendingTask; + } + + + public Index primary(String primary) { + + this.primary = primary; + return this; + } + + /** + * Only present if the index is a replica. Contains the name of the related primary index. + * @return primary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Only present if the index is a replica. Contains the name of the related primary index.") + + public String getPrimary() { + return primary; + } + + + public void setPrimary(String primary) { + this.primary = primary; + } + + + public Index replicas(List replicas) { + + this.replicas = replicas; + return this; + } + + public Index addReplicasItem(String replicasItem) { + if (this.replicas == null) { + this.replicas = new ArrayList(); + } + this.replicas.add(replicasItem); + return this; + } + + /** + * Only present if the index is a primary index with replicas. Contains the names of all linked replicas. + * @return replicas + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Only present if the index is a primary index with replicas. Contains the names of all linked replicas.") + + public List getReplicas() { + return replicas; + } + + + public void setReplicas(List replicas) { + this.replicas = replicas; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Index index = (Index) o; + return Objects.equals(this.name, index.name) && + Objects.equals(this.createdAt, index.createdAt) && + Objects.equals(this.updatedAt, index.updatedAt) && + Objects.equals(this.entries, index.entries) && + Objects.equals(this.dataSize, index.dataSize) && + Objects.equals(this.fileSize, index.fileSize) && + Objects.equals(this.lastBuildTimeS, index.lastBuildTimeS) && + Objects.equals(this.numberOfPendingTask, index.numberOfPendingTask) && + Objects.equals(this.pendingTask, index.pendingTask) && + Objects.equals(this.primary, index.primary) && + Objects.equals(this.replicas, index.replicas); + } + + @Override + public int hashCode() { + return Objects.hash(name, createdAt, updatedAt, entries, dataSize, fileSize, lastBuildTimeS, numberOfPendingTask, pendingTask, primary, replicas); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Index {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); + sb.append(" dataSize: ").append(toIndentedString(dataSize)).append("\n"); + sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); + sb.append(" lastBuildTimeS: ").append(toIndentedString(lastBuildTimeS)).append("\n"); + sb.append(" numberOfPendingTask: ").append(toIndentedString(numberOfPendingTask)).append("\n"); + sb.append(" pendingTask: ").append(toIndentedString(pendingTask)).append("\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" replicas: ").append(toIndentedString(replicas)).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-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java new file mode 100644 index 0000000000..9877072164 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -0,0 +1,2200 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.BaseIndexSettings; +import com.algolia.model.IndexSettingsAsSearchParams; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The Algolia index settings. + */ +@ApiModel(description = "The Algolia index settings.") + +public class IndexSettings { + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) + private List replicas = null; + + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) + private Integer paginationLimitedTo = 1000; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) + private List disableTypoToleranceOnWords = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) + private List attributesToTransliterate = null; + + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) + private List camelCaseAttributes = null; + + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) + private Map decompoundedAttributes = null; + + public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) + private List indexLanguages = null; + + public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) + private Boolean filterPromotes = false; + + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) + private List disablePrefixOnAttributes = null; + + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + private Boolean allowCompressionOfIntegerArray = false; + + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) + private List numericAttributesForFiltering = null; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) + private Map userData = null; + + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) + private List searchableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) + private List attributesForFaceting = null; + + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) + private List unretrievableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) + private List attributesToRetrieve = null; + + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) + private List restrictSearchableAttributes = null; + + public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) + private List ranking = null; + + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + private List customRanking = null; + + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) + private Integer relevancyStrictness = 100; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) + private List attributesToHighlight = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) + private List attributesToSnippet = null; + + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) + private String highlightPreTag = ""; + + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) + private String highlightPostTag = ""; + + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) + private String snippetEllipsisText = "…"; + + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + private Boolean restrictHighlightAndSnippetArrays = false; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) + private Integer minWordSizefor1Typo = 4; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) + private Integer minWordSizefor2Typos = 8; + + /** + * Controls whether typo tolerance is enabled and how it is applied. + */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) + public enum TypoToleranceEnum { + TRUE("true"), + + FALSE("false"), + + MIN("min"), + + STRICT("strict"); + + private String value; + + TypoToleranceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypoToleranceEnum fromValue(String value) { + for (TypoToleranceEnum b : TypoToleranceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; + + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + private Boolean allowTyposOnNumericTokens = true; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + private List disableTypoToleranceOnAttributes = null; + + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) + private String separatorsToIndex = ""; + + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + private String ignorePlurals = "false"; + + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) + private String removeStopWords = "false"; + + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) + private String keepDiacriticsOnCharacters = ""; + + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + private List queryLanguages = null; + + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + private Boolean decompoundQuery = true; + + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + private Boolean enableRules = true; + + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) + private Boolean enablePersonalization = false; + + /** + * Controls if and how query words are interpreted as prefixes. + */ + @JsonAdapter(QueryTypeEnum.Adapter.class) + public enum QueryTypeEnum { + PREFIXLAST("prefixLast"), + + PREFIXALL("prefixAll"), + + PREFIXNONE("prefixNone"); + + private String value; + + QueryTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static QueryTypeEnum fromValue(String value) { + for (QueryTypeEnum b : QueryTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) + public enum RemoveWordsIfNoResultsEnum { + NONE("none"), + + LASTWORDS("lastWords"), + + FIRSTWORDS("firstWords"), + + ALLOPTIONAL("allOptional"); + + private String value; + + RemoveWordsIfNoResultsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RemoveWordsIfNoResultsEnum fromValue(String value) { + for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + private Boolean advancedSyntax = false; + + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + private List optionalWords = null; + + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) + private List disableExactOnAttributes = null; + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) + public enum ExactOnSingleWordQueryEnum { + ATTRIBUTE("attribute"), + + NONE("none"), + + WORD("word"); + + private String value; + + ExactOnSingleWordQueryEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ExactOnSingleWordQueryEnum fromValue(String value) { + for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + + /** + * Gets or Sets alternativesAsExact + */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) + public enum AlternativesAsExactEnum { + IGNOREPLURALS("ignorePlurals"), + + SINGLEWORDSYNONYM("singleWordSynonym"), + + MULTIWORDSSYNONYM("multiWordsSynonym"); + + private String value; + + AlternativesAsExactEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AlternativesAsExactEnum fromValue(String value) { + for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) + private List alternativesAsExact = null; + + /** + * Gets or Sets advancedSyntaxFeatures + */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) + public enum AdvancedSyntaxFeaturesEnum { + EXACTPHRASE("exactPhrase"), + + EXCLUDEWORDS("excludeWords"); + + private String value; + + AdvancedSyntaxFeaturesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdvancedSyntaxFeaturesEnum fromValue(String value) { + for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) + private List advancedSyntaxFeatures = null; + + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) + private Integer distinct = 0; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private Boolean synonyms = true; + + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) + private Boolean replaceSynonymsInHighlight = false; + + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + private Integer minProximity = 1; + + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + private List responseFields = null; + + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + private Integer maxFacetHits = 10; + + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + private Boolean attributeCriteriaComputedByMinProximity = false; + + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) + private Object renderingContent; + + + public IndexSettings replicas(List replicas) { + + this.replicas = replicas; + return this; + } + + public IndexSettings addReplicasItem(String replicasItem) { + if (this.replicas == null) { + this.replicas = new ArrayList(); + } + this.replicas.add(replicasItem); + return this; + } + + /** + * Creates replicas, exact copies of an index. + * @return replicas + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Creates replicas, exact copies of an index.") + + public List getReplicas() { + return replicas; + } + + + public void setReplicas(List replicas) { + this.replicas = replicas; + } + + + public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { + + this.paginationLimitedTo = paginationLimitedTo; + return this; + } + + /** + * Set the maximum number of hits accessible via pagination. + * @return paginationLimitedTo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the maximum number of hits accessible via pagination.") + + public Integer getPaginationLimitedTo() { + return paginationLimitedTo; + } + + + public void setPaginationLimitedTo(Integer paginationLimitedTo) { + this.paginationLimitedTo = paginationLimitedTo; + } + + + public IndexSettings disableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + + this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; + return this; + } + + public IndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { + if (this.disableTypoToleranceOnWords == null) { + this.disableTypoToleranceOnWords = new ArrayList(); + } + this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); + return this; + } + + /** + * A list of words for which you want to turn off typo tolerance. + * @return disableTypoToleranceOnWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of words for which you want to turn off typo tolerance.") + + public List getDisableTypoToleranceOnWords() { + return disableTypoToleranceOnWords; + } + + + public void setDisableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; + } + + + public IndexSettings attributesToTransliterate(List attributesToTransliterate) { + + this.attributesToTransliterate = attributesToTransliterate; + return this; + } + + public IndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { + if (this.attributesToTransliterate == null) { + this.attributesToTransliterate = new ArrayList(); + } + this.attributesToTransliterate.add(attributesToTransliterateItem); + return this; + } + + /** + * Specify on which attributes to apply transliteration. + * @return attributesToTransliterate + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify on which attributes to apply transliteration.") + + public List getAttributesToTransliterate() { + return attributesToTransliterate; + } + + + public void setAttributesToTransliterate(List attributesToTransliterate) { + this.attributesToTransliterate = attributesToTransliterate; + } + + + public IndexSettings camelCaseAttributes(List camelCaseAttributes) { + + this.camelCaseAttributes = camelCaseAttributes; + return this; + } + + public IndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { + if (this.camelCaseAttributes == null) { + this.camelCaseAttributes = new ArrayList(); + } + this.camelCaseAttributes.add(camelCaseAttributesItem); + return this; + } + + /** + * List of attributes on which to do a decomposition of camel case words. + * @return camelCaseAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which to do a decomposition of camel case words.") + + public List getCamelCaseAttributes() { + return camelCaseAttributes; + } + + + public void setCamelCaseAttributes(List camelCaseAttributes) { + this.camelCaseAttributes = camelCaseAttributes; + } + + + public IndexSettings decompoundedAttributes(Map decompoundedAttributes) { + + this.decompoundedAttributes = decompoundedAttributes; + return this; + } + + public IndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { + if (this.decompoundedAttributes == null) { + this.decompoundedAttributes = new HashMap(); + } + this.decompoundedAttributes.put(key, decompoundedAttributesItem); + return this; + } + + /** + * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. + * @return decompoundedAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.") + + public Map getDecompoundedAttributes() { + return decompoundedAttributes; + } + + + public void setDecompoundedAttributes(Map decompoundedAttributes) { + this.decompoundedAttributes = decompoundedAttributes; + } + + + public IndexSettings indexLanguages(List indexLanguages) { + + this.indexLanguages = indexLanguages; + return this; + } + + public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { + if (this.indexLanguages == null) { + this.indexLanguages = new ArrayList(); + } + this.indexLanguages.add(indexLanguagesItem); + return this; + } + + /** + * Sets the languages at the index level for language-specific processing such as tokenization and normalization. + * @return indexLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization.") + + public List getIndexLanguages() { + return indexLanguages; + } + + + public void setIndexLanguages(List indexLanguages) { + this.indexLanguages = indexLanguages; + } + + + public IndexSettings filterPromotes(Boolean filterPromotes) { + + this.filterPromotes = filterPromotes; + return this; + } + + /** + * Whether promoted results should match the filters of the current search, except for geographic filters. + * @return filterPromotes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether promoted results should match the filters of the current search, except for geographic filters.") + + public Boolean getFilterPromotes() { + return filterPromotes; + } + + + public void setFilterPromotes(Boolean filterPromotes) { + this.filterPromotes = filterPromotes; + } + + + public IndexSettings disablePrefixOnAttributes(List disablePrefixOnAttributes) { + + this.disablePrefixOnAttributes = disablePrefixOnAttributes; + return this; + } + + public IndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { + if (this.disablePrefixOnAttributes == null) { + this.disablePrefixOnAttributes = new ArrayList(); + } + this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable prefix matching. + * @return disablePrefixOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable prefix matching.") + + public List getDisablePrefixOnAttributes() { + return disablePrefixOnAttributes; + } + + + public void setDisablePrefixOnAttributes(List disablePrefixOnAttributes) { + this.disablePrefixOnAttributes = disablePrefixOnAttributes; + } + + + public IndexSettings allowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + + this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + return this; + } + + /** + * Enables compression of large integer arrays. + * @return allowCompressionOfIntegerArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables compression of large integer arrays.") + + public Boolean getAllowCompressionOfIntegerArray() { + return allowCompressionOfIntegerArray; + } + + + public void setAllowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + } + + + public IndexSettings numericAttributesForFiltering(List numericAttributesForFiltering) { + + this.numericAttributesForFiltering = numericAttributesForFiltering; + return this; + } + + public IndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { + if (this.numericAttributesForFiltering == null) { + this.numericAttributesForFiltering = new ArrayList(); + } + this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); + return this; + } + + /** + * List of numeric attributes that can be used as numerical filters. + * @return numericAttributesForFiltering + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of numeric attributes that can be used as numerical filters.") + + public List getNumericAttributesForFiltering() { + return numericAttributesForFiltering; + } + + + public void setNumericAttributesForFiltering(List numericAttributesForFiltering) { + this.numericAttributesForFiltering = numericAttributesForFiltering; + } + + + public IndexSettings userData(Map userData) { + + this.userData = userData; + return this; + } + + public IndexSettings putUserDataItem(String key, Object userDataItem) { + if (this.userData == null) { + this.userData = new HashMap(); + } + this.userData.put(key, userDataItem); + return this; + } + + /** + * Lets you store custom data in your indices. + * @return userData + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Lets you store custom data in your indices.") + + public Map getUserData() { + return userData; + } + + + public void setUserData(Map userData) { + this.userData = userData; + } + + + public IndexSettings searchableAttributes(List searchableAttributes) { + + this.searchableAttributes = searchableAttributes; + return this; + } + + public IndexSettings addSearchableAttributesItem(String searchableAttributesItem) { + if (this.searchableAttributes == null) { + this.searchableAttributes = new ArrayList(); + } + this.searchableAttributes.add(searchableAttributesItem); + return this; + } + + /** + * The complete list of attributes used for searching. + * @return searchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes used for searching.") + + public List getSearchableAttributes() { + return searchableAttributes; + } + + + public void setSearchableAttributes(List searchableAttributes) { + this.searchableAttributes = searchableAttributes; + } + + + public IndexSettings attributesForFaceting(List attributesForFaceting) { + + this.attributesForFaceting = attributesForFaceting; + return this; + } + + public IndexSettings addAttributesForFacetingItem(String attributesForFacetingItem) { + if (this.attributesForFaceting == null) { + this.attributesForFaceting = new ArrayList(); + } + this.attributesForFaceting.add(attributesForFacetingItem); + return this; + } + + /** + * The complete list of attributes that will be used for faceting. + * @return attributesForFaceting + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") + + public List getAttributesForFaceting() { + return attributesForFaceting; + } + + + public void setAttributesForFaceting(List attributesForFaceting) { + this.attributesForFaceting = attributesForFaceting; + } + + + public IndexSettings unretrievableAttributes(List unretrievableAttributes) { + + this.unretrievableAttributes = unretrievableAttributes; + return this; + } + + public IndexSettings addUnretrievableAttributesItem(String unretrievableAttributesItem) { + if (this.unretrievableAttributes == null) { + this.unretrievableAttributes = new ArrayList(); + } + this.unretrievableAttributes.add(unretrievableAttributesItem); + return this; + } + + /** + * List of attributes that can’t be retrieved at query time. + * @return unretrievableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") + + public List getUnretrievableAttributes() { + return unretrievableAttributes; + } + + + public void setUnretrievableAttributes(List unretrievableAttributes) { + this.unretrievableAttributes = unretrievableAttributes; + } + + + public IndexSettings attributesToRetrieve(List attributesToRetrieve) { + + this.attributesToRetrieve = attributesToRetrieve; + return this; + } + + public IndexSettings addAttributesToRetrieveItem(String attributesToRetrieveItem) { + if (this.attributesToRetrieve == null) { + this.attributesToRetrieve = new ArrayList(); + } + this.attributesToRetrieve.add(attributesToRetrieveItem); + return this; + } + + /** + * This parameter controls which attributes to retrieve and which not to retrieve. + * @return attributesToRetrieve + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") + + public List getAttributesToRetrieve() { + return attributesToRetrieve; + } + + + public void setAttributesToRetrieve(List attributesToRetrieve) { + this.attributesToRetrieve = attributesToRetrieve; + } + + + public IndexSettings restrictSearchableAttributes(List restrictSearchableAttributes) { + + this.restrictSearchableAttributes = restrictSearchableAttributes; + return this; + } + + public IndexSettings addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + if (this.restrictSearchableAttributes == null) { + this.restrictSearchableAttributes = new ArrayList(); + } + this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); + return this; + } + + /** + * Restricts a given query to look in only a subset of your searchable attributes. + * @return restrictSearchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") + + public List getRestrictSearchableAttributes() { + return restrictSearchableAttributes; + } + + + public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + this.restrictSearchableAttributes = restrictSearchableAttributes; + } + + + public IndexSettings ranking(List ranking) { + + this.ranking = ranking; + return this; + } + + public IndexSettings addRankingItem(String rankingItem) { + if (this.ranking == null) { + this.ranking = new ArrayList(); + } + this.ranking.add(rankingItem); + return this; + } + + /** + * Controls how Algolia should sort your results. + * @return ranking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how Algolia should sort your results.") + + public List getRanking() { + return ranking; + } + + + public void setRanking(List ranking) { + this.ranking = ranking; + } + + + public IndexSettings customRanking(List customRanking) { + + this.customRanking = customRanking; + return this; + } + + public IndexSettings addCustomRankingItem(String customRankingItem) { + if (this.customRanking == null) { + this.customRanking = new ArrayList(); + } + this.customRanking.add(customRankingItem); + return this; + } + + /** + * Specifies the custom ranking criterion. + * @return customRanking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies the custom ranking criterion.") + + public List getCustomRanking() { + return customRanking; + } + + + public void setCustomRanking(List customRanking) { + this.customRanking = customRanking; + } + + + public IndexSettings relevancyStrictness(Integer relevancyStrictness) { + + this.relevancyStrictness = relevancyStrictness; + return this; + } + + /** + * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * @return relevancyStrictness + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") + + public Integer getRelevancyStrictness() { + return relevancyStrictness; + } + + + public void setRelevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + } + + + public IndexSettings attributesToHighlight(List attributesToHighlight) { + + this.attributesToHighlight = attributesToHighlight; + return this; + } + + public IndexSettings addAttributesToHighlightItem(String attributesToHighlightItem) { + if (this.attributesToHighlight == null) { + this.attributesToHighlight = new ArrayList(); + } + this.attributesToHighlight.add(attributesToHighlightItem); + return this; + } + + /** + * List of attributes to highlight. + * @return attributesToHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to highlight.") + + public List getAttributesToHighlight() { + return attributesToHighlight; + } + + + public void setAttributesToHighlight(List attributesToHighlight) { + this.attributesToHighlight = attributesToHighlight; + } + + + public IndexSettings attributesToSnippet(List attributesToSnippet) { + + this.attributesToSnippet = attributesToSnippet; + return this; + } + + public IndexSettings addAttributesToSnippetItem(String attributesToSnippetItem) { + if (this.attributesToSnippet == null) { + this.attributesToSnippet = new ArrayList(); + } + this.attributesToSnippet.add(attributesToSnippetItem); + return this; + } + + /** + * List of attributes to snippet, with an optional maximum number of words to snippet. + * @return attributesToSnippet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") + + public List getAttributesToSnippet() { + return attributesToSnippet; + } + + + public void setAttributesToSnippet(List attributesToSnippet) { + this.attributesToSnippet = attributesToSnippet; + } + + + public IndexSettings highlightPreTag(String highlightPreTag) { + + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * @return highlightPreTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") + + public String getHighlightPreTag() { + return highlightPreTag; + } + + + public void setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + } + + + public IndexSettings highlightPostTag(String highlightPostTag) { + + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * @return highlightPostTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") + + public String getHighlightPostTag() { + return highlightPostTag; + } + + + public void setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + } + + + public IndexSettings snippetEllipsisText(String snippetEllipsisText) { + + this.snippetEllipsisText = snippetEllipsisText; + return this; + } + + /** + * String used as an ellipsis indicator when a snippet is truncated. + * @return snippetEllipsisText + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") + + public String getSnippetEllipsisText() { + return snippetEllipsisText; + } + + + public void setSnippetEllipsisText(String snippetEllipsisText) { + this.snippetEllipsisText = snippetEllipsisText; + } + + + public IndexSettings restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + return this; + } + + /** + * Restrict highlighting and snippeting to items that matched the query. + * @return restrictHighlightAndSnippetArrays + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") + + public Boolean getRestrictHighlightAndSnippetArrays() { + return restrictHighlightAndSnippetArrays; + } + + + public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + } + + + public IndexSettings hitsPerPage(Integer hitsPerPage) { + + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * @return hitsPerPage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the number of hits per page.") + + public Integer getHitsPerPage() { + return hitsPerPage; + } + + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + + public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { + + this.minWordSizefor1Typo = minWordSizefor1Typo; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * @return minWordSizefor1Typo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") + + public Integer getMinWordSizefor1Typo() { + return minWordSizefor1Typo; + } + + + public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { + this.minWordSizefor1Typo = minWordSizefor1Typo; + } + + + public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { + + this.minWordSizefor2Typos = minWordSizefor2Typos; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * @return minWordSizefor2Typos + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") + + public Integer getMinWordSizefor2Typos() { + return minWordSizefor2Typos; + } + + + public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { + this.minWordSizefor2Typos = minWordSizefor2Typos; + } + + + public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { + + this.typoTolerance = typoTolerance; + return this; + } + + /** + * Controls whether typo tolerance is enabled and how it is applied. + * @return typoTolerance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") + + public TypoToleranceEnum getTypoTolerance() { + return typoTolerance; + } + + + public void setTypoTolerance(TypoToleranceEnum typoTolerance) { + this.typoTolerance = typoTolerance; + } + + + public IndexSettings allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + return this; + } + + /** + * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * @return allowTyposOnNumericTokens + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") + + public Boolean getAllowTyposOnNumericTokens() { + return allowTyposOnNumericTokens; + } + + + public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + } + + + public IndexSettings disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + return this; + } + + public IndexSettings addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + if (this.disableTypoToleranceOnAttributes == null) { + this.disableTypoToleranceOnAttributes = new ArrayList(); + } + this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable typo tolerance. + * @return disableTypoToleranceOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") + + public List getDisableTypoToleranceOnAttributes() { + return disableTypoToleranceOnAttributes; + } + + + public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + } + + + public IndexSettings separatorsToIndex(String separatorsToIndex) { + + this.separatorsToIndex = separatorsToIndex; + return this; + } + + /** + * Control which separators are indexed. + * @return separatorsToIndex + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Control which separators are indexed.") + + public String getSeparatorsToIndex() { + return separatorsToIndex; + } + + + public void setSeparatorsToIndex(String separatorsToIndex) { + this.separatorsToIndex = separatorsToIndex; + } + + + public IndexSettings ignorePlurals(String ignorePlurals) { + + this.ignorePlurals = ignorePlurals; + return this; + } + + /** + * Treats singular, plurals, and other forms of declensions as matching terms. + * @return ignorePlurals + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") + + public String getIgnorePlurals() { + return ignorePlurals; + } + + + public void setIgnorePlurals(String ignorePlurals) { + this.ignorePlurals = ignorePlurals; + } + + + public IndexSettings removeStopWords(String removeStopWords) { + + this.removeStopWords = removeStopWords; + return this; + } + + /** + * Removes stop (common) words from the query before executing it. + * @return removeStopWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") + + public String getRemoveStopWords() { + return removeStopWords; + } + + + public void setRemoveStopWords(String removeStopWords) { + this.removeStopWords = removeStopWords; + } + + + public IndexSettings keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + return this; + } + + /** + * List of characters that the engine shouldn’t automatically normalize. + * @return keepDiacriticsOnCharacters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") + + public String getKeepDiacriticsOnCharacters() { + return keepDiacriticsOnCharacters; + } + + + public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + } + + + public IndexSettings queryLanguages(List queryLanguages) { + + this.queryLanguages = queryLanguages; + return this; + } + + public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { + if (this.queryLanguages == null) { + this.queryLanguages = new ArrayList(); + } + this.queryLanguages.add(queryLanguagesItem); + return this; + } + + /** + * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * @return queryLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") + + public List getQueryLanguages() { + return queryLanguages; + } + + + public void setQueryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + } + + + public IndexSettings decompoundQuery(Boolean decompoundQuery) { + + this.decompoundQuery = decompoundQuery; + return this; + } + + /** + * Splits compound words into their composing atoms in the query. + * @return decompoundQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") + + public Boolean getDecompoundQuery() { + return decompoundQuery; + } + + + public void setDecompoundQuery(Boolean decompoundQuery) { + this.decompoundQuery = decompoundQuery; + } + + + public IndexSettings enableRules(Boolean enableRules) { + + this.enableRules = enableRules; + return this; + } + + /** + * Whether Rules should be globally enabled. + * @return enableRules + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether Rules should be globally enabled.") + + public Boolean getEnableRules() { + return enableRules; + } + + + public void setEnableRules(Boolean enableRules) { + this.enableRules = enableRules; + } + + + public IndexSettings enablePersonalization(Boolean enablePersonalization) { + + this.enablePersonalization = enablePersonalization; + return this; + } + + /** + * Enable the Personalization feature. + * @return enablePersonalization + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enable the Personalization feature.") + + public Boolean getEnablePersonalization() { + return enablePersonalization; + } + + + public void setEnablePersonalization(Boolean enablePersonalization) { + this.enablePersonalization = enablePersonalization; + } + + + public IndexSettings queryType(QueryTypeEnum queryType) { + + this.queryType = queryType; + return this; + } + + /** + * Controls if and how query words are interpreted as prefixes. + * @return queryType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") + + public QueryTypeEnum getQueryType() { + return queryType; + } + + + public void setQueryType(QueryTypeEnum queryType) { + this.queryType = queryType; + } + + + public IndexSettings removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + + this.removeWordsIfNoResults = removeWordsIfNoResults; + return this; + } + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + * @return removeWordsIfNoResults + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") + + public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { + return removeWordsIfNoResults; + } + + + public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + this.removeWordsIfNoResults = removeWordsIfNoResults; + } + + + public IndexSettings advancedSyntax(Boolean advancedSyntax) { + + this.advancedSyntax = advancedSyntax; + return this; + } + + /** + * Enables the advanced query syntax. + * @return advancedSyntax + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables the advanced query syntax.") + + public Boolean getAdvancedSyntax() { + return advancedSyntax; + } + + + public void setAdvancedSyntax(Boolean advancedSyntax) { + this.advancedSyntax = advancedSyntax; + } + + + public IndexSettings optionalWords(List optionalWords) { + + this.optionalWords = optionalWords; + return this; + } + + public IndexSettings addOptionalWordsItem(String optionalWordsItem) { + if (this.optionalWords == null) { + this.optionalWords = new ArrayList(); + } + this.optionalWords.add(optionalWordsItem); + return this; + } + + /** + * A list of words that should be considered as optional when found in the query. + * @return optionalWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") + + public List getOptionalWords() { + return optionalWords; + } + + + public void setOptionalWords(List optionalWords) { + this.optionalWords = optionalWords; + } + + + public IndexSettings disableExactOnAttributes(List disableExactOnAttributes) { + + this.disableExactOnAttributes = disableExactOnAttributes; + return this; + } + + public IndexSettings addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + if (this.disableExactOnAttributes == null) { + this.disableExactOnAttributes = new ArrayList(); + } + this.disableExactOnAttributes.add(disableExactOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable the exact ranking criterion. + * @return disableExactOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") + + public List getDisableExactOnAttributes() { + return disableExactOnAttributes; + } + + + public void setDisableExactOnAttributes(List disableExactOnAttributes) { + this.disableExactOnAttributes = disableExactOnAttributes; + } + + + public IndexSettings exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + return this; + } + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + * @return exactOnSingleWordQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") + + public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { + return exactOnSingleWordQuery; + } + + + public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + } + + + public IndexSettings alternativesAsExact(List alternativesAsExact) { + + this.alternativesAsExact = alternativesAsExact; + return this; + } + + public IndexSettings addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + if (this.alternativesAsExact == null) { + this.alternativesAsExact = new ArrayList(); + } + this.alternativesAsExact.add(alternativesAsExactItem); + return this; + } + + /** + * List of alternatives that should be considered an exact match by the exact ranking criterion. + * @return alternativesAsExact + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") + + public List getAlternativesAsExact() { + return alternativesAsExact; + } + + + public void setAlternativesAsExact(List alternativesAsExact) { + this.alternativesAsExact = alternativesAsExact; + } + + + public IndexSettings advancedSyntaxFeatures(List advancedSyntaxFeatures) { + + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + return this; + } + + public IndexSettings addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + if (this.advancedSyntaxFeatures == null) { + this.advancedSyntaxFeatures = new ArrayList(); + } + this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); + return this; + } + + /** + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * @return advancedSyntaxFeatures + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") + + public List getAdvancedSyntaxFeatures() { + return advancedSyntaxFeatures; + } + + + public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + } + + + public IndexSettings distinct(Integer distinct) { + + this.distinct = distinct; + return this; + } + + /** + * Enables de-duplication or grouping of results. + * minimum: 0 + * maximum: 4 + * @return distinct + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + + public Integer getDistinct() { + return distinct; + } + + + public void setDistinct(Integer distinct) { + this.distinct = distinct; + } + + + public IndexSettings synonyms(Boolean synonyms) { + + this.synonyms = synonyms; + return this; + } + + /** + * Whether to take into account an index’s synonyms for a particular search. + * @return synonyms + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") + + public Boolean getSynonyms() { + return synonyms; + } + + + public void setSynonyms(Boolean synonyms) { + this.synonyms = synonyms; + } + + + public IndexSettings replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + return this; + } + + /** + * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * @return replaceSynonymsInHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") + + public Boolean getReplaceSynonymsInHighlight() { + return replaceSynonymsInHighlight; + } + + + public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + } + + + public IndexSettings minProximity(Integer minProximity) { + + this.minProximity = minProximity; + return this; + } + + /** + * Precision of the proximity ranking criterion. + * minimum: 1 + * maximum: 7 + * @return minProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + + public Integer getMinProximity() { + return minProximity; + } + + + public void setMinProximity(Integer minProximity) { + this.minProximity = minProximity; + } + + + public IndexSettings responseFields(List responseFields) { + + this.responseFields = responseFields; + return this; + } + + public IndexSettings addResponseFieldsItem(String responseFieldsItem) { + if (this.responseFields == null) { + this.responseFields = new ArrayList(); + } + this.responseFields.add(responseFieldsItem); + return this; + } + + /** + * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * @return responseFields + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") + + public List getResponseFields() { + return responseFields; + } + + + public void setResponseFields(List responseFields) { + this.responseFields = responseFields; + } + + + public IndexSettings maxFacetHits(Integer maxFacetHits) { + + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet hits to return during a search for facet values. + * @return maxFacetHits + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") + + public Integer getMaxFacetHits() { + return maxFacetHits; + } + + + public void setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + } + + + public IndexSettings attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + return this; + } + + /** + * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * @return attributeCriteriaComputedByMinProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") + + public Boolean getAttributeCriteriaComputedByMinProximity() { + return attributeCriteriaComputedByMinProximity; + } + + + public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + } + + + public IndexSettings renderingContent(Object renderingContent) { + + this.renderingContent = renderingContent; + return this; + } + + /** + * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * @return renderingContent + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") + + public Object getRenderingContent() { + return renderingContent; + } + + + public void setRenderingContent(Object renderingContent) { + this.renderingContent = renderingContent; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndexSettings indexSettings = (IndexSettings) o; + return Objects.equals(this.replicas, indexSettings.replicas) && + Objects.equals(this.paginationLimitedTo, indexSettings.paginationLimitedTo) && + Objects.equals(this.disableTypoToleranceOnWords, indexSettings.disableTypoToleranceOnWords) && + Objects.equals(this.attributesToTransliterate, indexSettings.attributesToTransliterate) && + Objects.equals(this.camelCaseAttributes, indexSettings.camelCaseAttributes) && + Objects.equals(this.decompoundedAttributes, indexSettings.decompoundedAttributes) && + Objects.equals(this.indexLanguages, indexSettings.indexLanguages) && + Objects.equals(this.filterPromotes, indexSettings.filterPromotes) && + Objects.equals(this.disablePrefixOnAttributes, indexSettings.disablePrefixOnAttributes) && + Objects.equals(this.allowCompressionOfIntegerArray, indexSettings.allowCompressionOfIntegerArray) && + Objects.equals(this.numericAttributesForFiltering, indexSettings.numericAttributesForFiltering) && + Objects.equals(this.userData, indexSettings.userData) && + Objects.equals(this.searchableAttributes, indexSettings.searchableAttributes) && + Objects.equals(this.attributesForFaceting, indexSettings.attributesForFaceting) && + Objects.equals(this.unretrievableAttributes, indexSettings.unretrievableAttributes) && + Objects.equals(this.attributesToRetrieve, indexSettings.attributesToRetrieve) && + Objects.equals(this.restrictSearchableAttributes, indexSettings.restrictSearchableAttributes) && + Objects.equals(this.ranking, indexSettings.ranking) && + Objects.equals(this.customRanking, indexSettings.customRanking) && + Objects.equals(this.relevancyStrictness, indexSettings.relevancyStrictness) && + Objects.equals(this.attributesToHighlight, indexSettings.attributesToHighlight) && + Objects.equals(this.attributesToSnippet, indexSettings.attributesToSnippet) && + Objects.equals(this.highlightPreTag, indexSettings.highlightPreTag) && + Objects.equals(this.highlightPostTag, indexSettings.highlightPostTag) && + Objects.equals(this.snippetEllipsisText, indexSettings.snippetEllipsisText) && + Objects.equals(this.restrictHighlightAndSnippetArrays, indexSettings.restrictHighlightAndSnippetArrays) && + Objects.equals(this.hitsPerPage, indexSettings.hitsPerPage) && + Objects.equals(this.minWordSizefor1Typo, indexSettings.minWordSizefor1Typo) && + Objects.equals(this.minWordSizefor2Typos, indexSettings.minWordSizefor2Typos) && + Objects.equals(this.typoTolerance, indexSettings.typoTolerance) && + Objects.equals(this.allowTyposOnNumericTokens, indexSettings.allowTyposOnNumericTokens) && + Objects.equals(this.disableTypoToleranceOnAttributes, indexSettings.disableTypoToleranceOnAttributes) && + Objects.equals(this.separatorsToIndex, indexSettings.separatorsToIndex) && + Objects.equals(this.ignorePlurals, indexSettings.ignorePlurals) && + Objects.equals(this.removeStopWords, indexSettings.removeStopWords) && + Objects.equals(this.keepDiacriticsOnCharacters, indexSettings.keepDiacriticsOnCharacters) && + Objects.equals(this.queryLanguages, indexSettings.queryLanguages) && + Objects.equals(this.decompoundQuery, indexSettings.decompoundQuery) && + Objects.equals(this.enableRules, indexSettings.enableRules) && + Objects.equals(this.enablePersonalization, indexSettings.enablePersonalization) && + Objects.equals(this.queryType, indexSettings.queryType) && + Objects.equals(this.removeWordsIfNoResults, indexSettings.removeWordsIfNoResults) && + Objects.equals(this.advancedSyntax, indexSettings.advancedSyntax) && + Objects.equals(this.optionalWords, indexSettings.optionalWords) && + Objects.equals(this.disableExactOnAttributes, indexSettings.disableExactOnAttributes) && + Objects.equals(this.exactOnSingleWordQuery, indexSettings.exactOnSingleWordQuery) && + Objects.equals(this.alternativesAsExact, indexSettings.alternativesAsExact) && + Objects.equals(this.advancedSyntaxFeatures, indexSettings.advancedSyntaxFeatures) && + Objects.equals(this.distinct, indexSettings.distinct) && + Objects.equals(this.synonyms, indexSettings.synonyms) && + Objects.equals(this.replaceSynonymsInHighlight, indexSettings.replaceSynonymsInHighlight) && + Objects.equals(this.minProximity, indexSettings.minProximity) && + Objects.equals(this.responseFields, indexSettings.responseFields) && + Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && + Objects.equals(this.attributeCriteriaComputedByMinProximity, indexSettings.attributeCriteriaComputedByMinProximity) && + Objects.equals(this.renderingContent, indexSettings.renderingContent); + } + + @Override + public int hashCode() { + return Objects.hash(replicas, paginationLimitedTo, disableTypoToleranceOnWords, attributesToTransliterate, camelCaseAttributes, decompoundedAttributes, indexLanguages, filterPromotes, disablePrefixOnAttributes, allowCompressionOfIntegerArray, numericAttributesForFiltering, userData, searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndexSettings {\n"); + sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); + sb.append(" paginationLimitedTo: ").append(toIndentedString(paginationLimitedTo)).append("\n"); + sb.append(" disableTypoToleranceOnWords: ").append(toIndentedString(disableTypoToleranceOnWords)).append("\n"); + sb.append(" attributesToTransliterate: ").append(toIndentedString(attributesToTransliterate)).append("\n"); + sb.append(" camelCaseAttributes: ").append(toIndentedString(camelCaseAttributes)).append("\n"); + sb.append(" decompoundedAttributes: ").append(toIndentedString(decompoundedAttributes)).append("\n"); + sb.append(" indexLanguages: ").append(toIndentedString(indexLanguages)).append("\n"); + sb.append(" filterPromotes: ").append(toIndentedString(filterPromotes)).append("\n"); + sb.append(" disablePrefixOnAttributes: ").append(toIndentedString(disablePrefixOnAttributes)).append("\n"); + sb.append(" allowCompressionOfIntegerArray: ").append(toIndentedString(allowCompressionOfIntegerArray)).append("\n"); + sb.append(" numericAttributesForFiltering: ").append(toIndentedString(numericAttributesForFiltering)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); + sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); + sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); + sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); + sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); + sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); + sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); + sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); + sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); + sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); + sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); + sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); + sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); + sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); + sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); + sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); + sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); + sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); + sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); + sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); + sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); + sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); + sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); + sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); + sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); + sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); + sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); + sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); + sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); + sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); + sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); + sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); + sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); + sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); + sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); + sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); + sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).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-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java new file mode 100644 index 0000000000..567b3135a6 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -0,0 +1,1775 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * IndexSettingsAsSearchParams + */ + +public class IndexSettingsAsSearchParams { + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) + private List searchableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) + private List attributesForFaceting = null; + + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) + private List unretrievableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) + private List attributesToRetrieve = null; + + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) + private List restrictSearchableAttributes = null; + + public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) + private List ranking = null; + + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + private List customRanking = null; + + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) + private Integer relevancyStrictness = 100; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) + private List attributesToHighlight = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) + private List attributesToSnippet = null; + + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) + private String highlightPreTag = ""; + + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) + private String highlightPostTag = ""; + + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) + private String snippetEllipsisText = "…"; + + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + private Boolean restrictHighlightAndSnippetArrays = false; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) + private Integer minWordSizefor1Typo = 4; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) + private Integer minWordSizefor2Typos = 8; + + /** + * Controls whether typo tolerance is enabled and how it is applied. + */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) + public enum TypoToleranceEnum { + TRUE("true"), + + FALSE("false"), + + MIN("min"), + + STRICT("strict"); + + private String value; + + TypoToleranceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypoToleranceEnum fromValue(String value) { + for (TypoToleranceEnum b : TypoToleranceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; + + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + private Boolean allowTyposOnNumericTokens = true; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + private List disableTypoToleranceOnAttributes = null; + + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) + private String separatorsToIndex = ""; + + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + private String ignorePlurals = "false"; + + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) + private String removeStopWords = "false"; + + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) + private String keepDiacriticsOnCharacters = ""; + + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + private List queryLanguages = null; + + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + private Boolean decompoundQuery = true; + + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + private Boolean enableRules = true; + + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) + private Boolean enablePersonalization = false; + + /** + * Controls if and how query words are interpreted as prefixes. + */ + @JsonAdapter(QueryTypeEnum.Adapter.class) + public enum QueryTypeEnum { + PREFIXLAST("prefixLast"), + + PREFIXALL("prefixAll"), + + PREFIXNONE("prefixNone"); + + private String value; + + QueryTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static QueryTypeEnum fromValue(String value) { + for (QueryTypeEnum b : QueryTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) + public enum RemoveWordsIfNoResultsEnum { + NONE("none"), + + LASTWORDS("lastWords"), + + FIRSTWORDS("firstWords"), + + ALLOPTIONAL("allOptional"); + + private String value; + + RemoveWordsIfNoResultsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RemoveWordsIfNoResultsEnum fromValue(String value) { + for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + private Boolean advancedSyntax = false; + + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + private List optionalWords = null; + + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) + private List disableExactOnAttributes = null; + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) + public enum ExactOnSingleWordQueryEnum { + ATTRIBUTE("attribute"), + + NONE("none"), + + WORD("word"); + + private String value; + + ExactOnSingleWordQueryEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ExactOnSingleWordQueryEnum fromValue(String value) { + for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + + /** + * Gets or Sets alternativesAsExact + */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) + public enum AlternativesAsExactEnum { + IGNOREPLURALS("ignorePlurals"), + + SINGLEWORDSYNONYM("singleWordSynonym"), + + MULTIWORDSSYNONYM("multiWordsSynonym"); + + private String value; + + AlternativesAsExactEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AlternativesAsExactEnum fromValue(String value) { + for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) + private List alternativesAsExact = null; + + /** + * Gets or Sets advancedSyntaxFeatures + */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) + public enum AdvancedSyntaxFeaturesEnum { + EXACTPHRASE("exactPhrase"), + + EXCLUDEWORDS("excludeWords"); + + private String value; + + AdvancedSyntaxFeaturesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdvancedSyntaxFeaturesEnum fromValue(String value) { + for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) + private List advancedSyntaxFeatures = null; + + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) + private Integer distinct = 0; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private Boolean synonyms = true; + + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) + private Boolean replaceSynonymsInHighlight = false; + + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + private Integer minProximity = 1; + + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + private List responseFields = null; + + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + private Integer maxFacetHits = 10; + + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + private Boolean attributeCriteriaComputedByMinProximity = false; + + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) + private Object renderingContent; + + + public IndexSettingsAsSearchParams searchableAttributes(List searchableAttributes) { + + this.searchableAttributes = searchableAttributes; + return this; + } + + public IndexSettingsAsSearchParams addSearchableAttributesItem(String searchableAttributesItem) { + if (this.searchableAttributes == null) { + this.searchableAttributes = new ArrayList(); + } + this.searchableAttributes.add(searchableAttributesItem); + return this; + } + + /** + * The complete list of attributes used for searching. + * @return searchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes used for searching.") + + public List getSearchableAttributes() { + return searchableAttributes; + } + + + public void setSearchableAttributes(List searchableAttributes) { + this.searchableAttributes = searchableAttributes; + } + + + public IndexSettingsAsSearchParams attributesForFaceting(List attributesForFaceting) { + + this.attributesForFaceting = attributesForFaceting; + return this; + } + + public IndexSettingsAsSearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { + if (this.attributesForFaceting == null) { + this.attributesForFaceting = new ArrayList(); + } + this.attributesForFaceting.add(attributesForFacetingItem); + return this; + } + + /** + * The complete list of attributes that will be used for faceting. + * @return attributesForFaceting + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") + + public List getAttributesForFaceting() { + return attributesForFaceting; + } + + + public void setAttributesForFaceting(List attributesForFaceting) { + this.attributesForFaceting = attributesForFaceting; + } + + + public IndexSettingsAsSearchParams unretrievableAttributes(List unretrievableAttributes) { + + this.unretrievableAttributes = unretrievableAttributes; + return this; + } + + public IndexSettingsAsSearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { + if (this.unretrievableAttributes == null) { + this.unretrievableAttributes = new ArrayList(); + } + this.unretrievableAttributes.add(unretrievableAttributesItem); + return this; + } + + /** + * List of attributes that can’t be retrieved at query time. + * @return unretrievableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") + + public List getUnretrievableAttributes() { + return unretrievableAttributes; + } + + + public void setUnretrievableAttributes(List unretrievableAttributes) { + this.unretrievableAttributes = unretrievableAttributes; + } + + + public IndexSettingsAsSearchParams attributesToRetrieve(List attributesToRetrieve) { + + this.attributesToRetrieve = attributesToRetrieve; + return this; + } + + public IndexSettingsAsSearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { + if (this.attributesToRetrieve == null) { + this.attributesToRetrieve = new ArrayList(); + } + this.attributesToRetrieve.add(attributesToRetrieveItem); + return this; + } + + /** + * This parameter controls which attributes to retrieve and which not to retrieve. + * @return attributesToRetrieve + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") + + public List getAttributesToRetrieve() { + return attributesToRetrieve; + } + + + public void setAttributesToRetrieve(List attributesToRetrieve) { + this.attributesToRetrieve = attributesToRetrieve; + } + + + public IndexSettingsAsSearchParams restrictSearchableAttributes(List restrictSearchableAttributes) { + + this.restrictSearchableAttributes = restrictSearchableAttributes; + return this; + } + + public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + if (this.restrictSearchableAttributes == null) { + this.restrictSearchableAttributes = new ArrayList(); + } + this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); + return this; + } + + /** + * Restricts a given query to look in only a subset of your searchable attributes. + * @return restrictSearchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") + + public List getRestrictSearchableAttributes() { + return restrictSearchableAttributes; + } + + + public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + this.restrictSearchableAttributes = restrictSearchableAttributes; + } + + + public IndexSettingsAsSearchParams ranking(List ranking) { + + this.ranking = ranking; + return this; + } + + public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { + if (this.ranking == null) { + this.ranking = new ArrayList(); + } + this.ranking.add(rankingItem); + return this; + } + + /** + * Controls how Algolia should sort your results. + * @return ranking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how Algolia should sort your results.") + + public List getRanking() { + return ranking; + } + + + public void setRanking(List ranking) { + this.ranking = ranking; + } + + + public IndexSettingsAsSearchParams customRanking(List customRanking) { + + this.customRanking = customRanking; + return this; + } + + public IndexSettingsAsSearchParams addCustomRankingItem(String customRankingItem) { + if (this.customRanking == null) { + this.customRanking = new ArrayList(); + } + this.customRanking.add(customRankingItem); + return this; + } + + /** + * Specifies the custom ranking criterion. + * @return customRanking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies the custom ranking criterion.") + + public List getCustomRanking() { + return customRanking; + } + + + public void setCustomRanking(List customRanking) { + this.customRanking = customRanking; + } + + + public IndexSettingsAsSearchParams relevancyStrictness(Integer relevancyStrictness) { + + this.relevancyStrictness = relevancyStrictness; + return this; + } + + /** + * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * @return relevancyStrictness + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") + + public Integer getRelevancyStrictness() { + return relevancyStrictness; + } + + + public void setRelevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + } + + + public IndexSettingsAsSearchParams attributesToHighlight(List attributesToHighlight) { + + this.attributesToHighlight = attributesToHighlight; + return this; + } + + public IndexSettingsAsSearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { + if (this.attributesToHighlight == null) { + this.attributesToHighlight = new ArrayList(); + } + this.attributesToHighlight.add(attributesToHighlightItem); + return this; + } + + /** + * List of attributes to highlight. + * @return attributesToHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to highlight.") + + public List getAttributesToHighlight() { + return attributesToHighlight; + } + + + public void setAttributesToHighlight(List attributesToHighlight) { + this.attributesToHighlight = attributesToHighlight; + } + + + public IndexSettingsAsSearchParams attributesToSnippet(List attributesToSnippet) { + + this.attributesToSnippet = attributesToSnippet; + return this; + } + + public IndexSettingsAsSearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { + if (this.attributesToSnippet == null) { + this.attributesToSnippet = new ArrayList(); + } + this.attributesToSnippet.add(attributesToSnippetItem); + return this; + } + + /** + * List of attributes to snippet, with an optional maximum number of words to snippet. + * @return attributesToSnippet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") + + public List getAttributesToSnippet() { + return attributesToSnippet; + } + + + public void setAttributesToSnippet(List attributesToSnippet) { + this.attributesToSnippet = attributesToSnippet; + } + + + public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { + + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * @return highlightPreTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") + + public String getHighlightPreTag() { + return highlightPreTag; + } + + + public void setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + } + + + public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { + + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * @return highlightPostTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") + + public String getHighlightPostTag() { + return highlightPostTag; + } + + + public void setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + } + + + public IndexSettingsAsSearchParams snippetEllipsisText(String snippetEllipsisText) { + + this.snippetEllipsisText = snippetEllipsisText; + return this; + } + + /** + * String used as an ellipsis indicator when a snippet is truncated. + * @return snippetEllipsisText + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") + + public String getSnippetEllipsisText() { + return snippetEllipsisText; + } + + + public void setSnippetEllipsisText(String snippetEllipsisText) { + this.snippetEllipsisText = snippetEllipsisText; + } + + + public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + return this; + } + + /** + * Restrict highlighting and snippeting to items that matched the query. + * @return restrictHighlightAndSnippetArrays + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") + + public Boolean getRestrictHighlightAndSnippetArrays() { + return restrictHighlightAndSnippetArrays; + } + + + public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + } + + + public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { + + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * @return hitsPerPage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the number of hits per page.") + + public Integer getHitsPerPage() { + return hitsPerPage; + } + + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + + public IndexSettingsAsSearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { + + this.minWordSizefor1Typo = minWordSizefor1Typo; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * @return minWordSizefor1Typo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") + + public Integer getMinWordSizefor1Typo() { + return minWordSizefor1Typo; + } + + + public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { + this.minWordSizefor1Typo = minWordSizefor1Typo; + } + + + public IndexSettingsAsSearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { + + this.minWordSizefor2Typos = minWordSizefor2Typos; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * @return minWordSizefor2Typos + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") + + public Integer getMinWordSizefor2Typos() { + return minWordSizefor2Typos; + } + + + public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { + this.minWordSizefor2Typos = minWordSizefor2Typos; + } + + + public IndexSettingsAsSearchParams typoTolerance(TypoToleranceEnum typoTolerance) { + + this.typoTolerance = typoTolerance; + return this; + } + + /** + * Controls whether typo tolerance is enabled and how it is applied. + * @return typoTolerance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") + + public TypoToleranceEnum getTypoTolerance() { + return typoTolerance; + } + + + public void setTypoTolerance(TypoToleranceEnum typoTolerance) { + this.typoTolerance = typoTolerance; + } + + + public IndexSettingsAsSearchParams allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + return this; + } + + /** + * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * @return allowTyposOnNumericTokens + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") + + public Boolean getAllowTyposOnNumericTokens() { + return allowTyposOnNumericTokens; + } + + + public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + } + + + public IndexSettingsAsSearchParams disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + return this; + } + + public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + if (this.disableTypoToleranceOnAttributes == null) { + this.disableTypoToleranceOnAttributes = new ArrayList(); + } + this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable typo tolerance. + * @return disableTypoToleranceOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") + + public List getDisableTypoToleranceOnAttributes() { + return disableTypoToleranceOnAttributes; + } + + + public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + } + + + public IndexSettingsAsSearchParams separatorsToIndex(String separatorsToIndex) { + + this.separatorsToIndex = separatorsToIndex; + return this; + } + + /** + * Control which separators are indexed. + * @return separatorsToIndex + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Control which separators are indexed.") + + public String getSeparatorsToIndex() { + return separatorsToIndex; + } + + + public void setSeparatorsToIndex(String separatorsToIndex) { + this.separatorsToIndex = separatorsToIndex; + } + + + public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { + + this.ignorePlurals = ignorePlurals; + return this; + } + + /** + * Treats singular, plurals, and other forms of declensions as matching terms. + * @return ignorePlurals + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") + + public String getIgnorePlurals() { + return ignorePlurals; + } + + + public void setIgnorePlurals(String ignorePlurals) { + this.ignorePlurals = ignorePlurals; + } + + + public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { + + this.removeStopWords = removeStopWords; + return this; + } + + /** + * Removes stop (common) words from the query before executing it. + * @return removeStopWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") + + public String getRemoveStopWords() { + return removeStopWords; + } + + + public void setRemoveStopWords(String removeStopWords) { + this.removeStopWords = removeStopWords; + } + + + public IndexSettingsAsSearchParams keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + return this; + } + + /** + * List of characters that the engine shouldn’t automatically normalize. + * @return keepDiacriticsOnCharacters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") + + public String getKeepDiacriticsOnCharacters() { + return keepDiacriticsOnCharacters; + } + + + public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + } + + + public IndexSettingsAsSearchParams queryLanguages(List queryLanguages) { + + this.queryLanguages = queryLanguages; + return this; + } + + public IndexSettingsAsSearchParams addQueryLanguagesItem(String queryLanguagesItem) { + if (this.queryLanguages == null) { + this.queryLanguages = new ArrayList(); + } + this.queryLanguages.add(queryLanguagesItem); + return this; + } + + /** + * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * @return queryLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") + + public List getQueryLanguages() { + return queryLanguages; + } + + + public void setQueryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + } + + + public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { + + this.decompoundQuery = decompoundQuery; + return this; + } + + /** + * Splits compound words into their composing atoms in the query. + * @return decompoundQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") + + public Boolean getDecompoundQuery() { + return decompoundQuery; + } + + + public void setDecompoundQuery(Boolean decompoundQuery) { + this.decompoundQuery = decompoundQuery; + } + + + public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { + + this.enableRules = enableRules; + return this; + } + + /** + * Whether Rules should be globally enabled. + * @return enableRules + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether Rules should be globally enabled.") + + public Boolean getEnableRules() { + return enableRules; + } + + + public void setEnableRules(Boolean enableRules) { + this.enableRules = enableRules; + } + + + public IndexSettingsAsSearchParams enablePersonalization(Boolean enablePersonalization) { + + this.enablePersonalization = enablePersonalization; + return this; + } + + /** + * Enable the Personalization feature. + * @return enablePersonalization + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enable the Personalization feature.") + + public Boolean getEnablePersonalization() { + return enablePersonalization; + } + + + public void setEnablePersonalization(Boolean enablePersonalization) { + this.enablePersonalization = enablePersonalization; + } + + + public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { + + this.queryType = queryType; + return this; + } + + /** + * Controls if and how query words are interpreted as prefixes. + * @return queryType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") + + public QueryTypeEnum getQueryType() { + return queryType; + } + + + public void setQueryType(QueryTypeEnum queryType) { + this.queryType = queryType; + } + + + public IndexSettingsAsSearchParams removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + + this.removeWordsIfNoResults = removeWordsIfNoResults; + return this; + } + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + * @return removeWordsIfNoResults + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") + + public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { + return removeWordsIfNoResults; + } + + + public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + this.removeWordsIfNoResults = removeWordsIfNoResults; + } + + + public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { + + this.advancedSyntax = advancedSyntax; + return this; + } + + /** + * Enables the advanced query syntax. + * @return advancedSyntax + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables the advanced query syntax.") + + public Boolean getAdvancedSyntax() { + return advancedSyntax; + } + + + public void setAdvancedSyntax(Boolean advancedSyntax) { + this.advancedSyntax = advancedSyntax; + } + + + public IndexSettingsAsSearchParams optionalWords(List optionalWords) { + + this.optionalWords = optionalWords; + return this; + } + + public IndexSettingsAsSearchParams addOptionalWordsItem(String optionalWordsItem) { + if (this.optionalWords == null) { + this.optionalWords = new ArrayList(); + } + this.optionalWords.add(optionalWordsItem); + return this; + } + + /** + * A list of words that should be considered as optional when found in the query. + * @return optionalWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") + + public List getOptionalWords() { + return optionalWords; + } + + + public void setOptionalWords(List optionalWords) { + this.optionalWords = optionalWords; + } + + + public IndexSettingsAsSearchParams disableExactOnAttributes(List disableExactOnAttributes) { + + this.disableExactOnAttributes = disableExactOnAttributes; + return this; + } + + public IndexSettingsAsSearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + if (this.disableExactOnAttributes == null) { + this.disableExactOnAttributes = new ArrayList(); + } + this.disableExactOnAttributes.add(disableExactOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable the exact ranking criterion. + * @return disableExactOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") + + public List getDisableExactOnAttributes() { + return disableExactOnAttributes; + } + + + public void setDisableExactOnAttributes(List disableExactOnAttributes) { + this.disableExactOnAttributes = disableExactOnAttributes; + } + + + public IndexSettingsAsSearchParams exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + return this; + } + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + * @return exactOnSingleWordQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") + + public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { + return exactOnSingleWordQuery; + } + + + public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + } + + + public IndexSettingsAsSearchParams alternativesAsExact(List alternativesAsExact) { + + this.alternativesAsExact = alternativesAsExact; + return this; + } + + public IndexSettingsAsSearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + if (this.alternativesAsExact == null) { + this.alternativesAsExact = new ArrayList(); + } + this.alternativesAsExact.add(alternativesAsExactItem); + return this; + } + + /** + * List of alternatives that should be considered an exact match by the exact ranking criterion. + * @return alternativesAsExact + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") + + public List getAlternativesAsExact() { + return alternativesAsExact; + } + + + public void setAlternativesAsExact(List alternativesAsExact) { + this.alternativesAsExact = alternativesAsExact; + } + + + public IndexSettingsAsSearchParams advancedSyntaxFeatures(List advancedSyntaxFeatures) { + + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + return this; + } + + public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + if (this.advancedSyntaxFeatures == null) { + this.advancedSyntaxFeatures = new ArrayList(); + } + this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); + return this; + } + + /** + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * @return advancedSyntaxFeatures + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") + + public List getAdvancedSyntaxFeatures() { + return advancedSyntaxFeatures; + } + + + public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + } + + + public IndexSettingsAsSearchParams distinct(Integer distinct) { + + this.distinct = distinct; + return this; + } + + /** + * Enables de-duplication or grouping of results. + * minimum: 0 + * maximum: 4 + * @return distinct + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + + public Integer getDistinct() { + return distinct; + } + + + public void setDistinct(Integer distinct) { + this.distinct = distinct; + } + + + public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { + + this.synonyms = synonyms; + return this; + } + + /** + * Whether to take into account an index’s synonyms for a particular search. + * @return synonyms + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") + + public Boolean getSynonyms() { + return synonyms; + } + + + public void setSynonyms(Boolean synonyms) { + this.synonyms = synonyms; + } + + + public IndexSettingsAsSearchParams replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + return this; + } + + /** + * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * @return replaceSynonymsInHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") + + public Boolean getReplaceSynonymsInHighlight() { + return replaceSynonymsInHighlight; + } + + + public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + } + + + public IndexSettingsAsSearchParams minProximity(Integer minProximity) { + + this.minProximity = minProximity; + return this; + } + + /** + * Precision of the proximity ranking criterion. + * minimum: 1 + * maximum: 7 + * @return minProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + + public Integer getMinProximity() { + return minProximity; + } + + + public void setMinProximity(Integer minProximity) { + this.minProximity = minProximity; + } + + + public IndexSettingsAsSearchParams responseFields(List responseFields) { + + this.responseFields = responseFields; + return this; + } + + public IndexSettingsAsSearchParams addResponseFieldsItem(String responseFieldsItem) { + if (this.responseFields == null) { + this.responseFields = new ArrayList(); + } + this.responseFields.add(responseFieldsItem); + return this; + } + + /** + * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * @return responseFields + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") + + public List getResponseFields() { + return responseFields; + } + + + public void setResponseFields(List responseFields) { + this.responseFields = responseFields; + } + + + public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { + + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet hits to return during a search for facet values. + * @return maxFacetHits + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") + + public Integer getMaxFacetHits() { + return maxFacetHits; + } + + + public void setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + } + + + public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + return this; + } + + /** + * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * @return attributeCriteriaComputedByMinProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") + + public Boolean getAttributeCriteriaComputedByMinProximity() { + return attributeCriteriaComputedByMinProximity; + } + + + public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + } + + + public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { + + this.renderingContent = renderingContent; + return this; + } + + /** + * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * @return renderingContent + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") + + public Object getRenderingContent() { + return renderingContent; + } + + + public void setRenderingContent(Object renderingContent) { + this.renderingContent = renderingContent; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IndexSettingsAsSearchParams indexSettingsAsSearchParams = (IndexSettingsAsSearchParams) o; + return Objects.equals(this.searchableAttributes, indexSettingsAsSearchParams.searchableAttributes) && + Objects.equals(this.attributesForFaceting, indexSettingsAsSearchParams.attributesForFaceting) && + Objects.equals(this.unretrievableAttributes, indexSettingsAsSearchParams.unretrievableAttributes) && + Objects.equals(this.attributesToRetrieve, indexSettingsAsSearchParams.attributesToRetrieve) && + Objects.equals(this.restrictSearchableAttributes, indexSettingsAsSearchParams.restrictSearchableAttributes) && + Objects.equals(this.ranking, indexSettingsAsSearchParams.ranking) && + Objects.equals(this.customRanking, indexSettingsAsSearchParams.customRanking) && + Objects.equals(this.relevancyStrictness, indexSettingsAsSearchParams.relevancyStrictness) && + Objects.equals(this.attributesToHighlight, indexSettingsAsSearchParams.attributesToHighlight) && + Objects.equals(this.attributesToSnippet, indexSettingsAsSearchParams.attributesToSnippet) && + Objects.equals(this.highlightPreTag, indexSettingsAsSearchParams.highlightPreTag) && + Objects.equals(this.highlightPostTag, indexSettingsAsSearchParams.highlightPostTag) && + Objects.equals(this.snippetEllipsisText, indexSettingsAsSearchParams.snippetEllipsisText) && + Objects.equals(this.restrictHighlightAndSnippetArrays, indexSettingsAsSearchParams.restrictHighlightAndSnippetArrays) && + Objects.equals(this.hitsPerPage, indexSettingsAsSearchParams.hitsPerPage) && + Objects.equals(this.minWordSizefor1Typo, indexSettingsAsSearchParams.minWordSizefor1Typo) && + Objects.equals(this.minWordSizefor2Typos, indexSettingsAsSearchParams.minWordSizefor2Typos) && + Objects.equals(this.typoTolerance, indexSettingsAsSearchParams.typoTolerance) && + Objects.equals(this.allowTyposOnNumericTokens, indexSettingsAsSearchParams.allowTyposOnNumericTokens) && + Objects.equals(this.disableTypoToleranceOnAttributes, indexSettingsAsSearchParams.disableTypoToleranceOnAttributes) && + Objects.equals(this.separatorsToIndex, indexSettingsAsSearchParams.separatorsToIndex) && + Objects.equals(this.ignorePlurals, indexSettingsAsSearchParams.ignorePlurals) && + Objects.equals(this.removeStopWords, indexSettingsAsSearchParams.removeStopWords) && + Objects.equals(this.keepDiacriticsOnCharacters, indexSettingsAsSearchParams.keepDiacriticsOnCharacters) && + Objects.equals(this.queryLanguages, indexSettingsAsSearchParams.queryLanguages) && + Objects.equals(this.decompoundQuery, indexSettingsAsSearchParams.decompoundQuery) && + Objects.equals(this.enableRules, indexSettingsAsSearchParams.enableRules) && + Objects.equals(this.enablePersonalization, indexSettingsAsSearchParams.enablePersonalization) && + Objects.equals(this.queryType, indexSettingsAsSearchParams.queryType) && + Objects.equals(this.removeWordsIfNoResults, indexSettingsAsSearchParams.removeWordsIfNoResults) && + Objects.equals(this.advancedSyntax, indexSettingsAsSearchParams.advancedSyntax) && + Objects.equals(this.optionalWords, indexSettingsAsSearchParams.optionalWords) && + Objects.equals(this.disableExactOnAttributes, indexSettingsAsSearchParams.disableExactOnAttributes) && + Objects.equals(this.exactOnSingleWordQuery, indexSettingsAsSearchParams.exactOnSingleWordQuery) && + Objects.equals(this.alternativesAsExact, indexSettingsAsSearchParams.alternativesAsExact) && + Objects.equals(this.advancedSyntaxFeatures, indexSettingsAsSearchParams.advancedSyntaxFeatures) && + Objects.equals(this.distinct, indexSettingsAsSearchParams.distinct) && + Objects.equals(this.synonyms, indexSettingsAsSearchParams.synonyms) && + Objects.equals(this.replaceSynonymsInHighlight, indexSettingsAsSearchParams.replaceSynonymsInHighlight) && + Objects.equals(this.minProximity, indexSettingsAsSearchParams.minProximity) && + Objects.equals(this.responseFields, indexSettingsAsSearchParams.responseFields) && + Objects.equals(this.maxFacetHits, indexSettingsAsSearchParams.maxFacetHits) && + Objects.equals(this.attributeCriteriaComputedByMinProximity, indexSettingsAsSearchParams.attributeCriteriaComputedByMinProximity) && + Objects.equals(this.renderingContent, indexSettingsAsSearchParams.renderingContent); + } + + @Override + public int hashCode() { + return Objects.hash(searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IndexSettingsAsSearchParams {\n"); + sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); + sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); + sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); + sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); + sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); + sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); + sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); + sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); + sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); + sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); + sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); + sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); + sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); + sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); + sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); + sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); + sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); + sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); + sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); + sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); + sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); + sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); + sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); + sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); + sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); + sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); + sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); + sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); + sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); + sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); + sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); + sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); + sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); + sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); + sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); + sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); + sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).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-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java new file mode 100644 index 0000000000..d99fbfd0c4 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -0,0 +1,138 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.Index; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * ListIndicesResponse + */ + +public class ListIndicesResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = null; + + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) + private Integer nbPages; + + + public ListIndicesResponse items(List items) { + + this.items = items; + return this; + } + + public ListIndicesResponse addItemsItem(Index itemsItem) { + if (this.items == null) { + this.items = new ArrayList(); + } + this.items.add(itemsItem); + return this; + } + + /** + * List of the fetched indices. + * @return items + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of the fetched indices.") + + public List getItems() { + return items; + } + + + public void setItems(List items) { + this.items = items; + } + + + public ListIndicesResponse nbPages(Integer nbPages) { + + this.nbPages = nbPages; + return this; + } + + /** + * Number of pages. + * @return nbPages + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "100", value = "Number of pages.") + + public Integer getNbPages() { + return nbPages; + } + + + public void setNbPages(Integer nbPages) { + this.nbPages = nbPages; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListIndicesResponse listIndicesResponse = (ListIndicesResponse) o; + return Objects.equals(this.items, listIndicesResponse.items) && + Objects.equals(this.nbPages, listIndicesResponse.nbPages); + } + + @Override + public int hashCode() { + return Objects.hash(items, nbPages); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListIndicesResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).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-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java new file mode 100644 index 0000000000..b24e1f6500 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -0,0 +1,261 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * MultipleQueries + */ + +public class MultipleQueries { + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) + private String indexName; + + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + /** + * Perform a search query with `default`, will search for facet values if `facet` is given. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + DEFAULT("default"), + + FACET("facet"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type = TypeEnum.DEFAULT; + + public static final String SERIALIZED_NAME_FACET = "facet"; + @SerializedName(SERIALIZED_NAME_FACET) + private String facet; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) + private String params; + + + public MultipleQueries indexName(String indexName) { + + this.indexName = indexName; + return this; + } + + /** + * The Algolia index name. + * @return indexName + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "products", required = true, value = "The Algolia index name.") + + public String getIndexName() { + return indexName; + } + + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + + + public MultipleQueries query(String query) { + + this.query = query; + return this; + } + + /** + * The text to search in the index. + * @return query + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The text to search in the index.") + + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public MultipleQueries type(TypeEnum type) { + + this.type = type; + return this; + } + + /** + * Perform a search query with `default`, will search for facet values if `facet` is given. + * @return type + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Perform a search query with `default`, will search for facet values if `facet` is given.") + + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public MultipleQueries facet(String facet) { + + this.facet = facet; + return this; + } + + /** + * The `facet` name. + * @return facet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The `facet` name.") + + public String getFacet() { + return facet; + } + + + public void setFacet(String facet) { + this.facet = facet; + } + + + public MultipleQueries params(String params) { + + this.params = params; + return this; + } + + /** + * A query string of search parameters. + * @return params + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A query string of search parameters.") + + public String getParams() { + return params; + } + + + public void setParams(String params) { + this.params = params; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultipleQueries multipleQueries = (MultipleQueries) o; + return Objects.equals(this.indexName, multipleQueries.indexName) && + Objects.equals(this.query, multipleQueries.query) && + Objects.equals(this.type, multipleQueries.type) && + Objects.equals(this.facet, multipleQueries.facet) && + Objects.equals(this.params, multipleQueries.params); + } + + @Override + public int hashCode() { + return Objects.hash(indexName, query, type, facet, params); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultipleQueries {\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).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-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java new file mode 100644 index 0000000000..f8562ac234 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -0,0 +1,182 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.MultipleQueries; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * MultipleQueriesObject + */ + +public class MultipleQueriesObject { + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + @SerializedName(SERIALIZED_NAME_REQUESTS) + private List requests = new ArrayList(); + + /** + * Gets or Sets strategy + */ + @JsonAdapter(StrategyEnum.Adapter.class) + public enum StrategyEnum { + NONE("none"), + + STOPIFENOUGHMATCHES("stopIfEnoughMatches"); + + private String value; + + StrategyEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StrategyEnum fromValue(String value) { + for (StrategyEnum b : StrategyEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StrategyEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) + private StrategyEnum strategy; + + + public MultipleQueriesObject requests(List requests) { + + this.requests = requests; + return this; + } + + public MultipleQueriesObject addRequestsItem(MultipleQueries requestsItem) { + this.requests.add(requestsItem); + return this; + } + + /** + * Get requests + * @return requests + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getRequests() { + return requests; + } + + + public void setRequests(List requests) { + this.requests = requests; + } + + + public MultipleQueriesObject strategy(StrategyEnum strategy) { + + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * @return strategy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public StrategyEnum getStrategy() { + return strategy; + } + + + public void setStrategy(StrategyEnum strategy) { + this.strategy = strategy; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultipleQueriesObject multipleQueriesObject = (MultipleQueriesObject) o; + return Objects.equals(this.requests, multipleQueriesObject.requests) && + Objects.equals(this.strategy, multipleQueriesObject.strategy); + } + + @Override + public int hashCode() { + return Objects.hash(requests, strategy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultipleQueriesObject {\n"); + sb.append(" requests: ").append(toIndentedString(requests)).append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).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-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java new file mode 100644 index 0000000000..f531ba4b4d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -0,0 +1,109 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.SearchResponse; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * MultipleQueriesResponse + */ + +public class MultipleQueriesResponse { + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + private List results = null; + + + public MultipleQueriesResponse results(List results) { + + this.results = results; + return this; + } + + public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { + if (this.results == null) { + this.results = new ArrayList(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getResults() { + return results; + } + + + public void setResults(List results) { + this.results = results; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultipleQueriesResponse multipleQueriesResponse = (MultipleQueriesResponse) o; + return Objects.equals(this.results, multipleQueriesResponse.results); + } + + @Override + public int hashCode() { + return Objects.hash(results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultipleQueriesResponse {\n"); + sb.append(" results: ").append(toIndentedString(results)).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-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java new file mode 100644 index 0000000000..7ff3742e68 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -0,0 +1,195 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Operation + */ + +public class Operation { + /** + * type of operation. + */ + @JsonAdapter(ActionEnum.Adapter.class) + public enum ActionEnum { + ADDOBJECT("addObject"), + + UPDATEOBJECT("updateObject"), + + PARTIALUPDATEOBJECT("partialUpdateObject"), + + PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"), + + DELETEOBJECT("deleteObject"), + + DELETE("delete"), + + CLEAR("clear"); + + private String value; + + ActionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionEnum fromValue(String value) { + for (ActionEnum b : ActionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionEnum action; + + public static final String SERIALIZED_NAME_BODY = "body"; + @SerializedName(SERIALIZED_NAME_BODY) + private Map body = null; + + + public Operation action(ActionEnum action) { + + this.action = action; + return this; + } + + /** + * type of operation. + * @return action + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "type of operation.") + + public ActionEnum getAction() { + return action; + } + + + public void setAction(ActionEnum action) { + this.action = action; + } + + + public Operation body(Map body) { + + this.body = body; + return this; + } + + public Operation putBodyItem(String key, Object bodyItem) { + if (this.body == null) { + this.body = new HashMap(); + } + this.body.put(key, bodyItem); + return this; + } + + /** + * arguments to the operation (depends on the type of the operation). + * @return body + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "arguments to the operation (depends on the type of the operation).") + + public Map getBody() { + return body; + } + + + public void setBody(Map body) { + this.body = body; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Operation operation = (Operation) o; + return Objects.equals(this.action, operation.action) && + Objects.equals(this.body, operation.body); + } + + @Override + public int hashCode() { + return Objects.hash(action, body); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Operation {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" body: ").append(toIndentedString(body)).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-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java new file mode 100644 index 0000000000..93c37029fb --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -0,0 +1,262 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * OperationIndexObject + */ + +public class OperationIndexObject { + /** + * Type of operation to perform (move or copy). + */ + @JsonAdapter(OperationEnum.Adapter.class) + public enum OperationEnum { + MOVE("move"), + + COPY("copy"); + + private String value; + + OperationEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OperationEnum fromValue(String value) { + for (OperationEnum b : OperationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OperationEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OperationEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) + private OperationEnum operation; + + public static final String SERIALIZED_NAME_DESTINATION = "destination"; + @SerializedName(SERIALIZED_NAME_DESTINATION) + private String destination; + + /** + * Gets or Sets scope + */ + @JsonAdapter(ScopeEnum.Adapter.class) + public enum ScopeEnum { + SETTINGS("settings"), + + SYNONYMS("synonyms"), + + RULES("rules"); + + private String value; + + ScopeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ScopeEnum fromValue(String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ScopeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ScopeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) + private List scope = null; + + + public OperationIndexObject operation(OperationEnum operation) { + + this.operation = operation; + return this; + } + + /** + * Type of operation to perform (move or copy). + * @return operation + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Type of operation to perform (move or copy).") + + public OperationEnum getOperation() { + return operation; + } + + + public void setOperation(OperationEnum operation) { + this.operation = operation; + } + + + public OperationIndexObject destination(String destination) { + + this.destination = destination; + return this; + } + + /** + * The Algolia index name. + * @return destination + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "products", required = true, value = "The Algolia index name.") + + public String getDestination() { + return destination; + } + + + public void setDestination(String destination) { + this.destination = destination; + } + + + public OperationIndexObject scope(List scope) { + + this.scope = scope; + return this; + } + + public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { + if (this.scope == null) { + this.scope = new ArrayList(); + } + this.scope.add(scopeItem); + return this; + } + + /** + * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. + * @return scope + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied.") + + public List getScope() { + return scope; + } + + + public void setScope(List scope) { + this.scope = scope; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationIndexObject operationIndexObject = (OperationIndexObject) o; + return Objects.equals(this.operation, operationIndexObject.operation) && + Objects.equals(this.destination, operationIndexObject.destination) && + Objects.equals(this.scope, operationIndexObject.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operation, destination, scope); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationIndexObject {\n"); + sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java new file mode 100644 index 0000000000..053cf38c21 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -0,0 +1,128 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.threeten.bp.OffsetDateTime; + +/** + * OperationIndexResponse + */ + +public class OperationIndexResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + + public OperationIndexResponse taskID(Integer taskID) { + + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * @return taskID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "taskID of the indexing task to wait for.") + + public Integer getTaskID() { + return taskID; + } + + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + + public OperationIndexResponse updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * @return updatedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Date of last update (ISO-8601 format).") + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OperationIndexResponse operationIndexResponse = (OperationIndexResponse) o; + return Objects.equals(this.taskID, operationIndexResponse.taskID) && + Objects.equals(this.updatedAt, operationIndexResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationIndexResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java new file mode 100644 index 0000000000..e5c689c991 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -0,0 +1,400 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.RankingInfoMatchedGeoLocation; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * RankingInfo + */ + +public class RankingInfo { + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + private Integer filters; + + public static final String SERIALIZED_NAME_FIRST_MATCHED_WORD = "firstMatchedWord"; + @SerializedName(SERIALIZED_NAME_FIRST_MATCHED_WORD) + private Integer firstMatchedWord; + + public static final String SERIALIZED_NAME_GEO_DISTANCE = "geoDistance"; + @SerializedName(SERIALIZED_NAME_GEO_DISTANCE) + private Integer geoDistance; + + public static final String SERIALIZED_NAME_GEO_PRECISION = "geoPrecision"; + @SerializedName(SERIALIZED_NAME_GEO_PRECISION) + private Integer geoPrecision; + + public static final String SERIALIZED_NAME_MATCHED_GEO_LOCATION = "matchedGeoLocation"; + @SerializedName(SERIALIZED_NAME_MATCHED_GEO_LOCATION) + private Map matchedGeoLocation = null; + + public static final String SERIALIZED_NAME_NB_EXACT_WORDS = "nbExactWords"; + @SerializedName(SERIALIZED_NAME_NB_EXACT_WORDS) + private Integer nbExactWords; + + public static final String SERIALIZED_NAME_NB_TYPOS = "nbTypos"; + @SerializedName(SERIALIZED_NAME_NB_TYPOS) + private Integer nbTypos; + + public static final String SERIALIZED_NAME_PROMOTED = "promoted"; + @SerializedName(SERIALIZED_NAME_PROMOTED) + private Boolean promoted; + + public static final String SERIALIZED_NAME_PROXIMITY_DISTANCE = "proximityDistance"; + @SerializedName(SERIALIZED_NAME_PROXIMITY_DISTANCE) + private Integer proximityDistance; + + public static final String SERIALIZED_NAME_USER_SCORE = "userScore"; + @SerializedName(SERIALIZED_NAME_USER_SCORE) + private Integer userScore; + + public static final String SERIALIZED_NAME_WORD = "word"; + @SerializedName(SERIALIZED_NAME_WORD) + private Integer word; + + + public RankingInfo filters(Integer filters) { + + this.filters = filters; + return this; + } + + /** + * This field is reserved for advanced usage. + * @return filters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This field is reserved for advanced usage.") + + public Integer getFilters() { + return filters; + } + + + public void setFilters(Integer filters) { + this.filters = filters; + } + + + public RankingInfo firstMatchedWord(Integer firstMatchedWord) { + + this.firstMatchedWord = firstMatchedWord; + return this; + } + + /** + * Position of the most important matched attribute in the attributes to index list. + * @return firstMatchedWord + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Position of the most important matched attribute in the attributes to index list.") + + public Integer getFirstMatchedWord() { + return firstMatchedWord; + } + + + public void setFirstMatchedWord(Integer firstMatchedWord) { + this.firstMatchedWord = firstMatchedWord; + } + + + public RankingInfo geoDistance(Integer geoDistance) { + + this.geoDistance = geoDistance; + return this; + } + + /** + * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + * @return geoDistance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).") + + public Integer getGeoDistance() { + return geoDistance; + } + + + public void setGeoDistance(Integer geoDistance) { + this.geoDistance = geoDistance; + } + + + public RankingInfo geoPrecision(Integer geoPrecision) { + + this.geoPrecision = geoPrecision; + return this; + } + + /** + * Precision used when computing the geo distance, in meters. + * @return geoPrecision + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision used when computing the geo distance, in meters.") + + public Integer getGeoPrecision() { + return geoPrecision; + } + + + public void setGeoPrecision(Integer geoPrecision) { + this.geoPrecision = geoPrecision; + } + + + public RankingInfo matchedGeoLocation(Map matchedGeoLocation) { + + this.matchedGeoLocation = matchedGeoLocation; + return this; + } + + public RankingInfo putMatchedGeoLocationItem(String key, RankingInfoMatchedGeoLocation matchedGeoLocationItem) { + if (this.matchedGeoLocation == null) { + this.matchedGeoLocation = new HashMap(); + } + this.matchedGeoLocation.put(key, matchedGeoLocationItem); + return this; + } + + /** + * Get matchedGeoLocation + * @return matchedGeoLocation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Map getMatchedGeoLocation() { + return matchedGeoLocation; + } + + + public void setMatchedGeoLocation(Map matchedGeoLocation) { + this.matchedGeoLocation = matchedGeoLocation; + } + + + public RankingInfo nbExactWords(Integer nbExactWords) { + + this.nbExactWords = nbExactWords; + return this; + } + + /** + * Number of exactly matched words. + * @return nbExactWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Number of exactly matched words.") + + public Integer getNbExactWords() { + return nbExactWords; + } + + + public void setNbExactWords(Integer nbExactWords) { + this.nbExactWords = nbExactWords; + } + + + public RankingInfo nbTypos(Integer nbTypos) { + + this.nbTypos = nbTypos; + return this; + } + + /** + * Number of typos encountered when matching the record. + * @return nbTypos + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Number of typos encountered when matching the record.") + + public Integer getNbTypos() { + return nbTypos; + } + + + public void setNbTypos(Integer nbTypos) { + this.nbTypos = nbTypos; + } + + + public RankingInfo promoted(Boolean promoted) { + + this.promoted = promoted; + return this; + } + + /** + * Present and set to true if a Rule promoted the hit. + * @return promoted + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Present and set to true if a Rule promoted the hit.") + + public Boolean getPromoted() { + return promoted; + } + + + public void setPromoted(Boolean promoted) { + this.promoted = promoted; + } + + + public RankingInfo proximityDistance(Integer proximityDistance) { + + this.proximityDistance = proximityDistance; + return this; + } + + /** + * When the query contains more than one word, the sum of the distances between matched words (in meters). + * @return proximityDistance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When the query contains more than one word, the sum of the distances between matched words (in meters).") + + public Integer getProximityDistance() { + return proximityDistance; + } + + + public void setProximityDistance(Integer proximityDistance) { + this.proximityDistance = proximityDistance; + } + + + public RankingInfo userScore(Integer userScore) { + + this.userScore = userScore; + return this; + } + + /** + * Custom ranking for the object, expressed as a single integer value. + * @return userScore + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Custom ranking for the object, expressed as a single integer value.") + + public Integer getUserScore() { + return userScore; + } + + + public void setUserScore(Integer userScore) { + this.userScore = userScore; + } + + + public RankingInfo word(Integer word) { + + this.word = word; + return this; + } + + /** + * Number of matched words, including prefixes and typos. + * @return word + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Number of matched words, including prefixes and typos.") + + public Integer getWord() { + return word; + } + + + public void setWord(Integer word) { + this.word = word; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RankingInfo rankingInfo = (RankingInfo) o; + return Objects.equals(this.filters, rankingInfo.filters) && + Objects.equals(this.firstMatchedWord, rankingInfo.firstMatchedWord) && + Objects.equals(this.geoDistance, rankingInfo.geoDistance) && + Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && + Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && + Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && + Objects.equals(this.nbTypos, rankingInfo.nbTypos) && + Objects.equals(this.promoted, rankingInfo.promoted) && + Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && + Objects.equals(this.userScore, rankingInfo.userScore) && + Objects.equals(this.word, rankingInfo.word); + } + + @Override + public int hashCode() { + return Objects.hash(filters, firstMatchedWord, geoDistance, geoPrecision, matchedGeoLocation, nbExactWords, nbTypos, promoted, proximityDistance, userScore, word); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RankingInfo {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" firstMatchedWord: ").append(toIndentedString(firstMatchedWord)).append("\n"); + sb.append(" geoDistance: ").append(toIndentedString(geoDistance)).append("\n"); + sb.append(" geoPrecision: ").append(toIndentedString(geoPrecision)).append("\n"); + sb.append(" matchedGeoLocation: ").append(toIndentedString(matchedGeoLocation)).append("\n"); + sb.append(" nbExactWords: ").append(toIndentedString(nbExactWords)).append("\n"); + sb.append(" nbTypos: ").append(toIndentedString(nbTypos)).append("\n"); + sb.append(" promoted: ").append(toIndentedString(promoted)).append("\n"); + sb.append(" proximityDistance: ").append(toIndentedString(proximityDistance)).append("\n"); + sb.append(" userScore: ").append(toIndentedString(userScore)).append("\n"); + sb.append(" word: ").append(toIndentedString(word)).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-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java new file mode 100644 index 0000000000..67beb5b3bc --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -0,0 +1,156 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * RankingInfoMatchedGeoLocation + */ + +public class RankingInfoMatchedGeoLocation { + public static final String SERIALIZED_NAME_LAT = "lat"; + @SerializedName(SERIALIZED_NAME_LAT) + private Double lat; + + public static final String SERIALIZED_NAME_LNG = "lng"; + @SerializedName(SERIALIZED_NAME_LNG) + private Double lng; + + public static final String SERIALIZED_NAME_DISTANCE = "distance"; + @SerializedName(SERIALIZED_NAME_DISTANCE) + private Integer distance; + + + public RankingInfoMatchedGeoLocation lat(Double lat) { + + this.lat = lat; + return this; + } + + /** + * Latitude of the matched location. + * @return lat + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Latitude of the matched location.") + + public Double getLat() { + return lat; + } + + + public void setLat(Double lat) { + this.lat = lat; + } + + + public RankingInfoMatchedGeoLocation lng(Double lng) { + + this.lng = lng; + return this; + } + + /** + * Longitude of the matched location. + * @return lng + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Longitude of the matched location.") + + public Double getLng() { + return lng; + } + + + public void setLng(Double lng) { + this.lng = lng; + } + + + public RankingInfoMatchedGeoLocation distance(Integer distance) { + + this.distance = distance; + return this; + } + + /** + * Distance between the matched location and the search location (in meters). + * @return distance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Distance between the matched location and the search location (in meters).") + + public Integer getDistance() { + return distance; + } + + + public void setDistance(Integer distance) { + this.distance = distance; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RankingInfoMatchedGeoLocation rankingInfoMatchedGeoLocation = (RankingInfoMatchedGeoLocation) o; + return Objects.equals(this.lat, rankingInfoMatchedGeoLocation.lat) && + Objects.equals(this.lng, rankingInfoMatchedGeoLocation.lng) && + Objects.equals(this.distance, rankingInfoMatchedGeoLocation.distance); + } + + @Override + public int hashCode() { + return Objects.hash(lat, lng, distance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RankingInfoMatchedGeoLocation {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" lng: ").append(toIndentedString(lng)).append("\n"); + sb.append(" distance: ").append(toIndentedString(distance)).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-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java new file mode 100644 index 0000000000..5a95b8becd --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -0,0 +1,222 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.HighlightResult; +import com.algolia.model.RankingInfo; +import com.algolia.model.SnippetResult; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * A single record. + */ +@ApiModel(description = "A single record.") + +public class Record extends HashMap { + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) + private String objectID; + + public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = "_highlightResult"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_RESULT) + private HighlightResult highlightResult; + + public static final String SERIALIZED_NAME_SNIPPET_RESULT = "_snippetResult"; + @SerializedName(SERIALIZED_NAME_SNIPPET_RESULT) + private SnippetResult snippetResult; + + public static final String SERIALIZED_NAME_RANKING_INFO = "_rankingInfo"; + @SerializedName(SERIALIZED_NAME_RANKING_INFO) + private RankingInfo rankingInfo; + + public static final String SERIALIZED_NAME_DISTINCT_SEQ_I_D = "_distinctSeqID"; + @SerializedName(SERIALIZED_NAME_DISTINCT_SEQ_I_D) + private Integer distinctSeqID; + + + public Record objectID(String objectID) { + + this.objectID = objectID; + return this; + } + + /** + * Unique identifier of the object. + * @return objectID + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Unique identifier of the object.") + + public String getObjectID() { + return objectID; + } + + + public void setObjectID(String objectID) { + this.objectID = objectID; + } + + + public Record highlightResult(HighlightResult highlightResult) { + + this.highlightResult = highlightResult; + return this; + } + + /** + * Get highlightResult + * @return highlightResult + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public HighlightResult getHighlightResult() { + return highlightResult; + } + + + public void setHighlightResult(HighlightResult highlightResult) { + this.highlightResult = highlightResult; + } + + + public Record snippetResult(SnippetResult snippetResult) { + + this.snippetResult = snippetResult; + return this; + } + + /** + * Get snippetResult + * @return snippetResult + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public SnippetResult getSnippetResult() { + return snippetResult; + } + + + public void setSnippetResult(SnippetResult snippetResult) { + this.snippetResult = snippetResult; + } + + + public Record rankingInfo(RankingInfo rankingInfo) { + + this.rankingInfo = rankingInfo; + return this; + } + + /** + * Get rankingInfo + * @return rankingInfo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public RankingInfo getRankingInfo() { + return rankingInfo; + } + + + public void setRankingInfo(RankingInfo rankingInfo) { + this.rankingInfo = rankingInfo; + } + + + public Record distinctSeqID(Integer distinctSeqID) { + + this.distinctSeqID = distinctSeqID; + return this; + } + + /** + * Get distinctSeqID + * @return distinctSeqID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public Integer getDistinctSeqID() { + return distinctSeqID; + } + + + public void setDistinctSeqID(Integer distinctSeqID) { + this.distinctSeqID = distinctSeqID; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Record record = (Record) o; + return Objects.equals(this.objectID, record.objectID) && + Objects.equals(this.highlightResult, record.highlightResult) && + Objects.equals(this.snippetResult, record.snippetResult) && + Objects.equals(this.rankingInfo, record.rankingInfo) && + Objects.equals(this.distinctSeqID, record.distinctSeqID) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(objectID, highlightResult, snippetResult, rankingInfo, distinctSeqID, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Record {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append(" highlightResult: ").append(toIndentedString(highlightResult)).append("\n"); + sb.append(" snippetResult: ").append(toIndentedString(snippetResult)).append("\n"); + sb.append(" rankingInfo: ").append(toIndentedString(rankingInfo)).append("\n"); + sb.append(" distinctSeqID: ").append(toIndentedString(distinctSeqID)).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-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java new file mode 100644 index 0000000000..b2882a6625 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -0,0 +1,156 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * SaveObjectResponse + */ + +public class SaveObjectResponse { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private String createdAt; + + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) + private String objectID; + + + public SaveObjectResponse createdAt(String createdAt) { + + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getCreatedAt() { + return createdAt; + } + + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + + public SaveObjectResponse taskID(Integer taskID) { + + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * @return taskID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "taskID of the indexing task to wait for.") + + public Integer getTaskID() { + return taskID; + } + + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + + public SaveObjectResponse objectID(String objectID) { + + this.objectID = objectID; + return this; + } + + /** + * Unique identifier of the object. + * @return objectID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Unique identifier of the object.") + + public String getObjectID() { + return objectID; + } + + + public void setObjectID(String objectID) { + this.objectID = objectID; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaveObjectResponse saveObjectResponse = (SaveObjectResponse) o; + return Objects.equals(this.createdAt, saveObjectResponse.createdAt) && + Objects.equals(this.taskID, saveObjectResponse.taskID) && + Objects.equals(this.objectID, saveObjectResponse.objectID); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, taskID, objectID); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaveObjectResponse {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).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-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java new file mode 100644 index 0000000000..bc2e2d0eaa --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -0,0 +1,109 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.Record; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * SearchHits + */ + +public class SearchHits { + public static final String SERIALIZED_NAME_HITS = "hits"; + @SerializedName(SERIALIZED_NAME_HITS) + private List hits = null; + + + public SearchHits hits(List hits) { + + this.hits = hits; + return this; + } + + public SearchHits addHitsItem(Record hitsItem) { + if (this.hits == null) { + this.hits = new ArrayList(); + } + this.hits.add(hitsItem); + return this; + } + + /** + * Get hits + * @return hits + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getHits() { + return hits; + } + + + public void setHits(List hits) { + this.hits = hits; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchHits searchHits = (SearchHits) o; + return Objects.equals(this.hits, searchHits.hits); + } + + @Override + public int hashCode() { + return Objects.hash(hits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchHits {\n"); + sb.append(" hits: ").append(toIndentedString(hits)).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-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java new file mode 100644 index 0000000000..f2129a0c94 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -0,0 +1,2818 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.BaseSearchParams; +import com.algolia.model.IndexSettingsAsSearchParams; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * SearchParams + */ + +public class SearchParams { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) + private String similarQuery = ""; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + private String filters = ""; + + public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) + private List facetFilters = null; + + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = "optionalFilters"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) + private List optionalFilters = null; + + public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) + private List numericFilters = null; + + public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) + private List tagFilters = null; + + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) + private Boolean sumOrFiltersScores = false; + + public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) + private List facets = null; + + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) + private Integer maxValuesPerFacet = 100; + + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) + private Boolean facetingAfterDistinct = false; + + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) + private String sortFacetValuesBy = "count"; + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + private Integer page = 0; + + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) + private Integer offset; + + public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) + private Integer length; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + private String aroundLatLng = ""; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) + private Boolean aroundLatLngViaIP = false; + + public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) + private Integer aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = "aroundPrecision"; + @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) + private Integer aroundPrecision = 10; + + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) + private Integer minimumAroundRadius; + + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) + private List insideBoundingBox = null; + + public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) + private List insidePolygon = null; + + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) + private List naturalLanguages = null; + + public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) + private List ruleContexts = null; + + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) + private Integer personalizationImpact = 100; + + public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + @SerializedName(SERIALIZED_NAME_USER_TOKEN) + private String userToken; + + public static final String SERIALIZED_NAME_GET_RANKING_INFO = "getRankingInfo"; + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) + private Boolean getRankingInfo = false; + + public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) + private Boolean clickAnalytics = false; + + public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + @SerializedName(SERIALIZED_NAME_ANALYTICS) + private Boolean analytics = true; + + public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) + private List analyticsTags = null; + + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) + private Boolean percentileComputation = true; + + public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) + private Boolean enableABTest = true; + + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) + private Boolean enableReRanking = true; + + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) + private List searchableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) + private List attributesForFaceting = null; + + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) + private List unretrievableAttributes = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) + private List attributesToRetrieve = null; + + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) + private List restrictSearchableAttributes = null; + + public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) + private List ranking = null; + + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + private List customRanking = null; + + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) + private Integer relevancyStrictness = 100; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) + private List attributesToHighlight = null; + + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) + private List attributesToSnippet = null; + + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) + private String highlightPreTag = ""; + + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) + private String highlightPostTag = ""; + + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) + private String snippetEllipsisText = "…"; + + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + private Boolean restrictHighlightAndSnippetArrays = false; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) + private Integer minWordSizefor1Typo = 4; + + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) + private Integer minWordSizefor2Typos = 8; + + /** + * Controls whether typo tolerance is enabled and how it is applied. + */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) + public enum TypoToleranceEnum { + TRUE("true"), + + FALSE("false"), + + MIN("min"), + + STRICT("strict"); + + private String value; + + TypoToleranceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypoToleranceEnum fromValue(String value) { + for (TypoToleranceEnum b : TypoToleranceEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; + + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + private Boolean allowTyposOnNumericTokens = true; + + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + private List disableTypoToleranceOnAttributes = null; + + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) + private String separatorsToIndex = ""; + + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + private String ignorePlurals = "false"; + + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) + private String removeStopWords = "false"; + + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) + private String keepDiacriticsOnCharacters = ""; + + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + private List queryLanguages = null; + + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + private Boolean decompoundQuery = true; + + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + private Boolean enableRules = true; + + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) + private Boolean enablePersonalization = false; + + /** + * Controls if and how query words are interpreted as prefixes. + */ + @JsonAdapter(QueryTypeEnum.Adapter.class) + public enum QueryTypeEnum { + PREFIXLAST("prefixLast"), + + PREFIXALL("prefixAll"), + + PREFIXNONE("prefixNone"); + + private String value; + + QueryTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static QueryTypeEnum fromValue(String value) { + for (QueryTypeEnum b : QueryTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) + public enum RemoveWordsIfNoResultsEnum { + NONE("none"), + + LASTWORDS("lastWords"), + + FIRSTWORDS("firstWords"), + + ALLOPTIONAL("allOptional"); + + private String value; + + RemoveWordsIfNoResultsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RemoveWordsIfNoResultsEnum fromValue(String value) { + for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + private Boolean advancedSyntax = false; + + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + private List optionalWords = null; + + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) + private List disableExactOnAttributes = null; + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) + public enum ExactOnSingleWordQueryEnum { + ATTRIBUTE("attribute"), + + NONE("none"), + + WORD("word"); + + private String value; + + ExactOnSingleWordQueryEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ExactOnSingleWordQueryEnum fromValue(String value) { + for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + + /** + * Gets or Sets alternativesAsExact + */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) + public enum AlternativesAsExactEnum { + IGNOREPLURALS("ignorePlurals"), + + SINGLEWORDSYNONYM("singleWordSynonym"), + + MULTIWORDSSYNONYM("multiWordsSynonym"); + + private String value; + + AlternativesAsExactEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AlternativesAsExactEnum fromValue(String value) { + for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) + private List alternativesAsExact = null; + + /** + * Gets or Sets advancedSyntaxFeatures + */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) + public enum AdvancedSyntaxFeaturesEnum { + EXACTPHRASE("exactPhrase"), + + EXCLUDEWORDS("excludeWords"); + + private String value; + + AdvancedSyntaxFeaturesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AdvancedSyntaxFeaturesEnum fromValue(String value) { + for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) + private List advancedSyntaxFeatures = null; + + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) + private Integer distinct = 0; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private Boolean synonyms = true; + + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) + private Boolean replaceSynonymsInHighlight = false; + + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + private Integer minProximity = 1; + + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + private List responseFields = null; + + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + private Integer maxFacetHits = 10; + + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + private Boolean attributeCriteriaComputedByMinProximity = false; + + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) + private Object renderingContent; + + + public SearchParams query(String query) { + + this.query = query; + return this; + } + + /** + * The text to search in the index. + * @return query + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The text to search in the index.") + + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public SearchParams similarQuery(String similarQuery) { + + this.similarQuery = similarQuery; + return this; + } + + /** + * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. + * @return similarQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.") + + public String getSimilarQuery() { + return similarQuery; + } + + + public void setSimilarQuery(String similarQuery) { + this.similarQuery = similarQuery; + } + + + public SearchParams filters(String filters) { + + this.filters = filters; + return this; + } + + /** + * Filter the query with numeric, facet and/or tag filters. + * @return filters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter the query with numeric, facet and/or tag filters.") + + public String getFilters() { + return filters; + } + + + public void setFilters(String filters) { + this.filters = filters; + } + + + public SearchParams facetFilters(List facetFilters) { + + this.facetFilters = facetFilters; + return this; + } + + public SearchParams addFacetFiltersItem(String facetFiltersItem) { + if (this.facetFilters == null) { + this.facetFilters = new ArrayList(); + } + this.facetFilters.add(facetFiltersItem); + return this; + } + + /** + * Filter hits by facet value. + * @return facetFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter hits by facet value.") + + public List getFacetFilters() { + return facetFilters; + } + + + public void setFacetFilters(List facetFilters) { + this.facetFilters = facetFilters; + } + + + public SearchParams optionalFilters(List optionalFilters) { + + this.optionalFilters = optionalFilters; + return this; + } + + public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { + if (this.optionalFilters == null) { + this.optionalFilters = new ArrayList(); + } + this.optionalFilters.add(optionalFiltersItem); + return this; + } + + /** + * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + * @return optionalFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.") + + public List getOptionalFilters() { + return optionalFilters; + } + + + public void setOptionalFilters(List optionalFilters) { + this.optionalFilters = optionalFilters; + } + + + public SearchParams numericFilters(List numericFilters) { + + this.numericFilters = numericFilters; + return this; + } + + public SearchParams addNumericFiltersItem(String numericFiltersItem) { + if (this.numericFilters == null) { + this.numericFilters = new ArrayList(); + } + this.numericFilters.add(numericFiltersItem); + return this; + } + + /** + * Filter on numeric attributes. + * @return numericFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter on numeric attributes.") + + public List getNumericFilters() { + return numericFilters; + } + + + public void setNumericFilters(List numericFilters) { + this.numericFilters = numericFilters; + } + + + public SearchParams tagFilters(List tagFilters) { + + this.tagFilters = tagFilters; + return this; + } + + public SearchParams addTagFiltersItem(String tagFiltersItem) { + if (this.tagFilters == null) { + this.tagFilters = new ArrayList(); + } + this.tagFilters.add(tagFiltersItem); + return this; + } + + /** + * Filter hits by tags. + * @return tagFilters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Filter hits by tags.") + + public List getTagFilters() { + return tagFilters; + } + + + public void setTagFilters(List tagFilters) { + this.tagFilters = tagFilters; + } + + + public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { + + this.sumOrFiltersScores = sumOrFiltersScores; + return this; + } + + /** + * Determines how to calculate the total score for filtering. + * @return sumOrFiltersScores + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Determines how to calculate the total score for filtering.") + + public Boolean getSumOrFiltersScores() { + return sumOrFiltersScores; + } + + + public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { + this.sumOrFiltersScores = sumOrFiltersScores; + } + + + public SearchParams facets(List facets) { + + this.facets = facets; + return this; + } + + public SearchParams addFacetsItem(String facetsItem) { + if (this.facets == null) { + this.facets = new ArrayList(); + } + this.facets.add(facetsItem); + return this; + } + + /** + * Retrieve facets and their facet values. + * @return facets + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Retrieve facets and their facet values.") + + public List getFacets() { + return facets; + } + + + public void setFacets(List facets) { + this.facets = facets; + } + + + public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { + + this.maxValuesPerFacet = maxValuesPerFacet; + return this; + } + + /** + * Maximum number of facet values to return for each facet during a regular search. + * @return maxValuesPerFacet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Maximum number of facet values to return for each facet during a regular search.") + + public Integer getMaxValuesPerFacet() { + return maxValuesPerFacet; + } + + + public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { + this.maxValuesPerFacet = maxValuesPerFacet; + } + + + public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { + + this.facetingAfterDistinct = facetingAfterDistinct; + return this; + } + + /** + * Force faceting to be applied after de-duplication (via the Distinct setting). + * @return facetingAfterDistinct + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Force faceting to be applied after de-duplication (via the Distinct setting).") + + public Boolean getFacetingAfterDistinct() { + return facetingAfterDistinct; + } + + + public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { + this.facetingAfterDistinct = facetingAfterDistinct; + } + + + public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { + + this.sortFacetValuesBy = sortFacetValuesBy; + return this; + } + + /** + * Controls how facet values are fetched. + * @return sortFacetValuesBy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how facet values are fetched.") + + public String getSortFacetValuesBy() { + return sortFacetValuesBy; + } + + + public void setSortFacetValuesBy(String sortFacetValuesBy) { + this.sortFacetValuesBy = sortFacetValuesBy; + } + + + public SearchParams page(Integer page) { + + this.page = page; + return this; + } + + /** + * Specify the page to retrieve. + * @return page + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify the page to retrieve.") + + public Integer getPage() { + return page; + } + + + public void setPage(Integer page) { + this.page = page; + } + + + public SearchParams offset(Integer offset) { + + this.offset = offset; + return this; + } + + /** + * Specify the offset of the first hit to return. + * @return offset + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specify the offset of the first hit to return.") + + public Integer getOffset() { + return offset; + } + + + public void setOffset(Integer offset) { + this.offset = offset; + } + + + public SearchParams length(Integer length) { + + this.length = length; + return this; + } + + /** + * Set the number of hits to retrieve (used only with offset). + * minimum: 1 + * maximum: 1000 + * @return length + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the number of hits to retrieve (used only with offset).") + + public Integer getLength() { + return length; + } + + + public void setLength(Integer length) { + this.length = length; + } + + + public SearchParams aroundLatLng(String aroundLatLng) { + + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * Search for entries around a central geolocation, enabling a geo search within a circular area. + * @return aroundLatLng + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search for entries around a central geolocation, enabling a geo search within a circular area.") + + public String getAroundLatLng() { + return aroundLatLng; + } + + + public void setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + } + + + public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { + + this.aroundLatLngViaIP = aroundLatLngViaIP; + return this; + } + + /** + * Search for entries around a given location automatically computed from the requester’s IP address. + * @return aroundLatLngViaIP + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search for entries around a given location automatically computed from the requester’s IP address.") + + public Boolean getAroundLatLngViaIP() { + return aroundLatLngViaIP; + } + + + public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { + this.aroundLatLngViaIP = aroundLatLngViaIP; + } + + + public SearchParams aroundRadius(Integer aroundRadius) { + + this.aroundRadius = aroundRadius; + return this; + } + + /** + * Define the maximum radius for a geo search (in meters). + * @return aroundRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Define the maximum radius for a geo search (in meters).") + + public Integer getAroundRadius() { + return aroundRadius; + } + + + public void setAroundRadius(Integer aroundRadius) { + this.aroundRadius = aroundRadius; + } + + + public SearchParams aroundPrecision(Integer aroundPrecision) { + + this.aroundPrecision = aroundPrecision; + return this; + } + + /** + * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. + * @return aroundPrecision + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula.") + + public Integer getAroundPrecision() { + return aroundPrecision; + } + + + public void setAroundPrecision(Integer aroundPrecision) { + this.aroundPrecision = aroundPrecision; + } + + + public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { + + this.minimumAroundRadius = minimumAroundRadius; + return this; + } + + /** + * Minimum radius (in meters) used for a geo search when aroundRadius is not set. + * minimum: 1 + * @return minimumAroundRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set.") + + public Integer getMinimumAroundRadius() { + return minimumAroundRadius; + } + + + public void setMinimumAroundRadius(Integer minimumAroundRadius) { + this.minimumAroundRadius = minimumAroundRadius; + } + + + public SearchParams insideBoundingBox(List insideBoundingBox) { + + this.insideBoundingBox = insideBoundingBox; + return this; + } + + public SearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { + if (this.insideBoundingBox == null) { + this.insideBoundingBox = new ArrayList(); + } + this.insideBoundingBox.add(insideBoundingBoxItem); + return this; + } + + /** + * Search inside a rectangular area (in geo coordinates). + * @return insideBoundingBox + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search inside a rectangular area (in geo coordinates).") + + public List getInsideBoundingBox() { + return insideBoundingBox; + } + + + public void setInsideBoundingBox(List insideBoundingBox) { + this.insideBoundingBox = insideBoundingBox; + } + + + public SearchParams insidePolygon(List insidePolygon) { + + this.insidePolygon = insidePolygon; + return this; + } + + public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { + if (this.insidePolygon == null) { + this.insidePolygon = new ArrayList(); + } + this.insidePolygon.add(insidePolygonItem); + return this; + } + + /** + * Search inside a polygon (in geo coordinates). + * @return insidePolygon + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") + + public List getInsidePolygon() { + return insidePolygon; + } + + + public void setInsidePolygon(List insidePolygon) { + this.insidePolygon = insidePolygon; + } + + + public SearchParams naturalLanguages(List naturalLanguages) { + + this.naturalLanguages = naturalLanguages; + return this; + } + + public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { + if (this.naturalLanguages == null) { + this.naturalLanguages = new ArrayList(); + } + this.naturalLanguages.add(naturalLanguagesItem); + return this; + } + + /** + * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * @return naturalLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.") + + public List getNaturalLanguages() { + return naturalLanguages; + } + + + public void setNaturalLanguages(List naturalLanguages) { + this.naturalLanguages = naturalLanguages; + } + + + public SearchParams ruleContexts(List ruleContexts) { + + this.ruleContexts = ruleContexts; + return this; + } + + public SearchParams addRuleContextsItem(String ruleContextsItem) { + if (this.ruleContexts == null) { + this.ruleContexts = new ArrayList(); + } + this.ruleContexts.add(ruleContextsItem); + return this; + } + + /** + * Enables contextual rules. + * @return ruleContexts + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables contextual rules.") + + public List getRuleContexts() { + return ruleContexts; + } + + + public void setRuleContexts(List ruleContexts) { + this.ruleContexts = ruleContexts; + } + + + public SearchParams personalizationImpact(Integer personalizationImpact) { + + this.personalizationImpact = personalizationImpact; + return this; + } + + /** + * Define the impact of the Personalization feature. + * @return personalizationImpact + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Define the impact of the Personalization feature.") + + public Integer getPersonalizationImpact() { + return personalizationImpact; + } + + + public void setPersonalizationImpact(Integer personalizationImpact) { + this.personalizationImpact = personalizationImpact; + } + + + public SearchParams userToken(String userToken) { + + this.userToken = userToken; + return this; + } + + /** + * Associates a certain user token with the current search. + * @return userToken + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Associates a certain user token with the current search.") + + public String getUserToken() { + return userToken; + } + + + public void setUserToken(String userToken) { + this.userToken = userToken; + } + + + public SearchParams getRankingInfo(Boolean getRankingInfo) { + + this.getRankingInfo = getRankingInfo; + return this; + } + + /** + * Retrieve detailed ranking information. + * @return getRankingInfo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Retrieve detailed ranking information.") + + public Boolean getGetRankingInfo() { + return getRankingInfo; + } + + + public void setGetRankingInfo(Boolean getRankingInfo) { + this.getRankingInfo = getRankingInfo; + } + + + public SearchParams clickAnalytics(Boolean clickAnalytics) { + + this.clickAnalytics = clickAnalytics; + return this; + } + + /** + * Enable the Click Analytics feature. + * @return clickAnalytics + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enable the Click Analytics feature.") + + public Boolean getClickAnalytics() { + return clickAnalytics; + } + + + public void setClickAnalytics(Boolean clickAnalytics) { + this.clickAnalytics = clickAnalytics; + } + + + public SearchParams analytics(Boolean analytics) { + + this.analytics = analytics; + return this; + } + + /** + * Whether the current query will be taken into account in the Analytics. + * @return analytics + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the current query will be taken into account in the Analytics.") + + public Boolean getAnalytics() { + return analytics; + } + + + public void setAnalytics(Boolean analytics) { + this.analytics = analytics; + } + + + public SearchParams analyticsTags(List analyticsTags) { + + this.analyticsTags = analyticsTags; + return this; + } + + public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { + if (this.analyticsTags == null) { + this.analyticsTags = new ArrayList(); + } + this.analyticsTags.add(analyticsTagsItem); + return this; + } + + /** + * List of tags to apply to the query for analytics purposes. + * @return analyticsTags + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of tags to apply to the query for analytics purposes.") + + public List getAnalyticsTags() { + return analyticsTags; + } + + + public void setAnalyticsTags(List analyticsTags) { + this.analyticsTags = analyticsTags; + } + + + public SearchParams percentileComputation(Boolean percentileComputation) { + + this.percentileComputation = percentileComputation; + return this; + } + + /** + * Whether to include or exclude a query from the processing-time percentile computation. + * @return percentileComputation + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to include or exclude a query from the processing-time percentile computation.") + + public Boolean getPercentileComputation() { + return percentileComputation; + } + + + public void setPercentileComputation(Boolean percentileComputation) { + this.percentileComputation = percentileComputation; + } + + + public SearchParams enableABTest(Boolean enableABTest) { + + this.enableABTest = enableABTest; + return this; + } + + /** + * Whether this search should participate in running AB tests. + * @return enableABTest + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether this search should participate in running AB tests.") + + public Boolean getEnableABTest() { + return enableABTest; + } + + + public void setEnableABTest(Boolean enableABTest) { + this.enableABTest = enableABTest; + } + + + public SearchParams enableReRanking(Boolean enableReRanking) { + + this.enableReRanking = enableReRanking; + return this; + } + + /** + * Whether this search should use AI Re-Ranking. + * @return enableReRanking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") + + public Boolean getEnableReRanking() { + return enableReRanking; + } + + + public void setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + } + + + public SearchParams searchableAttributes(List searchableAttributes) { + + this.searchableAttributes = searchableAttributes; + return this; + } + + public SearchParams addSearchableAttributesItem(String searchableAttributesItem) { + if (this.searchableAttributes == null) { + this.searchableAttributes = new ArrayList(); + } + this.searchableAttributes.add(searchableAttributesItem); + return this; + } + + /** + * The complete list of attributes used for searching. + * @return searchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes used for searching.") + + public List getSearchableAttributes() { + return searchableAttributes; + } + + + public void setSearchableAttributes(List searchableAttributes) { + this.searchableAttributes = searchableAttributes; + } + + + public SearchParams attributesForFaceting(List attributesForFaceting) { + + this.attributesForFaceting = attributesForFaceting; + return this; + } + + public SearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { + if (this.attributesForFaceting == null) { + this.attributesForFaceting = new ArrayList(); + } + this.attributesForFaceting.add(attributesForFacetingItem); + return this; + } + + /** + * The complete list of attributes that will be used for faceting. + * @return attributesForFaceting + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") + + public List getAttributesForFaceting() { + return attributesForFaceting; + } + + + public void setAttributesForFaceting(List attributesForFaceting) { + this.attributesForFaceting = attributesForFaceting; + } + + + public SearchParams unretrievableAttributes(List unretrievableAttributes) { + + this.unretrievableAttributes = unretrievableAttributes; + return this; + } + + public SearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { + if (this.unretrievableAttributes == null) { + this.unretrievableAttributes = new ArrayList(); + } + this.unretrievableAttributes.add(unretrievableAttributesItem); + return this; + } + + /** + * List of attributes that can’t be retrieved at query time. + * @return unretrievableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") + + public List getUnretrievableAttributes() { + return unretrievableAttributes; + } + + + public void setUnretrievableAttributes(List unretrievableAttributes) { + this.unretrievableAttributes = unretrievableAttributes; + } + + + public SearchParams attributesToRetrieve(List attributesToRetrieve) { + + this.attributesToRetrieve = attributesToRetrieve; + return this; + } + + public SearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { + if (this.attributesToRetrieve == null) { + this.attributesToRetrieve = new ArrayList(); + } + this.attributesToRetrieve.add(attributesToRetrieveItem); + return this; + } + + /** + * This parameter controls which attributes to retrieve and which not to retrieve. + * @return attributesToRetrieve + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") + + public List getAttributesToRetrieve() { + return attributesToRetrieve; + } + + + public void setAttributesToRetrieve(List attributesToRetrieve) { + this.attributesToRetrieve = attributesToRetrieve; + } + + + public SearchParams restrictSearchableAttributes(List restrictSearchableAttributes) { + + this.restrictSearchableAttributes = restrictSearchableAttributes; + return this; + } + + public SearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + if (this.restrictSearchableAttributes == null) { + this.restrictSearchableAttributes = new ArrayList(); + } + this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); + return this; + } + + /** + * Restricts a given query to look in only a subset of your searchable attributes. + * @return restrictSearchableAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") + + public List getRestrictSearchableAttributes() { + return restrictSearchableAttributes; + } + + + public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + this.restrictSearchableAttributes = restrictSearchableAttributes; + } + + + public SearchParams ranking(List ranking) { + + this.ranking = ranking; + return this; + } + + public SearchParams addRankingItem(String rankingItem) { + if (this.ranking == null) { + this.ranking = new ArrayList(); + } + this.ranking.add(rankingItem); + return this; + } + + /** + * Controls how Algolia should sort your results. + * @return ranking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how Algolia should sort your results.") + + public List getRanking() { + return ranking; + } + + + public void setRanking(List ranking) { + this.ranking = ranking; + } + + + public SearchParams customRanking(List customRanking) { + + this.customRanking = customRanking; + return this; + } + + public SearchParams addCustomRankingItem(String customRankingItem) { + if (this.customRanking == null) { + this.customRanking = new ArrayList(); + } + this.customRanking.add(customRankingItem); + return this; + } + + /** + * Specifies the custom ranking criterion. + * @return customRanking + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Specifies the custom ranking criterion.") + + public List getCustomRanking() { + return customRanking; + } + + + public void setCustomRanking(List customRanking) { + this.customRanking = customRanking; + } + + + public SearchParams relevancyStrictness(Integer relevancyStrictness) { + + this.relevancyStrictness = relevancyStrictness; + return this; + } + + /** + * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * @return relevancyStrictness + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") + + public Integer getRelevancyStrictness() { + return relevancyStrictness; + } + + + public void setRelevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + } + + + public SearchParams attributesToHighlight(List attributesToHighlight) { + + this.attributesToHighlight = attributesToHighlight; + return this; + } + + public SearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { + if (this.attributesToHighlight == null) { + this.attributesToHighlight = new ArrayList(); + } + this.attributesToHighlight.add(attributesToHighlightItem); + return this; + } + + /** + * List of attributes to highlight. + * @return attributesToHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to highlight.") + + public List getAttributesToHighlight() { + return attributesToHighlight; + } + + + public void setAttributesToHighlight(List attributesToHighlight) { + this.attributesToHighlight = attributesToHighlight; + } + + + public SearchParams attributesToSnippet(List attributesToSnippet) { + + this.attributesToSnippet = attributesToSnippet; + return this; + } + + public SearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { + if (this.attributesToSnippet == null) { + this.attributesToSnippet = new ArrayList(); + } + this.attributesToSnippet.add(attributesToSnippetItem); + return this; + } + + /** + * List of attributes to snippet, with an optional maximum number of words to snippet. + * @return attributesToSnippet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") + + public List getAttributesToSnippet() { + return attributesToSnippet; + } + + + public void setAttributesToSnippet(List attributesToSnippet) { + this.attributesToSnippet = attributesToSnippet; + } + + + public SearchParams highlightPreTag(String highlightPreTag) { + + this.highlightPreTag = highlightPreTag; + return this; + } + + /** + * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * @return highlightPreTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") + + public String getHighlightPreTag() { + return highlightPreTag; + } + + + public void setHighlightPreTag(String highlightPreTag) { + this.highlightPreTag = highlightPreTag; + } + + + public SearchParams highlightPostTag(String highlightPostTag) { + + this.highlightPostTag = highlightPostTag; + return this; + } + + /** + * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * @return highlightPostTag + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") + + public String getHighlightPostTag() { + return highlightPostTag; + } + + + public void setHighlightPostTag(String highlightPostTag) { + this.highlightPostTag = highlightPostTag; + } + + + public SearchParams snippetEllipsisText(String snippetEllipsisText) { + + this.snippetEllipsisText = snippetEllipsisText; + return this; + } + + /** + * String used as an ellipsis indicator when a snippet is truncated. + * @return snippetEllipsisText + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") + + public String getSnippetEllipsisText() { + return snippetEllipsisText; + } + + + public void setSnippetEllipsisText(String snippetEllipsisText) { + this.snippetEllipsisText = snippetEllipsisText; + } + + + public SearchParams restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + return this; + } + + /** + * Restrict highlighting and snippeting to items that matched the query. + * @return restrictHighlightAndSnippetArrays + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") + + public Boolean getRestrictHighlightAndSnippetArrays() { + return restrictHighlightAndSnippetArrays; + } + + + public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + } + + + public SearchParams hitsPerPage(Integer hitsPerPage) { + + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * @return hitsPerPage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Set the number of hits per page.") + + public Integer getHitsPerPage() { + return hitsPerPage; + } + + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + + public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { + + this.minWordSizefor1Typo = minWordSizefor1Typo; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * @return minWordSizefor1Typo + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") + + public Integer getMinWordSizefor1Typo() { + return minWordSizefor1Typo; + } + + + public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { + this.minWordSizefor1Typo = minWordSizefor1Typo; + } + + + public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { + + this.minWordSizefor2Typos = minWordSizefor2Typos; + return this; + } + + /** + * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * @return minWordSizefor2Typos + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") + + public Integer getMinWordSizefor2Typos() { + return minWordSizefor2Typos; + } + + + public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { + this.minWordSizefor2Typos = minWordSizefor2Typos; + } + + + public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { + + this.typoTolerance = typoTolerance; + return this; + } + + /** + * Controls whether typo tolerance is enabled and how it is applied. + * @return typoTolerance + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") + + public TypoToleranceEnum getTypoTolerance() { + return typoTolerance; + } + + + public void setTypoTolerance(TypoToleranceEnum typoTolerance) { + this.typoTolerance = typoTolerance; + } + + + public SearchParams allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + return this; + } + + /** + * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * @return allowTyposOnNumericTokens + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") + + public Boolean getAllowTyposOnNumericTokens() { + return allowTyposOnNumericTokens; + } + + + public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { + this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; + } + + + public SearchParams disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + return this; + } + + public SearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + if (this.disableTypoToleranceOnAttributes == null) { + this.disableTypoToleranceOnAttributes = new ArrayList(); + } + this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable typo tolerance. + * @return disableTypoToleranceOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") + + public List getDisableTypoToleranceOnAttributes() { + return disableTypoToleranceOnAttributes; + } + + + public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + } + + + public SearchParams separatorsToIndex(String separatorsToIndex) { + + this.separatorsToIndex = separatorsToIndex; + return this; + } + + /** + * Control which separators are indexed. + * @return separatorsToIndex + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Control which separators are indexed.") + + public String getSeparatorsToIndex() { + return separatorsToIndex; + } + + + public void setSeparatorsToIndex(String separatorsToIndex) { + this.separatorsToIndex = separatorsToIndex; + } + + + public SearchParams ignorePlurals(String ignorePlurals) { + + this.ignorePlurals = ignorePlurals; + return this; + } + + /** + * Treats singular, plurals, and other forms of declensions as matching terms. + * @return ignorePlurals + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") + + public String getIgnorePlurals() { + return ignorePlurals; + } + + + public void setIgnorePlurals(String ignorePlurals) { + this.ignorePlurals = ignorePlurals; + } + + + public SearchParams removeStopWords(String removeStopWords) { + + this.removeStopWords = removeStopWords; + return this; + } + + /** + * Removes stop (common) words from the query before executing it. + * @return removeStopWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") + + public String getRemoveStopWords() { + return removeStopWords; + } + + + public void setRemoveStopWords(String removeStopWords) { + this.removeStopWords = removeStopWords; + } + + + public SearchParams keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + return this; + } + + /** + * List of characters that the engine shouldn’t automatically normalize. + * @return keepDiacriticsOnCharacters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") + + public String getKeepDiacriticsOnCharacters() { + return keepDiacriticsOnCharacters; + } + + + public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { + this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; + } + + + public SearchParams queryLanguages(List queryLanguages) { + + this.queryLanguages = queryLanguages; + return this; + } + + public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { + if (this.queryLanguages == null) { + this.queryLanguages = new ArrayList(); + } + this.queryLanguages.add(queryLanguagesItem); + return this; + } + + /** + * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * @return queryLanguages + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") + + public List getQueryLanguages() { + return queryLanguages; + } + + + public void setQueryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + } + + + public SearchParams decompoundQuery(Boolean decompoundQuery) { + + this.decompoundQuery = decompoundQuery; + return this; + } + + /** + * Splits compound words into their composing atoms in the query. + * @return decompoundQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") + + public Boolean getDecompoundQuery() { + return decompoundQuery; + } + + + public void setDecompoundQuery(Boolean decompoundQuery) { + this.decompoundQuery = decompoundQuery; + } + + + public SearchParams enableRules(Boolean enableRules) { + + this.enableRules = enableRules; + return this; + } + + /** + * Whether Rules should be globally enabled. + * @return enableRules + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether Rules should be globally enabled.") + + public Boolean getEnableRules() { + return enableRules; + } + + + public void setEnableRules(Boolean enableRules) { + this.enableRules = enableRules; + } + + + public SearchParams enablePersonalization(Boolean enablePersonalization) { + + this.enablePersonalization = enablePersonalization; + return this; + } + + /** + * Enable the Personalization feature. + * @return enablePersonalization + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enable the Personalization feature.") + + public Boolean getEnablePersonalization() { + return enablePersonalization; + } + + + public void setEnablePersonalization(Boolean enablePersonalization) { + this.enablePersonalization = enablePersonalization; + } + + + public SearchParams queryType(QueryTypeEnum queryType) { + + this.queryType = queryType; + return this; + } + + /** + * Controls if and how query words are interpreted as prefixes. + * @return queryType + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") + + public QueryTypeEnum getQueryType() { + return queryType; + } + + + public void setQueryType(QueryTypeEnum queryType) { + this.queryType = queryType; + } + + + public SearchParams removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + + this.removeWordsIfNoResults = removeWordsIfNoResults; + return this; + } + + /** + * Selects a strategy to remove words from the query when it doesn’t match any hits. + * @return removeWordsIfNoResults + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") + + public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { + return removeWordsIfNoResults; + } + + + public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + this.removeWordsIfNoResults = removeWordsIfNoResults; + } + + + public SearchParams advancedSyntax(Boolean advancedSyntax) { + + this.advancedSyntax = advancedSyntax; + return this; + } + + /** + * Enables the advanced query syntax. + * @return advancedSyntax + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables the advanced query syntax.") + + public Boolean getAdvancedSyntax() { + return advancedSyntax; + } + + + public void setAdvancedSyntax(Boolean advancedSyntax) { + this.advancedSyntax = advancedSyntax; + } + + + public SearchParams optionalWords(List optionalWords) { + + this.optionalWords = optionalWords; + return this; + } + + public SearchParams addOptionalWordsItem(String optionalWordsItem) { + if (this.optionalWords == null) { + this.optionalWords = new ArrayList(); + } + this.optionalWords.add(optionalWordsItem); + return this; + } + + /** + * A list of words that should be considered as optional when found in the query. + * @return optionalWords + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") + + public List getOptionalWords() { + return optionalWords; + } + + + public void setOptionalWords(List optionalWords) { + this.optionalWords = optionalWords; + } + + + public SearchParams disableExactOnAttributes(List disableExactOnAttributes) { + + this.disableExactOnAttributes = disableExactOnAttributes; + return this; + } + + public SearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + if (this.disableExactOnAttributes == null) { + this.disableExactOnAttributes = new ArrayList(); + } + this.disableExactOnAttributes.add(disableExactOnAttributesItem); + return this; + } + + /** + * List of attributes on which you want to disable the exact ranking criterion. + * @return disableExactOnAttributes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") + + public List getDisableExactOnAttributes() { + return disableExactOnAttributes; + } + + + public void setDisableExactOnAttributes(List disableExactOnAttributes) { + this.disableExactOnAttributes = disableExactOnAttributes; + } + + + public SearchParams exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + return this; + } + + /** + * Controls how the exact ranking criterion is computed when the query contains only one word. + * @return exactOnSingleWordQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") + + public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { + return exactOnSingleWordQuery; + } + + + public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + this.exactOnSingleWordQuery = exactOnSingleWordQuery; + } + + + public SearchParams alternativesAsExact(List alternativesAsExact) { + + this.alternativesAsExact = alternativesAsExact; + return this; + } + + public SearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + if (this.alternativesAsExact == null) { + this.alternativesAsExact = new ArrayList(); + } + this.alternativesAsExact.add(alternativesAsExactItem); + return this; + } + + /** + * List of alternatives that should be considered an exact match by the exact ranking criterion. + * @return alternativesAsExact + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") + + public List getAlternativesAsExact() { + return alternativesAsExact; + } + + + public void setAlternativesAsExact(List alternativesAsExact) { + this.alternativesAsExact = alternativesAsExact; + } + + + public SearchParams advancedSyntaxFeatures(List advancedSyntaxFeatures) { + + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + return this; + } + + public SearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + if (this.advancedSyntaxFeatures == null) { + this.advancedSyntaxFeatures = new ArrayList(); + } + this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); + return this; + } + + /** + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * @return advancedSyntaxFeatures + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") + + public List getAdvancedSyntaxFeatures() { + return advancedSyntaxFeatures; + } + + + public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + this.advancedSyntaxFeatures = advancedSyntaxFeatures; + } + + + public SearchParams distinct(Integer distinct) { + + this.distinct = distinct; + return this; + } + + /** + * Enables de-duplication or grouping of results. + * minimum: 0 + * maximum: 4 + * @return distinct + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + + public Integer getDistinct() { + return distinct; + } + + + public void setDistinct(Integer distinct) { + this.distinct = distinct; + } + + + public SearchParams synonyms(Boolean synonyms) { + + this.synonyms = synonyms; + return this; + } + + /** + * Whether to take into account an index’s synonyms for a particular search. + * @return synonyms + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") + + public Boolean getSynonyms() { + return synonyms; + } + + + public void setSynonyms(Boolean synonyms) { + this.synonyms = synonyms; + } + + + public SearchParams replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + return this; + } + + /** + * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * @return replaceSynonymsInHighlight + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") + + public Boolean getReplaceSynonymsInHighlight() { + return replaceSynonymsInHighlight; + } + + + public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; + } + + + public SearchParams minProximity(Integer minProximity) { + + this.minProximity = minProximity; + return this; + } + + /** + * Precision of the proximity ranking criterion. + * minimum: 1 + * maximum: 7 + * @return minProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + + public Integer getMinProximity() { + return minProximity; + } + + + public void setMinProximity(Integer minProximity) { + this.minProximity = minProximity; + } + + + public SearchParams responseFields(List responseFields) { + + this.responseFields = responseFields; + return this; + } + + public SearchParams addResponseFieldsItem(String responseFieldsItem) { + if (this.responseFields == null) { + this.responseFields = new ArrayList(); + } + this.responseFields.add(responseFieldsItem); + return this; + } + + /** + * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * @return responseFields + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") + + public List getResponseFields() { + return responseFields; + } + + + public void setResponseFields(List responseFields) { + this.responseFields = responseFields; + } + + + public SearchParams maxFacetHits(Integer maxFacetHits) { + + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet hits to return during a search for facet values. + * @return maxFacetHits + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") + + public Integer getMaxFacetHits() { + return maxFacetHits; + } + + + public void setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + } + + + public SearchParams attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + return this; + } + + /** + * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * @return attributeCriteriaComputedByMinProximity + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") + + public Boolean getAttributeCriteriaComputedByMinProximity() { + return attributeCriteriaComputedByMinProximity; + } + + + public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { + this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + } + + + public SearchParams renderingContent(Object renderingContent) { + + this.renderingContent = renderingContent; + return this; + } + + /** + * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * @return renderingContent + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") + + public Object getRenderingContent() { + return renderingContent; + } + + + public void setRenderingContent(Object renderingContent) { + this.renderingContent = renderingContent; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchParams searchParams = (SearchParams) o; + return Objects.equals(this.query, searchParams.query) && + Objects.equals(this.similarQuery, searchParams.similarQuery) && + Objects.equals(this.filters, searchParams.filters) && + Objects.equals(this.facetFilters, searchParams.facetFilters) && + Objects.equals(this.optionalFilters, searchParams.optionalFilters) && + Objects.equals(this.numericFilters, searchParams.numericFilters) && + Objects.equals(this.tagFilters, searchParams.tagFilters) && + Objects.equals(this.sumOrFiltersScores, searchParams.sumOrFiltersScores) && + Objects.equals(this.facets, searchParams.facets) && + Objects.equals(this.maxValuesPerFacet, searchParams.maxValuesPerFacet) && + Objects.equals(this.facetingAfterDistinct, searchParams.facetingAfterDistinct) && + Objects.equals(this.sortFacetValuesBy, searchParams.sortFacetValuesBy) && + Objects.equals(this.page, searchParams.page) && + Objects.equals(this.offset, searchParams.offset) && + Objects.equals(this.length, searchParams.length) && + Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && + Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && + Objects.equals(this.aroundRadius, searchParams.aroundRadius) && + Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && + Objects.equals(this.minimumAroundRadius, searchParams.minimumAroundRadius) && + Objects.equals(this.insideBoundingBox, searchParams.insideBoundingBox) && + Objects.equals(this.insidePolygon, searchParams.insidePolygon) && + Objects.equals(this.naturalLanguages, searchParams.naturalLanguages) && + Objects.equals(this.ruleContexts, searchParams.ruleContexts) && + Objects.equals(this.personalizationImpact, searchParams.personalizationImpact) && + Objects.equals(this.userToken, searchParams.userToken) && + Objects.equals(this.getRankingInfo, searchParams.getRankingInfo) && + Objects.equals(this.clickAnalytics, searchParams.clickAnalytics) && + Objects.equals(this.analytics, searchParams.analytics) && + Objects.equals(this.analyticsTags, searchParams.analyticsTags) && + Objects.equals(this.percentileComputation, searchParams.percentileComputation) && + Objects.equals(this.enableABTest, searchParams.enableABTest) && + Objects.equals(this.enableReRanking, searchParams.enableReRanking) && + Objects.equals(this.searchableAttributes, searchParams.searchableAttributes) && + Objects.equals(this.attributesForFaceting, searchParams.attributesForFaceting) && + Objects.equals(this.unretrievableAttributes, searchParams.unretrievableAttributes) && + Objects.equals(this.attributesToRetrieve, searchParams.attributesToRetrieve) && + Objects.equals(this.restrictSearchableAttributes, searchParams.restrictSearchableAttributes) && + Objects.equals(this.ranking, searchParams.ranking) && + Objects.equals(this.customRanking, searchParams.customRanking) && + Objects.equals(this.relevancyStrictness, searchParams.relevancyStrictness) && + Objects.equals(this.attributesToHighlight, searchParams.attributesToHighlight) && + Objects.equals(this.attributesToSnippet, searchParams.attributesToSnippet) && + Objects.equals(this.highlightPreTag, searchParams.highlightPreTag) && + Objects.equals(this.highlightPostTag, searchParams.highlightPostTag) && + Objects.equals(this.snippetEllipsisText, searchParams.snippetEllipsisText) && + Objects.equals(this.restrictHighlightAndSnippetArrays, searchParams.restrictHighlightAndSnippetArrays) && + Objects.equals(this.hitsPerPage, searchParams.hitsPerPage) && + Objects.equals(this.minWordSizefor1Typo, searchParams.minWordSizefor1Typo) && + Objects.equals(this.minWordSizefor2Typos, searchParams.minWordSizefor2Typos) && + Objects.equals(this.typoTolerance, searchParams.typoTolerance) && + Objects.equals(this.allowTyposOnNumericTokens, searchParams.allowTyposOnNumericTokens) && + Objects.equals(this.disableTypoToleranceOnAttributes, searchParams.disableTypoToleranceOnAttributes) && + Objects.equals(this.separatorsToIndex, searchParams.separatorsToIndex) && + Objects.equals(this.ignorePlurals, searchParams.ignorePlurals) && + Objects.equals(this.removeStopWords, searchParams.removeStopWords) && + Objects.equals(this.keepDiacriticsOnCharacters, searchParams.keepDiacriticsOnCharacters) && + Objects.equals(this.queryLanguages, searchParams.queryLanguages) && + Objects.equals(this.decompoundQuery, searchParams.decompoundQuery) && + Objects.equals(this.enableRules, searchParams.enableRules) && + Objects.equals(this.enablePersonalization, searchParams.enablePersonalization) && + Objects.equals(this.queryType, searchParams.queryType) && + Objects.equals(this.removeWordsIfNoResults, searchParams.removeWordsIfNoResults) && + Objects.equals(this.advancedSyntax, searchParams.advancedSyntax) && + Objects.equals(this.optionalWords, searchParams.optionalWords) && + Objects.equals(this.disableExactOnAttributes, searchParams.disableExactOnAttributes) && + Objects.equals(this.exactOnSingleWordQuery, searchParams.exactOnSingleWordQuery) && + Objects.equals(this.alternativesAsExact, searchParams.alternativesAsExact) && + Objects.equals(this.advancedSyntaxFeatures, searchParams.advancedSyntaxFeatures) && + Objects.equals(this.distinct, searchParams.distinct) && + Objects.equals(this.synonyms, searchParams.synonyms) && + Objects.equals(this.replaceSynonymsInHighlight, searchParams.replaceSynonymsInHighlight) && + Objects.equals(this.minProximity, searchParams.minProximity) && + Objects.equals(this.responseFields, searchParams.responseFields) && + Objects.equals(this.maxFacetHits, searchParams.maxFacetHits) && + Objects.equals(this.attributeCriteriaComputedByMinProximity, searchParams.attributeCriteriaComputedByMinProximity) && + Objects.equals(this.renderingContent, searchParams.renderingContent); + } + + @Override + public int hashCode() { + return Objects.hash(query, similarQuery, filters, facetFilters, optionalFilters, numericFilters, tagFilters, sumOrFiltersScores, facets, maxValuesPerFacet, facetingAfterDistinct, sortFacetValuesBy, page, offset, length, aroundLatLng, aroundLatLngViaIP, aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, insidePolygon, naturalLanguages, ruleContexts, personalizationImpact, userToken, getRankingInfo, clickAnalytics, analytics, analyticsTags, percentileComputation, enableABTest, enableReRanking, searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchParams {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" similarQuery: ").append(toIndentedString(similarQuery)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" facetFilters: ").append(toIndentedString(facetFilters)).append("\n"); + sb.append(" optionalFilters: ").append(toIndentedString(optionalFilters)).append("\n"); + sb.append(" numericFilters: ").append(toIndentedString(numericFilters)).append("\n"); + sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); + sb.append(" sumOrFiltersScores: ").append(toIndentedString(sumOrFiltersScores)).append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); + sb.append(" facetingAfterDistinct: ").append(toIndentedString(facetingAfterDistinct)).append("\n"); + sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" aroundLatLngViaIP: ").append(toIndentedString(aroundLatLngViaIP)).append("\n"); + sb.append(" aroundRadius: ").append(toIndentedString(aroundRadius)).append("\n"); + sb.append(" aroundPrecision: ").append(toIndentedString(aroundPrecision)).append("\n"); + sb.append(" minimumAroundRadius: ").append(toIndentedString(minimumAroundRadius)).append("\n"); + sb.append(" insideBoundingBox: ").append(toIndentedString(insideBoundingBox)).append("\n"); + sb.append(" insidePolygon: ").append(toIndentedString(insidePolygon)).append("\n"); + sb.append(" naturalLanguages: ").append(toIndentedString(naturalLanguages)).append("\n"); + sb.append(" ruleContexts: ").append(toIndentedString(ruleContexts)).append("\n"); + sb.append(" personalizationImpact: ").append(toIndentedString(personalizationImpact)).append("\n"); + sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n"); + sb.append(" getRankingInfo: ").append(toIndentedString(getRankingInfo)).append("\n"); + sb.append(" clickAnalytics: ").append(toIndentedString(clickAnalytics)).append("\n"); + sb.append(" analytics: ").append(toIndentedString(analytics)).append("\n"); + sb.append(" analyticsTags: ").append(toIndentedString(analyticsTags)).append("\n"); + sb.append(" percentileComputation: ").append(toIndentedString(percentileComputation)).append("\n"); + sb.append(" enableABTest: ").append(toIndentedString(enableABTest)).append("\n"); + sb.append(" enableReRanking: ").append(toIndentedString(enableReRanking)).append("\n"); + sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); + sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); + sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); + sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); + sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); + sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); + sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); + sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); + sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); + sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); + sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); + sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); + sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); + sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); + sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); + sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); + sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); + sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); + sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); + sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); + sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); + sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); + sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); + sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); + sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); + sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); + sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); + sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); + sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); + sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); + sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); + sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); + sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); + sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); + sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); + sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); + sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).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-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java new file mode 100644 index 0000000000..68fe4797b9 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -0,0 +1,831 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.algolia.model.BaseSearchResponse; +import com.algolia.model.BaseSearchResponseFacetsStats; +import com.algolia.model.Record; +import com.algolia.model.SearchHits; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * SearchResponse + */ + +public class SearchResponse { + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) + private Integer abTestID; + + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) + private Integer abTestVariantID; + + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + private String aroundLatLng; + + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = "automaticRadius"; + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) + private String automaticRadius; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) + private Boolean exhaustiveFacetsCount; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) + private Boolean exhaustiveNbHits; + + public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) + private Boolean exhaustiveTypo; + + public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) + private Map> facets = null; + + public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + @SerializedName(SERIALIZED_NAME_FACETS_STATS) + private Map facetsStats = null; + + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + private Integer hitsPerPage = 20; + + public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) + private String index; + + public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + @SerializedName(SERIALIZED_NAME_INDEX_USED) + private String indexUsed; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + @SerializedName(SERIALIZED_NAME_NB_HITS) + private Integer nbHits; + + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) + private Integer nbPages; + + public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) + private Integer nbSortedHits; + + public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) + private Integer page = 0; + + public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) + private String params; + + public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) + private String parsedQuery; + + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) + private Integer processingTimeMS; + + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query = ""; + + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) + private String queryAfterRemoval; + + public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + @SerializedName(SERIALIZED_NAME_SERVER_USED) + private String serverUsed; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) + private Map userData = null; + + public static final String SERIALIZED_NAME_HITS = "hits"; + @SerializedName(SERIALIZED_NAME_HITS) + private List hits = new ArrayList(); + + + public SearchResponse abTestID(Integer abTestID) { + + this.abTestID = abTestID; + return this; + } + + /** + * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. + * @return abTestID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.") + + public Integer getAbTestID() { + return abTestID; + } + + + public void setAbTestID(Integer abTestID) { + this.abTestID = abTestID; + } + + + public SearchResponse abTestVariantID(Integer abTestVariantID) { + + this.abTestVariantID = abTestVariantID; + return this; + } + + /** + * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. + * @return abTestVariantID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.") + + public Integer getAbTestVariantID() { + return abTestVariantID; + } + + + public void setAbTestVariantID(Integer abTestVariantID) { + this.abTestVariantID = abTestVariantID; + } + + + public SearchResponse aroundLatLng(String aroundLatLng) { + + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * The computed geo location. + * @return aroundLatLng + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The computed geo location.") + + public String getAroundLatLng() { + return aroundLatLng; + } + + + public void setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + } + + + public SearchResponse automaticRadius(String automaticRadius) { + + this.automaticRadius = automaticRadius; + return this; + } + + /** + * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. + * @return automaticRadius + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.") + + public String getAutomaticRadius() { + return automaticRadius; + } + + + public void setAutomaticRadius(String automaticRadius) { + this.automaticRadius = automaticRadius; + } + + + public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + return this; + } + + /** + * Whether the facet count is exhaustive or approximate. + * @return exhaustiveFacetsCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether the facet count is exhaustive or approximate.") + + public Boolean getExhaustiveFacetsCount() { + return exhaustiveFacetsCount; + } + + + public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + } + + + public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { + + this.exhaustiveNbHits = exhaustiveNbHits; + return this; + } + + /** + * Indicate if the nbHits count was exhaustive or approximate + * @return exhaustiveNbHits + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Indicate if the nbHits count was exhaustive or approximate") + + public Boolean getExhaustiveNbHits() { + return exhaustiveNbHits; + } + + + public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { + this.exhaustiveNbHits = exhaustiveNbHits; + } + + + public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { + + this.exhaustiveTypo = exhaustiveTypo; + return this; + } + + /** + * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + * @return exhaustiveTypo + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)") + + public Boolean getExhaustiveTypo() { + return exhaustiveTypo; + } + + + public void setExhaustiveTypo(Boolean exhaustiveTypo) { + this.exhaustiveTypo = exhaustiveTypo; + } + + + public SearchResponse facets(Map> facets) { + + this.facets = facets; + return this; + } + + public SearchResponse putFacetsItem(String key, Map facetsItem) { + if (this.facets == null) { + this.facets = new HashMap>(); + } + this.facets.put(key, facetsItem); + return this; + } + + /** + * A mapping of each facet name to the corresponding facet counts. + * @return facets + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts.") + + public Map> getFacets() { + return facets; + } + + + public void setFacets(Map> facets) { + this.facets = facets; + } + + + public SearchResponse facetsStats(Map facetsStats) { + + this.facetsStats = facetsStats; + return this; + } + + public SearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { + if (this.facetsStats == null) { + this.facetsStats = new HashMap(); + } + this.facetsStats.put(key, facetsStatsItem); + return this; + } + + /** + * Statistics for numerical facets. + * @return facetsStats + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Statistics for numerical facets.") + + public Map getFacetsStats() { + return facetsStats; + } + + + public void setFacetsStats(Map facetsStats) { + this.facetsStats = facetsStats; + } + + + public SearchResponse hitsPerPage(Integer hitsPerPage) { + + this.hitsPerPage = hitsPerPage; + return this; + } + + /** + * Set the number of hits per page. + * @return hitsPerPage + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Set the number of hits per page.") + + public Integer getHitsPerPage() { + return hitsPerPage; + } + + + public void setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + } + + + public SearchResponse index(String index) { + + this.index = index; + return this; + } + + /** + * Index name used for the query. + * @return index + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "indexName", value = "Index name used for the query.") + + public String getIndex() { + return index; + } + + + public void setIndex(String index) { + this.index = index; + } + + + public SearchResponse indexUsed(String indexUsed) { + + this.indexUsed = indexUsed; + return this; + } + + /** + * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. + * @return indexUsed + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.") + + public String getIndexUsed() { + return indexUsed; + } + + + public void setIndexUsed(String indexUsed) { + this.indexUsed = indexUsed; + } + + + public SearchResponse message(String message) { + + this.message = message; + return this; + } + + /** + * Used to return warnings about the query. + * @return message + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Used to return warnings about the query.") + + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public SearchResponse nbHits(Integer nbHits) { + + this.nbHits = nbHits; + return this; + } + + /** + * Number of hits that the search query matched + * @return nbHits + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "20", required = true, value = "Number of hits that the search query matched") + + public Integer getNbHits() { + return nbHits; + } + + + public void setNbHits(Integer nbHits) { + this.nbHits = nbHits; + } + + + public SearchResponse nbPages(Integer nbPages) { + + this.nbPages = nbPages; + return this; + } + + /** + * Number of pages available for the current query + * @return nbPages + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "1", required = true, value = "Number of pages available for the current query") + + public Integer getNbPages() { + return nbPages; + } + + + public void setNbPages(Integer nbPages) { + this.nbPages = nbPages; + } + + + public SearchResponse nbSortedHits(Integer nbSortedHits) { + + this.nbSortedHits = nbSortedHits; + return this; + } + + /** + * The number of hits selected and sorted by the relevant sort algorithm + * @return nbSortedHits + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm") + + public Integer getNbSortedHits() { + return nbSortedHits; + } + + + public void setNbSortedHits(Integer nbSortedHits) { + this.nbSortedHits = nbSortedHits; + } + + + public SearchResponse page(Integer page) { + + this.page = page; + return this; + } + + /** + * Specify the page to retrieve. + * @return page + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Specify the page to retrieve.") + + public Integer getPage() { + return page; + } + + + public void setPage(Integer page) { + this.page = page; + } + + + public SearchResponse params(String params) { + + this.params = params; + return this; + } + + /** + * A url-encoded string of all search parameters. + * @return params + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "query=a&hitsPerPage=20", required = true, value = "A url-encoded string of all search parameters.") + + public String getParams() { + return params; + } + + + public void setParams(String params) { + this.params = params; + } + + + public SearchResponse parsedQuery(String parsedQuery) { + + this.parsedQuery = parsedQuery; + return this; + } + + /** + * The query string that will be searched, after normalization. + * @return parsedQuery + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The query string that will be searched, after normalization.") + + public String getParsedQuery() { + return parsedQuery; + } + + + public void setParsedQuery(String parsedQuery) { + this.parsedQuery = parsedQuery; + } + + + public SearchResponse processingTimeMS(Integer processingTimeMS) { + + this.processingTimeMS = processingTimeMS; + return this; + } + + /** + * Time the server took to process the request, in milliseconds. + * @return processingTimeMS + **/ + @javax.annotation.Nonnull + @ApiModelProperty(example = "20", required = true, value = "Time the server took to process the request, in milliseconds.") + + public Integer getProcessingTimeMS() { + return processingTimeMS; + } + + + public void setProcessingTimeMS(Integer processingTimeMS) { + this.processingTimeMS = processingTimeMS; + } + + + public SearchResponse query(String query) { + + this.query = query; + return this; + } + + /** + * The text to search in the index. + * @return query + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The text to search in the index.") + + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + + public SearchResponse queryAfterRemoval(String queryAfterRemoval) { + + this.queryAfterRemoval = queryAfterRemoval; + return this; + } + + /** + * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. + * @return queryAfterRemoval + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.") + + public String getQueryAfterRemoval() { + return queryAfterRemoval; + } + + + public void setQueryAfterRemoval(String queryAfterRemoval) { + this.queryAfterRemoval = queryAfterRemoval; + } + + + public SearchResponse serverUsed(String serverUsed) { + + this.serverUsed = serverUsed; + return this; + } + + /** + * Actual host name of the server that processed the request. + * @return serverUsed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Actual host name of the server that processed the request.") + + public String getServerUsed() { + return serverUsed; + } + + + public void setServerUsed(String serverUsed) { + this.serverUsed = serverUsed; + } + + + public SearchResponse userData(Map userData) { + + this.userData = userData; + return this; + } + + public SearchResponse putUserDataItem(String key, Object userDataItem) { + if (this.userData == null) { + this.userData = new HashMap(); + } + this.userData.put(key, userDataItem); + return this; + } + + /** + * Lets you store custom data in your indices. + * @return userData + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Lets you store custom data in your indices.") + + public Map getUserData() { + return userData; + } + + + public void setUserData(Map userData) { + this.userData = userData; + } + + + public SearchResponse hits(List hits) { + + this.hits = hits; + return this; + } + + public SearchResponse addHitsItem(Record hitsItem) { + this.hits.add(hitsItem); + return this; + } + + /** + * Get hits + * @return hits + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "") + + public List getHits() { + return hits; + } + + + public void setHits(List hits) { + this.hits = hits; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchResponse searchResponse = (SearchResponse) o; + return Objects.equals(this.abTestID, searchResponse.abTestID) && + Objects.equals(this.abTestVariantID, searchResponse.abTestVariantID) && + Objects.equals(this.aroundLatLng, searchResponse.aroundLatLng) && + Objects.equals(this.automaticRadius, searchResponse.automaticRadius) && + Objects.equals(this.exhaustiveFacetsCount, searchResponse.exhaustiveFacetsCount) && + Objects.equals(this.exhaustiveNbHits, searchResponse.exhaustiveNbHits) && + Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && + Objects.equals(this.facets, searchResponse.facets) && + Objects.equals(this.facetsStats, searchResponse.facetsStats) && + Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && + Objects.equals(this.index, searchResponse.index) && + Objects.equals(this.indexUsed, searchResponse.indexUsed) && + Objects.equals(this.message, searchResponse.message) && + Objects.equals(this.nbHits, searchResponse.nbHits) && + Objects.equals(this.nbPages, searchResponse.nbPages) && + Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && + Objects.equals(this.page, searchResponse.page) && + Objects.equals(this.params, searchResponse.params) && + Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && + Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && + Objects.equals(this.query, searchResponse.query) && + Objects.equals(this.queryAfterRemoval, searchResponse.queryAfterRemoval) && + Objects.equals(this.serverUsed, searchResponse.serverUsed) && + Objects.equals(this.userData, searchResponse.userData) && + Objects.equals(this.hits, searchResponse.hits); + } + + @Override + public int hashCode() { + return Objects.hash(abTestID, abTestVariantID, aroundLatLng, automaticRadius, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, facets, facetsStats, hitsPerPage, index, indexUsed, message, nbHits, nbPages, nbSortedHits, page, params, parsedQuery, processingTimeMS, query, queryAfterRemoval, serverUsed, userData, hits); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchResponse {\n"); + sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); + sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); + sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); + sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); + sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" hits: ").append(toIndentedString(hits)).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-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java new file mode 100644 index 0000000000..37b25d65e6 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -0,0 +1,128 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.threeten.bp.OffsetDateTime; + +/** + * SetSettingsResponse + */ + +public class SetSettingsResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + + public SetSettingsResponse taskID(Integer taskID) { + + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * @return taskID + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "taskID of the indexing task to wait for.") + + public Integer getTaskID() { + return taskID; + } + + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + + public SetSettingsResponse updatedAt(OffsetDateTime updatedAt) { + + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * @return updatedAt + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Date of last update (ISO-8601 format).") + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SetSettingsResponse setSettingsResponse = (SetSettingsResponse) o; + return Objects.equals(this.taskID, setSettingsResponse.taskID) && + Objects.equals(this.updatedAt, setSettingsResponse.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetSettingsResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java new file mode 100644 index 0000000000..f7cebe6092 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -0,0 +1,176 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * SnippetResult + */ + +public class SnippetResult { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + /** + * Indicates how well the attribute matched the search query. + */ + @JsonAdapter(MatchLevelEnum.Adapter.class) + public enum MatchLevelEnum { + NONE("none"), + + PARTIAL("partial"), + + FULL("full"); + + private String value; + + MatchLevelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MatchLevelEnum fromValue(String value) { + for (MatchLevelEnum b : MatchLevelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MatchLevelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MatchLevelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MatchLevelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) + private MatchLevelEnum matchLevel; + + + public SnippetResult value(String value) { + + this.value = value; + return this; + } + + /** + * Markup text with occurrences highlighted. + * @return value + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "George Clooney...", value = "Markup text with occurrences highlighted.") + + public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + } + + + public SnippetResult matchLevel(MatchLevelEnum matchLevel) { + + this.matchLevel = matchLevel; + return this; + } + + /** + * Indicates how well the attribute matched the search query. + * @return matchLevel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Indicates how well the attribute matched the search query.") + + public MatchLevelEnum getMatchLevel() { + return matchLevel; + } + + + public void setMatchLevel(MatchLevelEnum matchLevel) { + this.matchLevel = matchLevel; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnippetResult snippetResult = (SnippetResult) o; + return Objects.equals(this.value, snippetResult.value) && + Objects.equals(this.matchLevel, snippetResult.matchLevel); + } + + @Override + public int hashCode() { + return Objects.hash(value, matchLevel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnippetResult {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).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-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java new file mode 100644 index 0000000000..888b037706 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -0,0 +1,1272 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.search; + +import com.algolia.ApiCallback; +import com.algolia.ApiClient; +import com.algolia.ApiException; +import com.algolia.ApiResponse; +import com.algolia.Configuration; +import com.algolia.Pair; +import com.algolia.ProgressRequestBody; +import com.algolia.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.algolia.model.BatchObject; +import com.algolia.model.BatchResponse; +import com.algolia.model.DeleteIndexResponse; +import com.algolia.model.ErrorBase; +import com.algolia.model.IndexSettings; +import com.algolia.model.ListIndicesResponse; +import com.algolia.model.MultipleQueriesObject; +import com.algolia.model.MultipleQueriesResponse; +import com.algolia.model.OperationIndexObject; +import com.algolia.model.OperationIndexResponse; +import com.algolia.model.SaveObjectResponse; +import com.algolia.model.SearchParams; +import com.algolia.model.SearchResponse; +import com.algolia.model.SetSettingsResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class SearchApi { + private ApiClient localVarApiClient; + + public SearchApi() { + this(Configuration.getDefaultApiClient()); + } + + public SearchApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + /** + * Build call for batch + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call batchCall(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = batchObject; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}/batch" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call batchValidateBeforeCall(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling batch(Async)"); + } + + // verify the required parameter 'batchObject' is set + if (batchObject == null) { + throw new ApiException("Missing the required parameter 'batchObject' when calling batch(Async)"); + } + + + okhttp3.Call localVarCall = batchCall(indexName, batchObject, _callback); + return localVarCall; + + } + + /** + * + * Performs multiple write operations in a single API call. + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @return BatchResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public BatchResponse batch(String indexName, BatchObject batchObject) throws ApiException { + ApiResponse localVarResp = batchWithHttpInfo(indexName, batchObject); + return localVarResp.getData(); + } + + /** + * + * Performs multiple write operations in a single API call. + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @return ApiResponse<BatchResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse batchWithHttpInfo(String indexName, BatchObject batchObject) throws ApiException { + okhttp3.Call localVarCall = batchValidateBeforeCall(indexName, batchObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Performs multiple write operations in a single API call. + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call batchAsync(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = batchValidateBeforeCall(indexName, batchObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteIndex + * @param indexName The index in which to perform the request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call deleteIndexCall(String indexName, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteIndexValidateBeforeCall(String indexName, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling deleteIndex(Async)"); + } + + + okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); + return localVarCall; + + } + + /** + * Delete index. + * Delete an existing index. + * @param indexName The index in which to perform the request. (required) + * @return DeleteIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { + ApiResponse localVarResp = deleteIndexWithHttpInfo(indexName); + return localVarResp.getData(); + } + + /** + * Delete index. + * Delete an existing index. + * @param indexName The index in which to perform the request. (required) + * @return ApiResponse<DeleteIndexResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse deleteIndexWithHttpInfo(String indexName) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete index. (asynchronously) + * Delete an existing index. + * @param indexName The index in which to perform the request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call deleteIndexAsync(String indexName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getSettings + * @param indexName The index in which to perform the request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSettingsCall(String indexName, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}/settings" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSettingsValidateBeforeCall(String indexName, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling getSettings(Async)"); + } + + + okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); + return localVarCall; + + } + + /** + * + * Retrieve settings of a given indexName. + * @param indexName The index in which to perform the request. (required) + * @return IndexSettings + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public IndexSettings getSettings(String indexName) throws ApiException { + ApiResponse localVarResp = getSettingsWithHttpInfo(indexName); + return localVarResp.getData(); + } + + /** + * + * Retrieve settings of a given indexName. + * @param indexName The index in which to perform the request. (required) + * @return ApiResponse<IndexSettings> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse getSettingsWithHttpInfo(String indexName) throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Retrieve settings of a given indexName. + * @param indexName The index in which to perform the request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSettingsAsync(String indexName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listIndices + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call listIndicesCall(Integer page, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("Page", page)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listIndicesValidateBeforeCall(Integer page, final ApiCallback _callback) throws ApiException { + + + okhttp3.Call localVarCall = listIndicesCall(page, _callback); + return localVarCall; + + } + + /** + * List existing indexes. + * List existing indexes from an application. + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @return ListIndicesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ListIndicesResponse listIndices(Integer page) throws ApiException { + ApiResponse localVarResp = listIndicesWithHttpInfo(page); + return localVarResp.getData(); + } + + /** + * List existing indexes. + * List existing indexes from an application. + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @return ApiResponse<ListIndicesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse listIndicesWithHttpInfo(Integer page) throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List existing indexes. (asynchronously) + * List existing indexes from an application. + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call listIndicesAsync(Integer page, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for multipleQueries + * @param multipleQueriesObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call multipleQueriesCall(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = multipleQueriesObject; + + // create path and map variables + String localVarPath = "/1/indexes/*/queries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call multipleQueriesValidateBeforeCall(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'multipleQueriesObject' is set + if (multipleQueriesObject == null) { + throw new ApiException("Missing the required parameter 'multipleQueriesObject' when calling multipleQueries(Async)"); + } + + + okhttp3.Call localVarCall = multipleQueriesCall(multipleQueriesObject, _callback); + return localVarCall; + + } + + /** + * + * Get search results for the given requests. + * @param multipleQueriesObject (required) + * @return MultipleQueriesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public MultipleQueriesResponse multipleQueries(MultipleQueriesObject multipleQueriesObject) throws ApiException { + ApiResponse localVarResp = multipleQueriesWithHttpInfo(multipleQueriesObject); + return localVarResp.getData(); + } + + /** + * + * Get search results for the given requests. + * @param multipleQueriesObject (required) + * @return ApiResponse<MultipleQueriesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse multipleQueriesWithHttpInfo(MultipleQueriesObject multipleQueriesObject) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get search results for the given requests. + * @param multipleQueriesObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call multipleQueriesAsync(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall(multipleQueriesObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for operationIndex + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexCall(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = operationIndexObject; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}/operation" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call operationIndexValidateBeforeCall(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling operationIndex(Async)"); + } + + // verify the required parameter 'operationIndexObject' is set + if (operationIndexObject == null) { + throw new ApiException("Missing the required parameter 'operationIndexObject' when calling operationIndex(Async)"); + } + + + okhttp3.Call localVarCall = operationIndexCall(indexName, operationIndexObject, _callback); + return localVarCall; + + } + + /** + * Copy/move index. + * Peforms a copy or a move operation on a index. + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return OperationIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public OperationIndexResponse operationIndex(String indexName, OperationIndexObject operationIndexObject) throws ApiException { + ApiResponse localVarResp = operationIndexWithHttpInfo(indexName, operationIndexObject); + return localVarResp.getData(); + } + + /** + * Copy/move index. + * Peforms a copy or a move operation on a index. + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return ApiResponse<OperationIndexResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse operationIndexWithHttpInfo(String indexName, OperationIndexObject operationIndexObject) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall(indexName, operationIndexObject, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Copy/move index. (asynchronously) + * Peforms a copy or a move operation on a index. + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexAsync(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = operationIndexValidateBeforeCall(indexName, operationIndexObject, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for saveObject + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectCall(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call saveObjectValidateBeforeCall(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling saveObject(Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling saveObject(Async)"); + } + + + okhttp3.Call localVarCall = saveObjectCall(indexName, requestBody, _callback); + return localVarCall; + + } + + /** + * + * Add an object to the index, automatically assigning it an object ID. + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return SaveObjectResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SaveObjectResponse saveObject(String indexName, Map requestBody) throws ApiException { + ApiResponse localVarResp = saveObjectWithHttpInfo(indexName, requestBody); + return localVarResp.getData(); + } + + /** + * + * Add an object to the index, automatically assigning it an object ID. + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return ApiResponse<SaveObjectResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse saveObjectWithHttpInfo(String indexName, Map requestBody) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall(indexName, requestBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Add an object to the index, automatically assigning it an object ID. + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectAsync(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = saveObjectValidateBeforeCall(indexName, requestBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for search + * @param indexName The index in which to perform the request. (required) + * @param searchParams (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call searchCall(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = searchParams; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}/query" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchValidateBeforeCall(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling search(Async)"); + } + + // verify the required parameter 'searchParams' is set + if (searchParams == null) { + throw new ApiException("Missing the required parameter 'searchParams' when calling search(Async)"); + } + + + okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); + return localVarCall; + + } + + /** + * + * Get search results. + * @param indexName The index in which to perform the request. (required) + * @param searchParams (required) + * @return SearchResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SearchResponse search(String indexName, SearchParams searchParams) throws ApiException { + ApiResponse localVarResp = searchWithHttpInfo(indexName, searchParams); + return localVarResp.getData(); + } + + /** + * + * Get search results. + * @param indexName The index in which to perform the request. (required) + * @param searchParams (required) + * @return ApiResponse<SearchResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse searchWithHttpInfo(String indexName, SearchParams searchParams) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall(indexName, searchParams, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Get search results. + * @param indexName The index in which to perform the request. (required) + * @param searchParams (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call searchAsync(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = searchValidateBeforeCall(indexName, searchParams, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for setSettings + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call setSettingsCall(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { + Object localVarPostBody = indexSettings; + + // create path and map variables + String localVarPath = "/1/indexes/{indexName}/settings" + .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (forwardToReplicas != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("forwardToReplicas", forwardToReplicas)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setSettingsValidateBeforeCall(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException("Missing the required parameter 'indexName' when calling setSettings(Async)"); + } + + // verify the required parameter 'indexSettings' is set + if (indexSettings == null) { + throw new ApiException("Missing the required parameter 'indexSettings' when calling setSettings(Async)"); + } + + + okhttp3.Call localVarCall = setSettingsCall(indexName, indexSettings, forwardToReplicas, _callback); + return localVarCall; + + } + + /** + * + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @return SetSettingsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SetSettingsResponse setSettings(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas) throws ApiException { + ApiResponse localVarResp = setSettingsWithHttpInfo(indexName, indexSettings, forwardToReplicas); + return localVarResp.getData(); + } + + /** + * + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @return ApiResponse<SetSettingsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse setSettingsWithHttpInfo(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas) throws ApiException { + okhttp3.Call localVarCall = setSettingsValidateBeforeCall(indexName, indexSettings, forwardToReplicas, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call setSettingsAsync(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = setSettingsValidateBeforeCall(indexName, indexSettings, forwardToReplicas, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml new file mode 100644 index 0000000000..436f8967c3 --- /dev/null +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -0,0 +1,224 @@ + + 4.0.0 + com.algolia + algoliasearch-client-java-2 + jar + algoliasearch-client-java-2 + 0.1.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://unlicense.org + repo + + + + + + OpenAPI-Generator Contributors + team@openapitools.org + OpenAPITools.org + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M4 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + algoliasearch-core + + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + org.threeten + threetenbp + ${threetenbp-version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + + 1.7 + ${java.version} + ${java.version} + 1.8.5 + 1.6.2 + 4.9.1 + 2.8.9 + 3.11 + 0.2.1 + 1.5.0 + UTF-8 + + diff --git a/openapitools.json b/openapitools.json index 860cd53e01..332f6dca61 100644 --- a/openapitools.json +++ b/openapitools.json @@ -56,9 +56,28 @@ "npmName": "@algolia/client-personalization", "packageName": "@algolia/client-personalization", "npmVersion": "5.0.0", - "isPersonalizationHost": false } + }, + "java-search": { + "generatorName": "java", + "templateDir": "#{cwd}/templates/java/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-java-2", + "artifactId": "algoliasearch-client-java-2", + "groupId": "com.algolia", + "apiPackage": "com.algolia.search", + "invokerPackage": "com.algolia", + "modelPackage": "com.algolia.model", + "library": "okhttp-gson", + "legacyDiscriminatorBehavior": false, + "glob": "specs/search/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-java-2", + "additionalProperties": { + "sourceFolder": "algoliasearch-core" + } } } } diff --git a/package.json b/package.json index 31b4f5a3c0..7f729dfdee 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "lint:client:fix": "eslint --ext=ts ${CLIENT} --fix", "lint": "eslint --ext=ts .", "format:specs": "yarn prettier --write specs", + "generate:java:search": "yarn openapi-generator-cli generate --generator-key java-search", "generate:js:personalization": "yarn openapi-generator-cli generate --generator-key javascript-personalization && CLIENT=client-personalization yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-personalization/ yarn lint:client:fix", "generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/recommend/ yarn lint:client:fix", "generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-search && CLIENT=client-search yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-search/ yarn lint:client:fix", diff --git a/playground/java/pom.xml b/playground/java/pom.xml new file mode 100644 index 0000000000..eb4ed2f7be --- /dev/null +++ b/playground/java/pom.xml @@ -0,0 +1,101 @@ + + + + 4.0.0 + + com.algolia + com.algolia + 1.0-SNAPSHOT + + java-playground + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + com.algolia + algoliasearch-client-java-2 + 0.1.0 + system + ${project.basedir}/../../clients/algoliasearch-client-java-2/target/algoliasearch-client-java-2-0.1.0.jar + + + com.squareup.okhttp3 + okhttp + 4.9.1 + + + com.google.code.gson + gson + 2.8.9 + + + org.threeten + threetenbp + 1.5.0 + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + com.algolia.App + + + + + diff --git a/playground/java/src/main/java/com/algolia/App.java b/playground/java/src/main/java/com/algolia/App.java new file mode 100644 index 0000000000..6a6642e222 --- /dev/null +++ b/playground/java/src/main/java/com/algolia/App.java @@ -0,0 +1,45 @@ +package com.algolia; + +/** + * Hello world! + * + */ + +import com.algolia.auth.*; +import com.algolia.model.*; +import com.algolia.search.SearchApi; + +public class App { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure API key authorization: apiKey + ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); + apiKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" + // (defaults to null) + // apiKey.setApiKeyPrefix("Token"); + + // Configure API key authorization: appId + ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); + appId.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" + // (defaults to null) + // appId.setApiKeyPrefix("Token"); + + SearchApi apiInstance = new SearchApi(defaultClient); + String indexName = "myIndexName"; // String | The index in which to perform the request. + BatchObject batchObject = new BatchObject(); // BatchObject | + try { + BatchResponse result = apiInstance.batch(indexName, batchObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SearchApi#batch"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/templates/java/Configuration.mustache b/templates/java/Configuration.mustache new file mode 100644 index 0000000000..6f6a434535 --- /dev/null +++ b/templates/java/Configuration.mustache @@ -0,0 +1,27 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +public class Configuration { + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/templates/java/CustomInstantDeserializer.mustache b/templates/java/CustomInstantDeserializer.mustache new file mode 100644 index 0000000000..5ebea810e1 --- /dev/null +++ b/templates/java/CustomInstantDeserializer.mustache @@ -0,0 +1,232 @@ +package {{invokerPackage}}; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.DateTimeUtils; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.toZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/templates/java/JSON.mustache b/templates/java/JSON.mustache new file mode 100644 index 0000000000..77b72ddc7f --- /dev/null +++ b/templates/java/JSON.mustache @@ -0,0 +1,539 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.DateTimeFormatterBuilder; +import org.joda.time.format.ISODateTimeFormat; +{{/joda}} +{{#threetenbp}} +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +{{/threetenbp}} + +{{#models.0}} +import {{modelPackage}}.*; +{{/models.0}} +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +{{#java8}} +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +{{/java8}} +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +public class JSON { + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + {{#joda}} + private DateTimeTypeAdapter dateTimeTypeAdapter = new DateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/joda}} + {{#jsr310}} + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/jsr310}} + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + {{#models}} + {{#model}} + {{#discriminator}} + .registerTypeSelector({{classname}}.class, new TypeSelector<{{classname}}>() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + {{#mappedModels}} + classByDiscriminatorValue.put("{{mappingName}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelName}}.class); + {{/mappedModels}} + classByDiscriminatorValue.put("{{name}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{classname}}.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "{{{propertyBaseName}}}")); + } + }) + {{/discriminator}} + {{/model}} + {{/models}} + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + {{#disableHtmlEscaping}} + builder.disableHtmlEscaping(); + {{/disableHtmlEscaping}} + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + public JSON() { + gson = createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + {{#joda}} + .registerTypeAdapter(DateTime.class, dateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + {{/joda}} + {{#jsr310}} + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + {{/jsr310}} + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + {{#joda}} + /** + * Gson TypeAdapter for Joda DateTime type + */ + public static class DateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public DateTimeTypeAdapter() { + this(new DateTimeFormatterBuilder() + .append(ISODateTimeFormat.dateTime().getPrinter(), ISODateTimeFormat.dateOptionalTimeParser().getParser()) + .toFormatter()); + } + + public DateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } + } + + /** + * Gson TypeAdapter for Joda LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(ISODateTimeFormat.date()); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } + } + + public JSON setDateTimeFormat(DateTimeFormatter dateFormat) { + dateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + {{/joda}} + {{#jsr310}} + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + {{/jsr310}} + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/templates/java/JavaTimeFormatter.mustache b/templates/java/JavaTimeFormatter.mustache new file mode 100644 index 0000000000..d94ab5d0cb --- /dev/null +++ b/templates/java/JavaTimeFormatter.mustache @@ -0,0 +1,59 @@ +{{>licenseInfo}} +package {{invokerPackage}}; + +{{^threetenbp}} +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +{{/threetenbp}} +{{#threetenbp}} +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.format.DateTimeParseException; +{{/threetenbp}} + +/** + * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. + * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. + */ +public class JavaTimeFormatter { + + private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + + /** + * Get the date format used to parse/format {@code OffsetDateTime} parameters. + * @return DateTimeFormatter + */ + public DateTimeFormatter getOffsetDateTimeFormatter() { + return offsetDateTimeFormatter; + } + + /** + * Set the date format used to parse/format {@code OffsetDateTime} parameters. + * @param offsetDateTimeFormatter {@code DateTimeFormatter} + */ + public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { + this.offsetDateTimeFormatter = offsetDateTimeFormatter; + } + + /** + * Parse the given string into {@code OffsetDateTime} object. + * @param str String + * @return {@code OffsetDateTime} + */ + public OffsetDateTime parseOffsetDateTime(String str) { + try { + return OffsetDateTime.parse(str, offsetDateTimeFormatter); + } catch (DateTimeParseException e) { + throw new RuntimeException(e); + } + } + /** + * Format the given {@code OffsetDateTime} object into string. + * @param offsetDateTime {@code OffsetDateTime} + * @return {@code OffsetDateTime} in string format + */ + public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { + return offsetDateTimeFormatter.format(offsetDateTime); + } +} diff --git a/templates/java/Pair.mustache b/templates/java/Pair.mustache new file mode 100644 index 0000000000..2cd1879dfc --- /dev/null +++ b/templates/java/Pair.mustache @@ -0,0 +1,49 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/templates/java/ServerConfiguration.mustache b/templates/java/ServerConfiguration.mustache new file mode 100644 index 0000000000..e21b63391e --- /dev/null +++ b/templates/java/ServerConfiguration.mustache @@ -0,0 +1,58 @@ +package {{invokerPackage}}; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replaceAll("\\{" + name + "\\}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/templates/java/ServerVariable.mustache b/templates/java/ServerVariable.mustache new file mode 100644 index 0000000000..1978b1eb95 --- /dev/null +++ b/templates/java/ServerVariable.mustache @@ -0,0 +1,23 @@ +package {{invokerPackage}}; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/templates/java/StringUtil.mustache b/templates/java/StringUtil.mustache new file mode 100644 index 0000000000..1fbb6a5556 --- /dev/null +++ b/templates/java/StringUtil.mustache @@ -0,0 +1,71 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Collection; +import java.util.Iterator; + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/templates/java/additionalEnumTypeAnnotations.mustache b/templates/java/additionalEnumTypeAnnotations.mustache new file mode 100644 index 0000000000..aa524798b4 --- /dev/null +++ b/templates/java/additionalEnumTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalEnumTypeAnnotations}}{{{.}}} +{{/additionalEnumTypeAnnotations}} \ No newline at end of file diff --git a/templates/java/additionalModelTypeAnnotations.mustache b/templates/java/additionalModelTypeAnnotations.mustache new file mode 100644 index 0000000000..f4871c02cc --- /dev/null +++ b/templates/java/additionalModelTypeAnnotations.mustache @@ -0,0 +1,2 @@ +{{#additionalModelTypeAnnotations}}{{{.}}} +{{/additionalModelTypeAnnotations}} \ No newline at end of file diff --git a/templates/java/api.mustache b/templates/java/api.mustache new file mode 100644 index 0000000000..815887eaea --- /dev/null +++ b/templates/java/api.mustache @@ -0,0 +1,121 @@ +{{>licenseInfo}} +package {{package}}; + +import com.sun.jersey.api.client.GenericType; + +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.Configuration; +import {{modelPackage}}.*; +import {{invokerPackage}}.Pair; + +{{#imports}}import {{import}}; +{{/imports}} + + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +{{#operations}} +public class {{classname}} { + private ApiClient apiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + {{#operation}} + /** + * {{summary}} + * {{notes}} + {{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} + {{/allParams}} + {{#returnType}} + * @return {{.}} + {{/returnType}} + * @throws ApiException if fails to make API call + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); + } + {{/required}}{{/allParams}} + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; + + // query params + {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + + {{#queryParams}} + {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{/queryParams}} + + {{#headerParams}}if ({{paramName}} != null) + localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/headerParams}} + + {{#cookieParams}}if ({{paramName}} != null) + localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); + {{/cookieParams}} + + {{#formParams}}if ({{paramName}} != null) + localVarFormParams.put("{{baseName}}", {{paramName}}); + {{/formParams}} + + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + + {{#returnType}} + GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; + return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + {{/returnType}}{{^returnType}} + apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); + {{/returnType}} + } + {{/operation}} +} +{{/operations}} diff --git a/templates/java/auth/ApiKeyAuth.mustache b/templates/java/auth/ApiKeyAuth.mustache new file mode 100644 index 0000000000..8e110e7e63 --- /dev/null +++ b/templates/java/auth/ApiKeyAuth.mustache @@ -0,0 +1,65 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; + +import java.util.Map; +import java.util.List; + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/templates/java/auth/Authentication.mustache b/templates/java/auth/Authentication.mustache new file mode 100644 index 0000000000..033de98d56 --- /dev/null +++ b/templates/java/auth/Authentication.mustache @@ -0,0 +1,19 @@ +{{>licenseInfo}} + +package {{invokerPackage}}.auth; + +import {{invokerPackage}}.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams); +} diff --git a/templates/java/enum_outer_doc.mustache b/templates/java/enum_outer_doc.mustache new file mode 100644 index 0000000000..20c512aaea --- /dev/null +++ b/templates/java/enum_outer_doc.mustache @@ -0,0 +1,7 @@ +# {{classname}} + +## Enum + +{{#allowableValues}}{{#enumVars}} +* `{{name}}` (value: `{{{value}}}`) +{{/enumVars}}{{/allowableValues}} diff --git a/templates/java/gitignore.mustache b/templates/java/gitignore.mustache new file mode 100644 index 0000000000..a530464afa --- /dev/null +++ b/templates/java/gitignore.mustache @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/templates/java/jackson_annotations.mustache b/templates/java/jackson_annotations.mustache new file mode 100644 index 0000000000..ccde126f54 --- /dev/null +++ b/templates/java/jackson_annotations.mustache @@ -0,0 +1,19 @@ +{{! + If this is map and items are nullable, make sure that nulls are included. + To determine what JsonInclude.Include method to use, consider the following: + * If the field is required, always include it, even if it is null. + * Else use custom behaviour, IOW use whatever is defined on the object mapper + }} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) + {{#withXml}} + {{^isContainer}} + @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + {{#isXmlWrapped}} + // items.xmlName={{items.xmlName}} + @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/withXml}} \ No newline at end of file diff --git a/templates/java/libraries/okhttp-gson/ApiCallback.mustache b/templates/java/libraries/okhttp-gson/ApiCallback.mustache new file mode 100644 index 0000000000..53b6a7b8e3 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ApiCallback.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache new file mode 100644 index 0000000000..72e575cdc1 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -0,0 +1,1345 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +{{/joda}} +{{#threetenbp}} +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +{{/threetenbp}} + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +{{#java8}} +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +{{/java8}} +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.ApiKeyAuth; + +public class ApiClient { + + private String basePath = "{{{basePath}}}"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Basic constructor with custom OkHttpClient + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + {{#useGzipFeature}} + // Enable gzip request compression + builder.addInterceptor(new GzipRequestInterceptor()); + {{/useGzipFeature}} + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g {{{basePath}}} + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + {{#joda}} + public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + {{/joda}} + {{#jsr310}} + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + {{/jsr310}} + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{#supportStreaming}} + public InputStream executeStream(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + if (!response.isSuccessful()) { + throw new ApiException(response.code(), response.message()); + } + if (response.body() == null) { + return null; + } + return response.body().byteStream(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{/supportStreaming}} + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/templates/java/libraries/okhttp-gson/ApiResponse.mustache b/templates/java/libraries/okhttp-gson/ApiResponse.mustache new file mode 100644 index 0000000000..1e277319a9 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ApiResponse.mustache @@ -0,0 +1,58 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.List; +import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache new file mode 100644 index 0000000000..b633aa8f58 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache @@ -0,0 +1,74 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache new file mode 100644 index 0000000000..71e1e2b4cb --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -0,0 +1,62 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache new file mode 100644 index 0000000000..45115940b6 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -0,0 +1,59 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache new file mode 100644 index 0000000000..3ef6e772ab --- /dev/null +++ b/templates/java/libraries/okhttp-gson/README.mustache @@ -0,0 +1,175 @@ +# {{artifactId}} + +{{appName}} +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + - Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +{{{appDescriptionWithNewLines}}} + +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + +## Requirements + +Building the API client library requires: +1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.models.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{{paramName}}}({{{paramName}}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + +## Documentation for Authorization + +{{^authMethods}}All endpoints do not require authorization. +{{/authMethods}}Authentication schemes defined for the API: +{{#authMethods}}### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache new file mode 100644 index 0000000000..7a33790a04 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -0,0 +1,467 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiCallback; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ProgressRequestBody; +import {{invokerPackage}}.ProgressResponseBody; +{{#performBeanValidation}} +import {{invokerPackage}}.BeanValidationException; +{{/performBeanValidation}} + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} +{{#performBeanValidation}} +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.ValidatorFactory; +import javax.validation.executable.ExecutableValidator; +import java.util.Set; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +{{/performBeanValidation}} + +{{#imports}}import {{import}}; +{{/imports}} + +import java.lang.reflect.Type; +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{#supportStreaming}} +import java.io.InputStream; +{{/supportStreaming}} +{{/fullJavaUtil}} + +{{#operations}} +public class {{classname}} { + private ApiClient localVarApiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}}/** + * Build call for {{operationId}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + + {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + + {{#formParams}} + if ({{paramName}} != null) { + localVarFormParams.put("{{baseName}}", {{paramName}}); + } + + {{/formParams}} + {{#queryParams}} + if ({{paramName}} != null) { + {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + } + + {{/queryParams}} + {{#headerParams}} + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{#cookieParams}} + if ({{paramName}} != null) { + localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/cookieParams}} + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @SuppressWarnings("rawtypes") + private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + {{^performBeanValidation}} + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); + } + {{/required}}{{/allParams}} + + okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + return localVarCall; + + {{/performBeanValidation}} + {{#performBeanValidation}} + try { + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ExecutableValidator executableValidator = factory.getValidator().forExecutables(); + + Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; + Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); + Set> violations = executableValidator.validateParameters(this, method, + parameterValues); + + if (violations.size() == 0) { + okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + return localVarCall; + + } else { + throw new BeanValidationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + + {{/performBeanValidation}} + } + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{#vendorExtensions.x-streaming}} + public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp;{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{^vendorExtensions.x-streaming}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} + } + {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} (asynchronously) + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} + return localVarCall; + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#requiredParams}} + private final {{{dataType}}} {{paramName}}; + {{/requiredParams}} + {{#optionalParams}} + private {{{dataType}}} {{paramName}}; + {{/optionalParams}} + + private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + {{#requiredParams}} + this.{{paramName}} = {{paramName}}; + {{/requiredParams}} + } + + {{#optionalParams}} + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/optionalParams}} + /** + * Build call for {{operationId}} + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + + /** + * Execute {{operationId}} request{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + + /** + * Execute {{operationId}} request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + } + + /** + * {{summary}} + * {{notes}}{{#requiredParams}} + * @param {{paramName}} {{description}} (required){{/requiredParams}} + * @return API{{operationId}}Request + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/templates/java/libraries/okhttp-gson/apiException.mustache b/templates/java/libraries/okhttp-gson/apiException.mustache new file mode 100644 index 0000000000..d1a38fc7d3 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/apiException.mustache @@ -0,0 +1,95 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/templates/java/libraries/okhttp-gson/pom.mustache b/templates/java/libraries/okhttp-gson/pom.mustache new file mode 100644 index 0000000000..2e42031d4e --- /dev/null +++ b/templates/java/libraries/okhttp-gson/pom.mustache @@ -0,0 +1,249 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + {{artifactUrl}} + {{artifactDescription}} + + {{scmConnection}} + {{scmDeveloperConnection}} + {{scmUrl}} + +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} + + + + {{licenseName}} + {{licenseUrl}} + repo + + + + + + {{developerName}} + {{developerEmail}} + {{developerOrganization}} + {{developerOrganizationUrl}} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M4 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + {{{sourceFolder}}} + + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + {{#joda}} + + joda-time + joda-time + ${jodatime-version} + + {{/joda}} + {{#threetenbp}} + + org.threeten + threetenbp + ${threetenbp-version} + + {{/threetenbp}} + {{#openApiNullable}} + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + {{/openApiNullable}} + + + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + ${java.version} + ${java.version} + 1.8.5 + 1.6.2 + 4.9.1 + 2.8.9 + 3.11 + {{#openApiNullable}} + 0.2.1 + {{/openApiNullable}} + {{#joda}} + 2.10.9 + {{/joda}} + {{#threetenbp}} + 1.5.0 + {{/threetenbp}} + UTF-8 + + diff --git a/templates/java/licenseInfo.mustache b/templates/java/licenseInfo.mustache new file mode 100644 index 0000000000..c66209f279 --- /dev/null +++ b/templates/java/licenseInfo.mustache @@ -0,0 +1,11 @@ +/* + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}} + * {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ diff --git a/templates/java/manifest.mustache b/templates/java/manifest.mustache new file mode 100644 index 0000000000..f44bd07d0a --- /dev/null +++ b/templates/java/manifest.mustache @@ -0,0 +1,3 @@ + + + diff --git a/templates/java/model.mustache b/templates/java/model.mustache new file mode 100644 index 0000000000..42efebb680 --- /dev/null +++ b/templates/java/model.mustache @@ -0,0 +1,55 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#useReflectionEqualsHashCode}} +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +{{/useReflectionEqualsHashCode}} +import java.util.Objects; +import java.util.Arrays; +{{#imports}} +import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +{{#withXml}} +import com.fasterxml.jackson.dataformat.xml.annotation.*; +{{/withXml}} +{{/jackson}} +{{#withXml}} +import javax.xml.bind.annotation.*; +{{/withXml}} +{{#jsonb}} +import java.lang.reflect.Type; +import javax.json.bind.annotation.JsonbTypeDeserializer; +import javax.json.bind.annotation.JsonbTypeSerializer; +import javax.json.bind.serializer.DeserializationContext; +import javax.json.bind.serializer.JsonbDeserializer; +import javax.json.bind.serializer.JsonbSerializer; +import javax.json.bind.serializer.SerializationContext; +import javax.json.stream.JsonGenerator; +import javax.json.stream.JsonParser; +import javax.json.bind.annotation.JsonbProperty; +{{/jsonb}} +{{#parcelableModel}} +import android.os.Parcelable; +import android.os.Parcel; +{{/parcelableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import org.hibernate.validator.constraints.*; +{{/performBeanValidation}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{#vendorExtensions.x-is-one-of-interface}}{{>oneof_interface}}{{/vendorExtensions.x-is-one-of-interface}}{{^vendorExtensions.x-is-one-of-interface}}{{>pojo}}{{/vendorExtensions.x-is-one-of-interface}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/templates/java/modelEnum.mustache b/templates/java/modelEnum.mustache new file mode 100644 index 0000000000..f81c7c93ff --- /dev/null +++ b/templates/java/modelEnum.mustache @@ -0,0 +1,100 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +{{/jackson}} +{{#gson}} +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +{{/gson}} + +/** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ +{{#gson}} +@JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) +{{/gson}} +{{#jsonb}} +@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) +@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) +{{/jsonb}} +{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#allowableValues}}{{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + +{{#jackson}} + @JsonValue +{{/jackson}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + +{{#jackson}} + @JsonCreator +{{/jackson}} + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} + } +{{#gson}} + + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}next{{{dataType}}}(){{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } +{{/gson}} +{{#jsonb}} + public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { + @Override + public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(parser.getString())) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + parser.getString() + "'");{{/useNullForUnknownEnumValue}} + } + } + + public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> { + @Override + public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) { + generator.write(obj.value); + } + } +{{/jsonb}} +} diff --git a/templates/java/modelInnerEnum.mustache b/templates/java/modelInnerEnum.mustache new file mode 100644 index 0000000000..a9c99783fd --- /dev/null +++ b/templates/java/modelInnerEnum.mustache @@ -0,0 +1,95 @@ + /** + * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + */ +{{#gson}} + @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) +{{/gson}} +{{#jsonb}} + @JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class) + @JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class) +{{/jsonb}} +{{#withXml}} + @XmlType(name="{{datatypeWithEnum}}") + @XmlEnum({{dataType}}.class) +{{/withXml}} + {{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#allowableValues}} + {{#enumVars}} + {{#enumDescription}} + /** + * {{.}} + */ + {{/enumDescription}} + {{#withXml}} + @XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{/withXml}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + + private {{{dataType}}} value; + + {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + +{{#jackson}} + @JsonValue +{{/jackson}} + public {{{dataType}}} getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + +{{#jackson}} + @JsonCreator +{{/jackson}} + public static {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue({{{dataType}}} value) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (b.value.equals(value)) { + return b; + } + } + {{#isNullable}}return null;{{/isNullable}}{{^isNullable}}throw new IllegalArgumentException("Unexpected value '" + value + "'");{{/isNullable}} + } +{{#gson}} + + public static class Adapter extends TypeAdapter<{{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}> { + @Override + public void write(final JsonWriter jsonWriter, final {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} read(final JsonReader jsonReader) throws IOException { + {{^isNumber}}{{{dataType}}}{{/isNumber}}{{#isNumber}}String{{/isNumber}} value = {{#isFloat}}(float){{/isFloat}} jsonReader.{{#isNumber}}nextString(){{/isNumber}}{{#isInteger}}nextInt(){{/isInteger}}{{^isNumber}}{{^isInteger}}{{#isFloat}}nextDouble{{/isFloat}}{{^isFloat}}next{{{dataType}}}{{/isFloat}}(){{/isInteger}}{{/isNumber}}; + return {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.fromValue({{#isNumber}}new BigDecimal({{/isNumber}}value{{#isNumber}}){{/isNumber}}); + } + } +{{/gson}} +{{#jsonb}} + public static final class Deserializer implements JsonbDeserializer<{{datatypeWithEnum}}> { + @Override + public {{datatypeWithEnum}} deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) { + for ({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(parser.getString())) { + return b; + } + } + {{#useNullForUnknownEnumValue}}return null;{{/useNullForUnknownEnumValue}}{{^useNullForUnknownEnumValue}}throw new IllegalArgumentException("Unexpected value '" + parser.getString() + "'");{{/useNullForUnknownEnumValue}} + } + } + + public static final class Serializer implements JsonbSerializer<{{datatypeWithEnum}}> { + @Override + public void serialize({{datatypeWithEnum}} obj, JsonGenerator generator, SerializationContext ctx) { + generator.write(obj.value); + } + } +{{/jsonb}} + } diff --git a/templates/java/oneof_interface.mustache b/templates/java/oneof_interface.mustache new file mode 100644 index 0000000000..458dd3a0a3 --- /dev/null +++ b/templates/java/oneof_interface.mustache @@ -0,0 +1,6 @@ +{{>additionalModelTypeAnnotations}}{{>typeInfoAnnotation}}{{>xmlAnnotation}} +public interface {{classname}} {{#vendorExtensions.x-implements}}{{#-first}}extends {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{/vendorExtensions.x-implements}} { + {{#discriminator}} + public {{propertyType}} {{propertyGetter}}(); + {{/discriminator}} +} diff --git a/templates/java/openapi.mustache b/templates/java/openapi.mustache new file mode 100644 index 0000000000..34fbb53f33 --- /dev/null +++ b/templates/java/openapi.mustache @@ -0,0 +1 @@ +{{{openapi-yaml}}} diff --git a/templates/java/pojo.mustache b/templates/java/pojo.mustache new file mode 100644 index 0000000000..499382f3be --- /dev/null +++ b/templates/java/pojo.mustache @@ -0,0 +1,370 @@ +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}}{{#description}} +@ApiModel(description = "{{{.}}}"){{/description}} +{{#jackson}} +@JsonPropertyOrder({ +{{#vars}} + {{classname}}.JSON_PROPERTY_{{nameInSnakeCase}}{{^-last}},{{/-last}} +{{/vars}} +}) +@JsonTypeName("{{name}}") +{{/jackson}} +{{>additionalModelTypeAnnotations}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + {{#gson}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{/gson}} + {{#jackson}} + public static final String JSON_PROPERTY_{{nameInSnakeCase}} = "{{baseName}}"; + {{/jackson}} + {{#withXml}} + {{#isXmlAttribute}} + @XmlAttribute(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlAttribute}} + {{^isXmlAttribute}} + {{^isContainer}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isContainer}} + {{#isContainer}} + // Is a container wrapped={{isXmlWrapped}} + {{#items}} + // items.name={{name}} items.baseName={{baseName}} items.xmlName={{xmlName}} items.xmlNamespace={{xmlNamespace}} + // items.example={{example}} items.type={{dataType}} + @XmlElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/items}} + {{#isXmlWrapped}} + @XmlElementWrapper({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") + {{/isXmlWrapped}} + {{/isContainer}} + {{/isXmlAttribute}} + {{/withXml}} + {{#gson}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{/gson}} + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>undefined(); + {{/isContainer}} + {{^isContainer}} + private JsonNullable<{{{datatypeWithEnum}}}> {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{#isContainer}} + private {{{datatypeWithEnum}}} {{name}}{{#required}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/required}}{{^required}} = null{{/required}}; + {{/isContainer}} + {{^isContainer}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isContainer}} + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{/vars}} + {{#parcelableModel}} + public {{classname}}() { + {{#parent}} + super(); + {{/parent}} + {{#gson}} + {{#discriminator}} + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + {{/discriminator}} + {{/gson}} + } + {{/parcelableModel}} + {{^parcelableModel}} + {{#gson}} + {{#discriminator}} + public {{classname}}() { + this.{{{discriminatorName}}} = this.getClass().getSimpleName(); + } + {{/discriminator}} + {{/gson}} + {{/parcelableModel}} + {{#vars}} + + {{^isReadOnly}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}});{{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}}this.{{name}} = {{name}};{{/vendorExtensions.x-is-jackson-optional-nullable}} + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().add({{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.add({{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + if (this.{{name}} == null || !this.{{name}}.isPresent()) { + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{{defaultValue}}}); + } + try { + this.{{name}}.get().put(key, {{name}}Item); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + {{^required}} + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}; + } + {{/required}} + this.{{name}}.put(key, {{name}}Item); + return this; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + **/ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @javax.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @javax.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @javax.annotation.Nullable +{{/required}} +{{#jsonb}} + @JsonbProperty("{{baseName}}") +{{/jsonb}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} +{{#vendorExtensions.x-is-jackson-optional-nullable}} + {{!unannotated, Jackson would pick this up automatically and add it *in addition* to the _JsonNullable getter field}} + @JsonIgnore +{{/vendorExtensions.x-is-jackson-optional-nullable}} +{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#jackson}}{{> jackson_annotations}}{{/jackson}}{{/vendorExtensions.x-is-jackson-optional-nullable}} + public {{{datatypeWithEnum}}} {{getter}}() { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + {{#isReadOnly}}{{! A readonly attribute doesn't have setter => jackson will set null directly if explicitly returned by API, so make sure we have an empty JsonNullable}} + if ({{name}} == null) { + {{name}} = JsonNullable.<{{{datatypeWithEnum}}}>{{#defaultValue}}of({{{.}}}){{/defaultValue}}{{^defaultValue}}undefined(){{/defaultValue}}; + } + {{/isReadOnly}} + return {{name}}.orElse(null); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + return {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + + {{#vendorExtensions.x-is-jackson-optional-nullable}} +{{> jackson_annotations}} + public JsonNullable<{{{datatypeWithEnum}}}> {{getter}}_JsonNullable() { + return {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}}{{#vendorExtensions.x-is-jackson-optional-nullable}} + @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) + {{#isReadOnly}}private{{/isReadOnly}}{{^isReadOnly}}public{{/isReadOnly}} void {{setter}}_JsonNullable(JsonNullable<{{{datatypeWithEnum}}}> {{name}}) { + {{! For getters/setters that have name differing from attribute name, we must include setter (albeit private) for jackson to be able to set the attribute}} + this.{{name}} = {{name}}; + } + {{/vendorExtensions.x-is-jackson-optional-nullable}} + + {{^isReadOnly}} +{{#jackson}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{> jackson_annotations}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{/jackson}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + {{#vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = JsonNullable.<{{{datatypeWithEnum}}}>of({{name}}); + {{/vendorExtensions.x-is-jackson-optional-nullable}} + {{^vendorExtensions.x-is-jackson-optional-nullable}} + this.{{name}} = {{name}}; + {{/vendorExtensions.x-is-jackson-optional-nullable}} + } + {{/isReadOnly}} + + {{/vars}} + + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} && + {{/-last}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}} + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} + out.writeValue({{name}}); +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} +} diff --git a/templates/java/typeInfoAnnotation.mustache b/templates/java/typeInfoAnnotation.mustache new file mode 100644 index 0000000000..63eb42ea50 --- /dev/null +++ b/templates/java/typeInfoAnnotation.mustache @@ -0,0 +1,16 @@ +{{#jackson}} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "{{{discriminator.propertyBaseName}}}", visible = true) +{{#discriminator.mappedModels}} +{{#-first}} +@JsonSubTypes({ +{{/-first}} + @JsonSubTypes.Type(value = {{modelName}}.class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"), +{{#-last}} +}) +{{/-last}} +{{/discriminator.mappedModels}} +{{#isClassnameSanitized}} +@JsonTypeName("{{name}}") +{{/isClassnameSanitized}} +{{/jackson}} diff --git a/templates/java/xmlAnnotation.mustache b/templates/java/xmlAnnotation.mustache new file mode 100644 index 0000000000..4f3b448c8d --- /dev/null +++ b/templates/java/xmlAnnotation.mustache @@ -0,0 +1,6 @@ +{{#withXml}} + +@XmlRootElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}") +@XmlAccessorType(XmlAccessType.FIELD) +{{#jackson}} +@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}"){{/jackson}}{{/withXml}} \ No newline at end of file From 797fff4f927c6ee4542482a904dea12dcdb881bc Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 7 Dec 2021 14:37:40 +0100 Subject: [PATCH 03/19] fix ignore --- clients/algoliasearch-client-java-2/.gitignore | 2 ++ .../.openapi-generator-ignore | 18 ++++++++++++++++++ clients/algoliasearch-client-java-2/README.md | 1 - templates/java/gitignore.mustache | 2 ++ .../java/libraries/okhttp-gson/README.mustache | 3 --- 5 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/.openapi-generator-ignore diff --git a/clients/algoliasearch-client-java-2/.gitignore b/clients/algoliasearch-client-java-2/.gitignore index a530464afa..f4615b6d62 100644 --- a/clients/algoliasearch-client-java-2/.gitignore +++ b/clients/algoliasearch-client-java-2/.gitignore @@ -19,3 +19,5 @@ hs_err_pid* target .gradle build + +.openapi-generator diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore new file mode 100644 index 0000000000..7c56273a29 --- /dev/null +++ b/clients/algoliasearch-client-java-2/.openapi-generator-ignore @@ -0,0 +1,18 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +algoliasearch-core/com/algolia/auth/Http* +api/** +docs/** +gradle/** +src/** + +.travis.yml +build.gradle +build.sbt +git_push.sh +gradle* +settings.gradle diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 0ed7d5b650..55f2b7a136 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -2,7 +2,6 @@ Search API - API version: 0.1.0 - - Build date: 2021-12-03T15:12:45.552525+01:00[Europe/Paris] API powering the Search feature of Algolia. diff --git a/templates/java/gitignore.mustache b/templates/java/gitignore.mustache index a530464afa..f4615b6d62 100644 --- a/templates/java/gitignore.mustache +++ b/templates/java/gitignore.mustache @@ -19,3 +19,5 @@ hs_err_pid* target .gradle build + +.openapi-generator diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache index 3ef6e772ab..2a6fac75ee 100644 --- a/templates/java/libraries/okhttp-gson/README.mustache +++ b/templates/java/libraries/okhttp-gson/README.mustache @@ -2,9 +2,6 @@ {{appName}} - API version: {{appVersion}} -{{^hideGenerationTimestamp}} - - Build date: {{generatedDate}} -{{/hideGenerationTimestamp}} {{{appDescriptionWithNewLines}}} From 3be389dfb5f51cdb42dcb166f2501ea0bdb475d7 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 7 Dec 2021 17:15:47 +0100 Subject: [PATCH 04/19] =?UTF-8?q?remove=20duplicate=20dependency=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/java/pom.xml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/playground/java/pom.xml b/playground/java/pom.xml index eb4ed2f7be..6d6ffb65a6 100644 --- a/playground/java/pom.xml +++ b/playground/java/pom.xml @@ -30,21 +30,6 @@ system ${project.basedir}/../../clients/algoliasearch-client-java-2/target/algoliasearch-client-java-2-0.1.0.jar - - com.squareup.okhttp3 - okhttp - 4.9.1 - - - com.google.code.gson - gson - 2.8.9 - - - org.threeten - threetenbp - 1.5.0 - From 1b2519421477f29d541b5d94aba08a14338dc24d Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 11:31:40 +0100 Subject: [PATCH 05/19] use java 8 --- clients/algoliasearch-client-java-2/README.md | 2 +- .../com/algolia/ApiClient.java | 6 +-- .../algoliasearch-core/com/algolia/JSON.java | 6 +-- .../com/algolia/model/BaseIndexSettings.java | 18 +++---- .../com/algolia/model/BaseSearchParams.java | 20 +++---- .../com/algolia/model/BaseSearchResponse.java | 6 +-- .../com/algolia/model/BatchObject.java | 2 +- .../com/algolia/model/BatchResponse.java | 2 +- .../algolia/model/DeleteIndexResponse.java | 2 +- .../com/algolia/model/HighlightResult.java | 2 +- .../com/algolia/model/Index.java | 4 +- .../com/algolia/model/IndexSettings.java | 50 +++++++++--------- .../model/IndexSettingsAsSearchParams.java | 32 ++++++------ .../algolia/model/ListIndicesResponse.java | 2 +- .../algolia/model/MultipleQueriesObject.java | 2 +- .../model/MultipleQueriesResponse.java | 2 +- .../com/algolia/model/Operation.java | 2 +- .../algolia/model/OperationIndexObject.java | 2 +- .../algolia/model/OperationIndexResponse.java | 2 +- .../com/algolia/model/RankingInfo.java | 2 +- .../com/algolia/model/SearchHits.java | 2 +- .../com/algolia/model/SearchParams.java | 52 +++++++++---------- .../com/algolia/model/SearchResponse.java | 8 +-- .../algolia/model/SetSettingsResponse.java | 2 +- clients/algoliasearch-client-java-2/pom.xml | 8 +-- openapitools.json | 4 +- playground/java/pom.xml | 6 +-- .../main/java/com/{algolia => test}/App.java | 5 +- 28 files changed, 126 insertions(+), 127 deletions(-) rename playground/java/src/main/java/com/{algolia => test}/App.java (93%) diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 55f2b7a136..c00de0fb3e 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -11,7 +11,7 @@ API powering the Search feature of Algolia. ## Requirements Building the API client library requires: -1. Java 1.7+ +1. Java 1.8+ 2. Maven/Gradle ## Installation diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index 451be001fa..e8aed4ec74 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -20,9 +20,6 @@ import okhttp3.logging.HttpLoggingInterceptor.Level; import okio.BufferedSink; import okio.Okio; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; import javax.net.ssl.*; import java.io.File; @@ -43,6 +40,9 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java index e163f78b46..6049431f35 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java @@ -23,9 +23,6 @@ import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; import com.algolia.model.*; import okio.ByteString; @@ -36,6 +33,9 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index 16450911db..af4d3aa4de 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -90,7 +90,7 @@ public BaseIndexSettings replicas(List replicas) { public BaseIndexSettings addReplicasItem(String replicasItem) { if (this.replicas == null) { - this.replicas = new ArrayList(); + this.replicas = new ArrayList<>(); } this.replicas.add(replicasItem); return this; @@ -144,7 +144,7 @@ public BaseIndexSettings disableTypoToleranceOnWords(List disableTypoTol public BaseIndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { if (this.disableTypoToleranceOnWords == null) { - this.disableTypoToleranceOnWords = new ArrayList(); + this.disableTypoToleranceOnWords = new ArrayList<>(); } this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); return this; @@ -175,7 +175,7 @@ public BaseIndexSettings attributesToTransliterate(List attributesToTran public BaseIndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { if (this.attributesToTransliterate == null) { - this.attributesToTransliterate = new ArrayList(); + this.attributesToTransliterate = new ArrayList<>(); } this.attributesToTransliterate.add(attributesToTransliterateItem); return this; @@ -206,7 +206,7 @@ public BaseIndexSettings camelCaseAttributes(List camelCaseAttributes) { public BaseIndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { if (this.camelCaseAttributes == null) { - this.camelCaseAttributes = new ArrayList(); + this.camelCaseAttributes = new ArrayList<>(); } this.camelCaseAttributes.add(camelCaseAttributesItem); return this; @@ -237,7 +237,7 @@ public BaseIndexSettings decompoundedAttributes(Map decompounded public BaseIndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { if (this.decompoundedAttributes == null) { - this.decompoundedAttributes = new HashMap(); + this.decompoundedAttributes = new HashMap<>(); } this.decompoundedAttributes.put(key, decompoundedAttributesItem); return this; @@ -268,7 +268,7 @@ public BaseIndexSettings indexLanguages(List indexLanguages) { public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { if (this.indexLanguages == null) { - this.indexLanguages = new ArrayList(); + this.indexLanguages = new ArrayList<>(); } this.indexLanguages.add(indexLanguagesItem); return this; @@ -322,7 +322,7 @@ public BaseIndexSettings disablePrefixOnAttributes(List disablePrefixOnA public BaseIndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { if (this.disablePrefixOnAttributes == null) { - this.disablePrefixOnAttributes = new ArrayList(); + this.disablePrefixOnAttributes = new ArrayList<>(); } this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); return this; @@ -376,7 +376,7 @@ public BaseIndexSettings numericAttributesForFiltering(List numericAttri public BaseIndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { if (this.numericAttributesForFiltering == null) { - this.numericAttributesForFiltering = new ArrayList(); + this.numericAttributesForFiltering = new ArrayList<>(); } this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); return this; @@ -407,7 +407,7 @@ public BaseIndexSettings userData(Map userData) { public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { if (this.userData == null) { - this.userData = new HashMap(); + this.userData = new HashMap<>(); } this.userData.put(key, userDataItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index 0352cfc868..49c5b863db 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -242,7 +242,7 @@ public BaseSearchParams facetFilters(List facetFilters) { public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { if (this.facetFilters == null) { - this.facetFilters = new ArrayList(); + this.facetFilters = new ArrayList<>(); } this.facetFilters.add(facetFiltersItem); return this; @@ -273,7 +273,7 @@ public BaseSearchParams optionalFilters(List optionalFilters) { public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList(); + this.optionalFilters = new ArrayList<>(); } this.optionalFilters.add(optionalFiltersItem); return this; @@ -304,7 +304,7 @@ public BaseSearchParams numericFilters(List numericFilters) { public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { if (this.numericFilters == null) { - this.numericFilters = new ArrayList(); + this.numericFilters = new ArrayList<>(); } this.numericFilters.add(numericFiltersItem); return this; @@ -335,7 +335,7 @@ public BaseSearchParams tagFilters(List tagFilters) { public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { if (this.tagFilters == null) { - this.tagFilters = new ArrayList(); + this.tagFilters = new ArrayList<>(); } this.tagFilters.add(tagFiltersItem); return this; @@ -389,7 +389,7 @@ public BaseSearchParams facets(List facets) { public BaseSearchParams addFacetsItem(String facetsItem) { if (this.facets == null) { - this.facets = new ArrayList(); + this.facets = new ArrayList<>(); } this.facets.add(facetsItem); return this; @@ -676,7 +676,7 @@ public BaseSearchParams insideBoundingBox(List insideBoundingBox) { public BaseSearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList(); + this.insideBoundingBox = new ArrayList<>(); } this.insideBoundingBox.add(insideBoundingBoxItem); return this; @@ -707,7 +707,7 @@ public BaseSearchParams insidePolygon(List insidePolygon) { public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList(); + this.insidePolygon = new ArrayList<>(); } this.insidePolygon.add(insidePolygonItem); return this; @@ -738,7 +738,7 @@ public BaseSearchParams naturalLanguages(List naturalLanguages) { public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList(); + this.naturalLanguages = new ArrayList<>(); } this.naturalLanguages.add(naturalLanguagesItem); return this; @@ -769,7 +769,7 @@ public BaseSearchParams ruleContexts(List ruleContexts) { public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList(); + this.ruleContexts = new ArrayList<>(); } this.ruleContexts.add(ruleContextsItem); return this; @@ -915,7 +915,7 @@ public BaseSearchParams analyticsTags(List analyticsTags) { public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList(); + this.analyticsTags = new ArrayList<>(); } this.analyticsTags.add(analyticsTagsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index 8d3f7a17d8..1c6619c9d3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -299,7 +299,7 @@ public BaseSearchResponse facets(Map> facets) { public BaseSearchResponse putFacetsItem(String key, Map facetsItem) { if (this.facets == null) { - this.facets = new HashMap>(); + this.facets = new HashMap<>(); } this.facets.put(key, facetsItem); return this; @@ -330,7 +330,7 @@ public BaseSearchResponse facetsStats(Map public BaseSearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { if (this.facetsStats == null) { - this.facetsStats = new HashMap(); + this.facetsStats = new HashMap<>(); } this.facetsStats.put(key, facetsStatsItem); return this; @@ -683,7 +683,7 @@ public BaseSearchResponse userData(Map userData) { public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { if (this.userData == null) { - this.userData = new HashMap(); + this.userData = new HashMap<>(); } this.userData.put(key, userDataItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 27d37dfaac..9cc9f057a4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -46,7 +46,7 @@ public BatchObject requests(List requests) { public BatchObject addRequestsItem(Operation requestsItem) { if (this.requests == null) { - this.requests = new ArrayList(); + this.requests = new ArrayList<>(); } this.requests.add(requestsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index 0ebe939fc8..92c766e8cd 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -71,7 +71,7 @@ public BatchResponse objectIDs(List objectIDs) { public BatchResponse addObjectIDsItem(String objectIDsItem) { if (this.objectIDs == null) { - this.objectIDs = new ArrayList(); + this.objectIDs = new ArrayList<>(); } this.objectIDs.add(objectIDsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index 15870c7f38..7a6a7b55ee 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -23,7 +23,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.threeten.bp.OffsetDateTime; +import java.time.OffsetDateTime; /** * DeleteIndexResponse diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index 7aab8836b2..476549e64f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -151,7 +151,7 @@ public HighlightResult matchedWords(List matchedWords) { public HighlightResult addMatchedWordsItem(String matchedWordsItem) { if (this.matchedWords == null) { - this.matchedWords = new ArrayList(); + this.matchedWords = new ArrayList<>(); } this.matchedWords.add(matchedWordsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index f8aca281d5..d757f932ae 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -23,9 +23,9 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; -import org.threeten.bp.OffsetDateTime; /** * Index @@ -315,7 +315,7 @@ public Index replicas(List replicas) { public Index addReplicasItem(String replicasItem) { if (this.replicas == null) { - this.replicas = new ArrayList(); + this.replicas = new ArrayList<>(); } this.replicas.add(replicasItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index 9877072164..738fb6ebe0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -565,7 +565,7 @@ public IndexSettings replicas(List replicas) { public IndexSettings addReplicasItem(String replicasItem) { if (this.replicas == null) { - this.replicas = new ArrayList(); + this.replicas = new ArrayList<>(); } this.replicas.add(replicasItem); return this; @@ -619,7 +619,7 @@ public IndexSettings disableTypoToleranceOnWords(List disableTypoToleran public IndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { if (this.disableTypoToleranceOnWords == null) { - this.disableTypoToleranceOnWords = new ArrayList(); + this.disableTypoToleranceOnWords = new ArrayList<>(); } this.disableTypoToleranceOnWords.add(disableTypoToleranceOnWordsItem); return this; @@ -650,7 +650,7 @@ public IndexSettings attributesToTransliterate(List attributesToTranslit public IndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { if (this.attributesToTransliterate == null) { - this.attributesToTransliterate = new ArrayList(); + this.attributesToTransliterate = new ArrayList<>(); } this.attributesToTransliterate.add(attributesToTransliterateItem); return this; @@ -681,7 +681,7 @@ public IndexSettings camelCaseAttributes(List camelCaseAttributes) { public IndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { if (this.camelCaseAttributes == null) { - this.camelCaseAttributes = new ArrayList(); + this.camelCaseAttributes = new ArrayList<>(); } this.camelCaseAttributes.add(camelCaseAttributesItem); return this; @@ -712,7 +712,7 @@ public IndexSettings decompoundedAttributes(Map decompoundedAttr public IndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { if (this.decompoundedAttributes == null) { - this.decompoundedAttributes = new HashMap(); + this.decompoundedAttributes = new HashMap<>(); } this.decompoundedAttributes.put(key, decompoundedAttributesItem); return this; @@ -743,7 +743,7 @@ public IndexSettings indexLanguages(List indexLanguages) { public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { if (this.indexLanguages == null) { - this.indexLanguages = new ArrayList(); + this.indexLanguages = new ArrayList<>(); } this.indexLanguages.add(indexLanguagesItem); return this; @@ -797,7 +797,7 @@ public IndexSettings disablePrefixOnAttributes(List disablePrefixOnAttri public IndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { if (this.disablePrefixOnAttributes == null) { - this.disablePrefixOnAttributes = new ArrayList(); + this.disablePrefixOnAttributes = new ArrayList<>(); } this.disablePrefixOnAttributes.add(disablePrefixOnAttributesItem); return this; @@ -851,7 +851,7 @@ public IndexSettings numericAttributesForFiltering(List numericAttribute public IndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { if (this.numericAttributesForFiltering == null) { - this.numericAttributesForFiltering = new ArrayList(); + this.numericAttributesForFiltering = new ArrayList<>(); } this.numericAttributesForFiltering.add(numericAttributesForFilteringItem); return this; @@ -882,7 +882,7 @@ public IndexSettings userData(Map userData) { public IndexSettings putUserDataItem(String key, Object userDataItem) { if (this.userData == null) { - this.userData = new HashMap(); + this.userData = new HashMap<>(); } this.userData.put(key, userDataItem); return this; @@ -913,7 +913,7 @@ public IndexSettings searchableAttributes(List searchableAttributes) { public IndexSettings addSearchableAttributesItem(String searchableAttributesItem) { if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList(); + this.searchableAttributes = new ArrayList<>(); } this.searchableAttributes.add(searchableAttributesItem); return this; @@ -944,7 +944,7 @@ public IndexSettings attributesForFaceting(List attributesForFaceting) { public IndexSettings addAttributesForFacetingItem(String attributesForFacetingItem) { if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList(); + this.attributesForFaceting = new ArrayList<>(); } this.attributesForFaceting.add(attributesForFacetingItem); return this; @@ -975,7 +975,7 @@ public IndexSettings unretrievableAttributes(List unretrievableAttribute public IndexSettings addUnretrievableAttributesItem(String unretrievableAttributesItem) { if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList(); + this.unretrievableAttributes = new ArrayList<>(); } this.unretrievableAttributes.add(unretrievableAttributesItem); return this; @@ -1006,7 +1006,7 @@ public IndexSettings attributesToRetrieve(List attributesToRetrieve) { public IndexSettings addAttributesToRetrieveItem(String attributesToRetrieveItem) { if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList(); + this.attributesToRetrieve = new ArrayList<>(); } this.attributesToRetrieve.add(attributesToRetrieveItem); return this; @@ -1037,7 +1037,7 @@ public IndexSettings restrictSearchableAttributes(List restrictSearchabl public IndexSettings addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList(); + this.restrictSearchableAttributes = new ArrayList<>(); } this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); return this; @@ -1068,7 +1068,7 @@ public IndexSettings ranking(List ranking) { public IndexSettings addRankingItem(String rankingItem) { if (this.ranking == null) { - this.ranking = new ArrayList(); + this.ranking = new ArrayList<>(); } this.ranking.add(rankingItem); return this; @@ -1099,7 +1099,7 @@ public IndexSettings customRanking(List customRanking) { public IndexSettings addCustomRankingItem(String customRankingItem) { if (this.customRanking == null) { - this.customRanking = new ArrayList(); + this.customRanking = new ArrayList<>(); } this.customRanking.add(customRankingItem); return this; @@ -1153,7 +1153,7 @@ public IndexSettings attributesToHighlight(List attributesToHighlight) { public IndexSettings addAttributesToHighlightItem(String attributesToHighlightItem) { if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList(); + this.attributesToHighlight = new ArrayList<>(); } this.attributesToHighlight.add(attributesToHighlightItem); return this; @@ -1184,7 +1184,7 @@ public IndexSettings attributesToSnippet(List attributesToSnippet) { public IndexSettings addAttributesToSnippetItem(String attributesToSnippetItem) { if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList(); + this.attributesToSnippet = new ArrayList<>(); } this.attributesToSnippet.add(attributesToSnippetItem); return this; @@ -1422,7 +1422,7 @@ public IndexSettings disableTypoToleranceOnAttributes(List disableTypoTo public IndexSettings addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList(); + this.disableTypoToleranceOnAttributes = new ArrayList<>(); } this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); return this; @@ -1545,7 +1545,7 @@ public IndexSettings queryLanguages(List queryLanguages) { public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList(); + this.queryLanguages = new ArrayList<>(); } this.queryLanguages.add(queryLanguagesItem); return this; @@ -1714,7 +1714,7 @@ public IndexSettings optionalWords(List optionalWords) { public IndexSettings addOptionalWordsItem(String optionalWordsItem) { if (this.optionalWords == null) { - this.optionalWords = new ArrayList(); + this.optionalWords = new ArrayList<>(); } this.optionalWords.add(optionalWordsItem); return this; @@ -1745,7 +1745,7 @@ public IndexSettings disableExactOnAttributes(List disableExactOnAttribu public IndexSettings addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList(); + this.disableExactOnAttributes = new ArrayList<>(); } this.disableExactOnAttributes.add(disableExactOnAttributesItem); return this; @@ -1799,7 +1799,7 @@ public IndexSettings alternativesAsExact(List alternati public IndexSettings addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList(); + this.alternativesAsExact = new ArrayList<>(); } this.alternativesAsExact.add(alternativesAsExactItem); return this; @@ -1830,7 +1830,7 @@ public IndexSettings advancedSyntaxFeatures(List adv public IndexSettings addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList(); + this.advancedSyntaxFeatures = new ArrayList<>(); } this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); return this; @@ -1957,7 +1957,7 @@ public IndexSettings responseFields(List responseFields) { public IndexSettings addResponseFieldsItem(String responseFieldsItem) { if (this.responseFields == null) { - this.responseFields = new ArrayList(); + this.responseFields = new ArrayList<>(); } this.responseFields.add(responseFieldsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index 567b3135a6..92bdbfb7c1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -512,7 +512,7 @@ public IndexSettingsAsSearchParams searchableAttributes(List searchableA public IndexSettingsAsSearchParams addSearchableAttributesItem(String searchableAttributesItem) { if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList(); + this.searchableAttributes = new ArrayList<>(); } this.searchableAttributes.add(searchableAttributesItem); return this; @@ -543,7 +543,7 @@ public IndexSettingsAsSearchParams attributesForFaceting(List attributes public IndexSettingsAsSearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList(); + this.attributesForFaceting = new ArrayList<>(); } this.attributesForFaceting.add(attributesForFacetingItem); return this; @@ -574,7 +574,7 @@ public IndexSettingsAsSearchParams unretrievableAttributes(List unretrie public IndexSettingsAsSearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList(); + this.unretrievableAttributes = new ArrayList<>(); } this.unretrievableAttributes.add(unretrievableAttributesItem); return this; @@ -605,7 +605,7 @@ public IndexSettingsAsSearchParams attributesToRetrieve(List attributesT public IndexSettingsAsSearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList(); + this.attributesToRetrieve = new ArrayList<>(); } this.attributesToRetrieve.add(attributesToRetrieveItem); return this; @@ -636,7 +636,7 @@ public IndexSettingsAsSearchParams restrictSearchableAttributes(List res public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList(); + this.restrictSearchableAttributes = new ArrayList<>(); } this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); return this; @@ -667,7 +667,7 @@ public IndexSettingsAsSearchParams ranking(List ranking) { public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { if (this.ranking == null) { - this.ranking = new ArrayList(); + this.ranking = new ArrayList<>(); } this.ranking.add(rankingItem); return this; @@ -698,7 +698,7 @@ public IndexSettingsAsSearchParams customRanking(List customRanking) { public IndexSettingsAsSearchParams addCustomRankingItem(String customRankingItem) { if (this.customRanking == null) { - this.customRanking = new ArrayList(); + this.customRanking = new ArrayList<>(); } this.customRanking.add(customRankingItem); return this; @@ -752,7 +752,7 @@ public IndexSettingsAsSearchParams attributesToHighlight(List attributes public IndexSettingsAsSearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList(); + this.attributesToHighlight = new ArrayList<>(); } this.attributesToHighlight.add(attributesToHighlightItem); return this; @@ -783,7 +783,7 @@ public IndexSettingsAsSearchParams attributesToSnippet(List attributesTo public IndexSettingsAsSearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList(); + this.attributesToSnippet = new ArrayList<>(); } this.attributesToSnippet.add(attributesToSnippetItem); return this; @@ -1021,7 +1021,7 @@ public IndexSettingsAsSearchParams disableTypoToleranceOnAttributes(List public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList(); + this.disableTypoToleranceOnAttributes = new ArrayList<>(); } this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); return this; @@ -1144,7 +1144,7 @@ public IndexSettingsAsSearchParams queryLanguages(List queryLanguages) { public IndexSettingsAsSearchParams addQueryLanguagesItem(String queryLanguagesItem) { if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList(); + this.queryLanguages = new ArrayList<>(); } this.queryLanguages.add(queryLanguagesItem); return this; @@ -1313,7 +1313,7 @@ public IndexSettingsAsSearchParams optionalWords(List optionalWords) { public IndexSettingsAsSearchParams addOptionalWordsItem(String optionalWordsItem) { if (this.optionalWords == null) { - this.optionalWords = new ArrayList(); + this.optionalWords = new ArrayList<>(); } this.optionalWords.add(optionalWordsItem); return this; @@ -1344,7 +1344,7 @@ public IndexSettingsAsSearchParams disableExactOnAttributes(List disable public IndexSettingsAsSearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList(); + this.disableExactOnAttributes = new ArrayList<>(); } this.disableExactOnAttributes.add(disableExactOnAttributesItem); return this; @@ -1398,7 +1398,7 @@ public IndexSettingsAsSearchParams alternativesAsExact(List(); + this.alternativesAsExact = new ArrayList<>(); } this.alternativesAsExact.add(alternativesAsExactItem); return this; @@ -1429,7 +1429,7 @@ public IndexSettingsAsSearchParams advancedSyntaxFeatures(List(); + this.advancedSyntaxFeatures = new ArrayList<>(); } this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); return this; @@ -1556,7 +1556,7 @@ public IndexSettingsAsSearchParams responseFields(List responseFields) { public IndexSettingsAsSearchParams addResponseFieldsItem(String responseFieldsItem) { if (this.responseFields == null) { - this.responseFields = new ArrayList(); + this.responseFields = new ArrayList<>(); } this.responseFields.add(responseFieldsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index d99fbfd0c4..5b0ff84cb0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -49,7 +49,7 @@ public ListIndicesResponse items(List items) { public ListIndicesResponse addItemsItem(Index itemsItem) { if (this.items == null) { - this.items = new ArrayList(); + this.items = new ArrayList<>(); } this.items.add(itemsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index f8562ac234..e2c144a16b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -34,7 +34,7 @@ public class MultipleQueriesObject { public static final String SERIALIZED_NAME_REQUESTS = "requests"; @SerializedName(SERIALIZED_NAME_REQUESTS) - private List requests = new ArrayList(); + private List requests = new ArrayList<>(); /** * Gets or Sets strategy diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index f531ba4b4d..bd51afe3a1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -45,7 +45,7 @@ public MultipleQueriesResponse results(List results) { public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { if (this.results == null) { - this.results = new ArrayList(); + this.results = new ArrayList<>(); } this.results.add(resultsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index 7ff3742e68..640e84a15e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -129,7 +129,7 @@ public Operation body(Map body) { public Operation putBodyItem(String key, Object bodyItem) { if (this.body == null) { - this.body = new HashMap(); + this.body = new HashMap<>(); } this.body.put(key, bodyItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index 93c37029fb..b6a5835bc4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -194,7 +194,7 @@ public OperationIndexObject scope(List scope) { public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { if (this.scope == null) { - this.scope = new ArrayList(); + this.scope = new ArrayList<>(); } this.scope.add(scopeItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index 053cf38c21..670cbd8043 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -23,7 +23,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.threeten.bp.OffsetDateTime; +import java.time.OffsetDateTime; /** * OperationIndexResponse diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index e5c689c991..98d0ba1af8 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -178,7 +178,7 @@ public RankingInfo matchedGeoLocation(Map public RankingInfo putMatchedGeoLocationItem(String key, RankingInfoMatchedGeoLocation matchedGeoLocationItem) { if (this.matchedGeoLocation == null) { - this.matchedGeoLocation = new HashMap(); + this.matchedGeoLocation = new HashMap<>(); } this.matchedGeoLocation.put(key, matchedGeoLocationItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index bc2e2d0eaa..98d8db1641 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -45,7 +45,7 @@ public SearchHits hits(List hits) { public SearchHits addHitsItem(Record hitsItem) { if (this.hits == null) { - this.hits = new ArrayList(); + this.hits = new ArrayList<>(); } this.hits.add(hitsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index f2129a0c94..4d2c31e149 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -716,7 +716,7 @@ public SearchParams facetFilters(List facetFilters) { public SearchParams addFacetFiltersItem(String facetFiltersItem) { if (this.facetFilters == null) { - this.facetFilters = new ArrayList(); + this.facetFilters = new ArrayList<>(); } this.facetFilters.add(facetFiltersItem); return this; @@ -747,7 +747,7 @@ public SearchParams optionalFilters(List optionalFilters) { public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { if (this.optionalFilters == null) { - this.optionalFilters = new ArrayList(); + this.optionalFilters = new ArrayList<>(); } this.optionalFilters.add(optionalFiltersItem); return this; @@ -778,7 +778,7 @@ public SearchParams numericFilters(List numericFilters) { public SearchParams addNumericFiltersItem(String numericFiltersItem) { if (this.numericFilters == null) { - this.numericFilters = new ArrayList(); + this.numericFilters = new ArrayList<>(); } this.numericFilters.add(numericFiltersItem); return this; @@ -809,7 +809,7 @@ public SearchParams tagFilters(List tagFilters) { public SearchParams addTagFiltersItem(String tagFiltersItem) { if (this.tagFilters == null) { - this.tagFilters = new ArrayList(); + this.tagFilters = new ArrayList<>(); } this.tagFilters.add(tagFiltersItem); return this; @@ -863,7 +863,7 @@ public SearchParams facets(List facets) { public SearchParams addFacetsItem(String facetsItem) { if (this.facets == null) { - this.facets = new ArrayList(); + this.facets = new ArrayList<>(); } this.facets.add(facetsItem); return this; @@ -1150,7 +1150,7 @@ public SearchParams insideBoundingBox(List insideBoundingBox) { public SearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { if (this.insideBoundingBox == null) { - this.insideBoundingBox = new ArrayList(); + this.insideBoundingBox = new ArrayList<>(); } this.insideBoundingBox.add(insideBoundingBoxItem); return this; @@ -1181,7 +1181,7 @@ public SearchParams insidePolygon(List insidePolygon) { public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { if (this.insidePolygon == null) { - this.insidePolygon = new ArrayList(); + this.insidePolygon = new ArrayList<>(); } this.insidePolygon.add(insidePolygonItem); return this; @@ -1212,7 +1212,7 @@ public SearchParams naturalLanguages(List naturalLanguages) { public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { if (this.naturalLanguages == null) { - this.naturalLanguages = new ArrayList(); + this.naturalLanguages = new ArrayList<>(); } this.naturalLanguages.add(naturalLanguagesItem); return this; @@ -1243,7 +1243,7 @@ public SearchParams ruleContexts(List ruleContexts) { public SearchParams addRuleContextsItem(String ruleContextsItem) { if (this.ruleContexts == null) { - this.ruleContexts = new ArrayList(); + this.ruleContexts = new ArrayList<>(); } this.ruleContexts.add(ruleContextsItem); return this; @@ -1389,7 +1389,7 @@ public SearchParams analyticsTags(List analyticsTags) { public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { if (this.analyticsTags == null) { - this.analyticsTags = new ArrayList(); + this.analyticsTags = new ArrayList<>(); } this.analyticsTags.add(analyticsTagsItem); return this; @@ -1489,7 +1489,7 @@ public SearchParams searchableAttributes(List searchableAttributes) { public SearchParams addSearchableAttributesItem(String searchableAttributesItem) { if (this.searchableAttributes == null) { - this.searchableAttributes = new ArrayList(); + this.searchableAttributes = new ArrayList<>(); } this.searchableAttributes.add(searchableAttributesItem); return this; @@ -1520,7 +1520,7 @@ public SearchParams attributesForFaceting(List attributesForFaceting) { public SearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { if (this.attributesForFaceting == null) { - this.attributesForFaceting = new ArrayList(); + this.attributesForFaceting = new ArrayList<>(); } this.attributesForFaceting.add(attributesForFacetingItem); return this; @@ -1551,7 +1551,7 @@ public SearchParams unretrievableAttributes(List unretrievableAttributes public SearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { if (this.unretrievableAttributes == null) { - this.unretrievableAttributes = new ArrayList(); + this.unretrievableAttributes = new ArrayList<>(); } this.unretrievableAttributes.add(unretrievableAttributesItem); return this; @@ -1582,7 +1582,7 @@ public SearchParams attributesToRetrieve(List attributesToRetrieve) { public SearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { if (this.attributesToRetrieve == null) { - this.attributesToRetrieve = new ArrayList(); + this.attributesToRetrieve = new ArrayList<>(); } this.attributesToRetrieve.add(attributesToRetrieveItem); return this; @@ -1613,7 +1613,7 @@ public SearchParams restrictSearchableAttributes(List restrictSearchable public SearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { if (this.restrictSearchableAttributes == null) { - this.restrictSearchableAttributes = new ArrayList(); + this.restrictSearchableAttributes = new ArrayList<>(); } this.restrictSearchableAttributes.add(restrictSearchableAttributesItem); return this; @@ -1644,7 +1644,7 @@ public SearchParams ranking(List ranking) { public SearchParams addRankingItem(String rankingItem) { if (this.ranking == null) { - this.ranking = new ArrayList(); + this.ranking = new ArrayList<>(); } this.ranking.add(rankingItem); return this; @@ -1675,7 +1675,7 @@ public SearchParams customRanking(List customRanking) { public SearchParams addCustomRankingItem(String customRankingItem) { if (this.customRanking == null) { - this.customRanking = new ArrayList(); + this.customRanking = new ArrayList<>(); } this.customRanking.add(customRankingItem); return this; @@ -1729,7 +1729,7 @@ public SearchParams attributesToHighlight(List attributesToHighlight) { public SearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { if (this.attributesToHighlight == null) { - this.attributesToHighlight = new ArrayList(); + this.attributesToHighlight = new ArrayList<>(); } this.attributesToHighlight.add(attributesToHighlightItem); return this; @@ -1760,7 +1760,7 @@ public SearchParams attributesToSnippet(List attributesToSnippet) { public SearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { if (this.attributesToSnippet == null) { - this.attributesToSnippet = new ArrayList(); + this.attributesToSnippet = new ArrayList<>(); } this.attributesToSnippet.add(attributesToSnippetItem); return this; @@ -1998,7 +1998,7 @@ public SearchParams disableTypoToleranceOnAttributes(List disableTypoTol public SearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { if (this.disableTypoToleranceOnAttributes == null) { - this.disableTypoToleranceOnAttributes = new ArrayList(); + this.disableTypoToleranceOnAttributes = new ArrayList<>(); } this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); return this; @@ -2121,7 +2121,7 @@ public SearchParams queryLanguages(List queryLanguages) { public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { if (this.queryLanguages == null) { - this.queryLanguages = new ArrayList(); + this.queryLanguages = new ArrayList<>(); } this.queryLanguages.add(queryLanguagesItem); return this; @@ -2290,7 +2290,7 @@ public SearchParams optionalWords(List optionalWords) { public SearchParams addOptionalWordsItem(String optionalWordsItem) { if (this.optionalWords == null) { - this.optionalWords = new ArrayList(); + this.optionalWords = new ArrayList<>(); } this.optionalWords.add(optionalWordsItem); return this; @@ -2321,7 +2321,7 @@ public SearchParams disableExactOnAttributes(List disableExactOnAttribut public SearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { if (this.disableExactOnAttributes == null) { - this.disableExactOnAttributes = new ArrayList(); + this.disableExactOnAttributes = new ArrayList<>(); } this.disableExactOnAttributes.add(disableExactOnAttributesItem); return this; @@ -2375,7 +2375,7 @@ public SearchParams alternativesAsExact(List alternativ public SearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { if (this.alternativesAsExact == null) { - this.alternativesAsExact = new ArrayList(); + this.alternativesAsExact = new ArrayList<>(); } this.alternativesAsExact.add(alternativesAsExactItem); return this; @@ -2406,7 +2406,7 @@ public SearchParams advancedSyntaxFeatures(List adva public SearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { if (this.advancedSyntaxFeatures == null) { - this.advancedSyntaxFeatures = new ArrayList(); + this.advancedSyntaxFeatures = new ArrayList<>(); } this.advancedSyntaxFeatures.add(advancedSyntaxFeaturesItem); return this; @@ -2533,7 +2533,7 @@ public SearchParams responseFields(List responseFields) { public SearchParams addResponseFieldsItem(String responseFieldsItem) { if (this.responseFields == null) { - this.responseFields = new ArrayList(); + this.responseFields = new ArrayList<>(); } this.responseFields.add(responseFieldsItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index 68fe4797b9..13e72e973b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -135,7 +135,7 @@ public class SearchResponse { public static final String SERIALIZED_NAME_HITS = "hits"; @SerializedName(SERIALIZED_NAME_HITS) - private List hits = new ArrayList(); + private List hits = new ArrayList<>(); public SearchResponse abTestID(Integer abTestID) { @@ -307,7 +307,7 @@ public SearchResponse facets(Map> facets) { public SearchResponse putFacetsItem(String key, Map facetsItem) { if (this.facets == null) { - this.facets = new HashMap>(); + this.facets = new HashMap<>(); } this.facets.put(key, facetsItem); return this; @@ -338,7 +338,7 @@ public SearchResponse facetsStats(Map fac public SearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { if (this.facetsStats == null) { - this.facetsStats = new HashMap(); + this.facetsStats = new HashMap<>(); } this.facetsStats.put(key, facetsStatsItem); return this; @@ -691,7 +691,7 @@ public SearchResponse userData(Map userData) { public SearchResponse putUserDataItem(String key, Object userDataItem) { if (this.userData == null) { - this.userData = new HashMap(); + this.userData = new HashMap<>(); } this.userData.put(key, userDataItem); return this; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 37b25d65e6..2b7b7cfa3f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -23,7 +23,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import org.threeten.bp.OffsetDateTime; +import java.time.OffsetDateTime; /** * SetSettingsResponse diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml index 436f8967c3..bb712df43f 100644 --- a/clients/algoliasearch-client-java-2/pom.xml +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -197,11 +197,6 @@ commons-lang3 ${commons-lang3-version} - - org.threeten - threetenbp - ${threetenbp-version} - org.openapitools jackson-databind-nullable @@ -209,7 +204,7 @@ - 1.7 + 1.8 ${java.version} ${java.version} 1.8.5 @@ -218,7 +213,6 @@ 2.8.9 3.11 0.2.1 - 1.5.0 UTF-8 diff --git a/openapitools.json b/openapitools.json index 332f6dca61..cf0ece6db3 100644 --- a/openapitools.json +++ b/openapitools.json @@ -76,7 +76,9 @@ "gitUserId": "algolia", "gitRepoId": "algoliasearch-client-java-2", "additionalProperties": { - "sourceFolder": "algoliasearch-core" + "sourceFolder": "algoliasearch-core", + "java8": true, + "dateLibrary": "java8" } } } diff --git a/playground/java/pom.xml b/playground/java/pom.xml index 6d6ffb65a6..0247f2fa20 100644 --- a/playground/java/pom.xml +++ b/playground/java/pom.xml @@ -4,8 +4,8 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.algolia - com.algolia + com.test + java-playground 1.0-SNAPSHOT java-playground @@ -78,7 +78,7 @@ exec-maven-plugin 1.2.1 - com.algolia.App + com.test.App diff --git a/playground/java/src/main/java/com/algolia/App.java b/playground/java/src/main/java/com/test/App.java similarity index 93% rename from playground/java/src/main/java/com/algolia/App.java rename to playground/java/src/main/java/com/test/App.java index 6a6642e222..e53591faf1 100644 --- a/playground/java/src/main/java/com/algolia/App.java +++ b/playground/java/src/main/java/com/test/App.java @@ -1,4 +1,4 @@ -package com.algolia; +package com.test; /** * Hello world! @@ -8,6 +8,9 @@ import com.algolia.auth.*; import com.algolia.model.*; import com.algolia.search.SearchApi; +import com.algolia.ApiClient; +import com.algolia.ApiException; +import com.algolia.Configuration; public class App { public static void main(String[] args) { From 9ec11c7aed055c87f88cfa354e65588f0962d4ef Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 15:00:51 +0100 Subject: [PATCH 06/19] add command --- .gitignore | 2 ++ package.json | 2 ++ playground/java/pom.xml | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index db0268e849..d5f96f480e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ yarn-error.log .vscode target + +**/.DS_Store diff --git a/package.json b/package.json index 7f729dfdee..3e4811c115 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build:spec:json": "yarn build:spec:search:json && yarn build:spec:recommend:json", "build:spec": "yarn build:spec:search && yarn build:spec:recommend && yarn build:spec:personalization", "clean": "rm -rf **/dist **/build **/node_modules", + "client:build-java": "mvn clean install -f clients/algoliasearch-client-java-2/pom.xml", "client:build-js:personalization": "yarn workspace @algolia/client-personalization build", "client:build-js:recommend": "yarn workspace @algolia/recommend build", "client:build-js:search": "yarn workspace @algolia/client-search build", @@ -35,6 +36,7 @@ "generate:recommend": "yarn generate:js:recommend", "generate:search": "yarn generate:js:search", "generate": "yarn generate:js && yarn format:specs", + "playground:java": "mvn clean compile exec:java -f playground/java/pom.xml", "playground:js:personalization": "yarn workspace javascript-playground start:personalization", "playground:js:recommend": "yarn workspace javascript-playground start:recommend", "playground:js:search": "yarn workspace javascript-playground start:search", diff --git a/playground/java/pom.xml b/playground/java/pom.xml index 0247f2fa20..b5b6d250b0 100644 --- a/playground/java/pom.xml +++ b/playground/java/pom.xml @@ -27,8 +27,6 @@ com.algolia algoliasearch-client-java-2 0.1.0 - system - ${project.basedir}/../../clients/algoliasearch-client-java-2/target/algoliasearch-client-java-2-0.1.0.jar @@ -76,7 +74,7 @@ org.codehaus.mojo exec-maven-plugin - 1.2.1 + 3.0.0 com.test.App From 3e4ad7d762e33b4ba278604fe19daa24619ba16a Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 15:06:23 +0100 Subject: [PATCH 07/19] remove gradle from ignore --- clients/algoliasearch-client-java-2/.gitignore | 3 --- templates/java/gitignore.mustache | 3 --- 2 files changed, 6 deletions(-) diff --git a/clients/algoliasearch-client-java-2/.gitignore b/clients/algoliasearch-client-java-2/.gitignore index f4615b6d62..7cf2ea329d 100644 --- a/clients/algoliasearch-client-java-2/.gitignore +++ b/clients/algoliasearch-client-java-2/.gitignore @@ -8,9 +8,6 @@ *.war *.ear -# exclude jar for gradle wrapper -!gradle/wrapper/*.jar - # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* diff --git a/templates/java/gitignore.mustache b/templates/java/gitignore.mustache index f4615b6d62..7cf2ea329d 100644 --- a/templates/java/gitignore.mustache +++ b/templates/java/gitignore.mustache @@ -8,9 +8,6 @@ *.war *.ear -# exclude jar for gradle wrapper -!gradle/wrapper/*.jar - # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* From 877b31827cc2bd9673edead2c6f373d07add16ac Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 16:45:32 +0100 Subject: [PATCH 08/19] use post gen script to fix default type --- .../algoliasearch-core/com/algolia/model/IndexSettings.java | 2 +- .../com/algolia/model/IndexSettingsAsSearchParams.java | 2 +- .../algoliasearch-core/com/algolia/model/SearchParams.java | 2 +- package.json | 2 +- scripts/post-gen-java.sh | 3 +++ specs/search/common/schemas/IndexSettings.yml | 6 +++--- 6 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 scripts/post-gen-java.sh diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index 738fb6ebe0..b073e36709 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -554,7 +554,7 @@ public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOExc public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) - private Object renderingContent; + private Object renderingContent = new Object(); public IndexSettings replicas(List replicas) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index 92bdbfb7c1..f315c72f79 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -501,7 +501,7 @@ public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOExc public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) - private Object renderingContent; + private Object renderingContent = new Object(); public IndexSettingsAsSearchParams searchableAttributes(List searchableAttributes) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 4d2c31e149..43066ac6c8 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -636,7 +636,7 @@ public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOExc public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) - private Object renderingContent; + private Object renderingContent = new Object(); public SearchParams query(String query) { diff --git a/package.json b/package.json index 3e4811c115..5d821aedcc 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "lint:client:fix": "eslint --ext=ts ${CLIENT} --fix", "lint": "eslint --ext=ts .", "format:specs": "yarn prettier --write specs", - "generate:java:search": "yarn openapi-generator-cli generate --generator-key java-search", + "generate:java:search": "yarn openapi-generator-cli generate --generator-key java-search && bash scripts/post-gen-java.sh clients/algoliasearch-client-java-2/", "generate:js:personalization": "yarn openapi-generator-cli generate --generator-key javascript-personalization && CLIENT=client-personalization yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-personalization/ yarn lint:client:fix", "generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/recommend/ yarn lint:client:fix", "generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-search && CLIENT=client-search yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-search/ yarn lint:client:fix", diff --git a/scripts/post-gen-java.sh b/scripts/post-gen-java.sh new file mode 100644 index 0000000000..e473801f45 --- /dev/null +++ b/scripts/post-gen-java.sh @@ -0,0 +1,3 @@ +CLIENT_FOLDER=$1 + +find $CLIENT_FOLDER -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' diff --git a/specs/search/common/schemas/IndexSettings.yml b/specs/search/common/schemas/IndexSettings.yml index b84df1f9f3..49dcf0bde5 100644 --- a/specs/search/common/schemas/IndexSettings.yml +++ b/specs/search/common/schemas/IndexSettings.yml @@ -39,7 +39,7 @@ baseIndexSettings: type: object additionalProperties: true description: Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. - default: null + default: {} indexLanguages: type: array items: @@ -70,7 +70,7 @@ baseIndexSettings: type: object additionalProperties: true description: Lets you store custom data in your indices. - default: null + default: {} indexSettingsAsSearchParams: type: object @@ -300,4 +300,4 @@ indexSettingsAsSearchParams: renderingContent: type: object description: Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. - default: null + default: {} From e45bd380a6f1492e5014aabf5066387a6ef2b1a4 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 17:05:47 +0100 Subject: [PATCH 09/19] format and fix oneOf --- .../com/algolia/ApiCallback.java | 78 +- .../com/algolia/ApiClient.java | 2688 +++++++++-------- .../com/algolia/ApiException.java | 171 +- .../com/algolia/ApiResponse.java | 76 +- .../com/algolia/Configuration.java | 42 +- .../com/algolia/GzipRequestInterceptor.java | 109 +- .../algoliasearch-core/com/algolia/JSON.java | 638 ++-- .../algoliasearch-core/com/algolia/Pair.java | 64 +- .../com/algolia/ProgressRequestBody.java | 98 +- .../com/algolia/ProgressResponseBody.java | 79 +- .../com/algolia/ServerConfiguration.java | 104 +- .../com/algolia/ServerVariable.java | 31 +- .../com/algolia/StringUtil.java | 4 +- .../com/algolia/auth/ApiKeyAuth.java | 13 +- .../com/algolia/auth/Authentication.java | 26 +- .../com/algolia/model/BaseIndexSettings.java | 371 ++- .../com/algolia/model/BaseSearchParams.java | 736 +++-- .../com/algolia/model/BaseSearchResponse.java | 514 ++-- .../model/BaseSearchResponseFacetsStats.java | 57 +- .../com/algolia/model/BatchObject.java | 21 +- .../com/algolia/model/BatchResponse.java | 40 +- .../algolia/model/DeleteIndexResponse.java | 35 +- .../com/algolia/model/ErrorBase.java | 24 +- .../com/algolia/model/HighlightResult.java | 107 +- .../com/algolia/model/Index.java | 221 +- .../com/algolia/model/IndexSettings.java | 1654 ++++++---- .../model/IndexSettingsAsSearchParams.java | 1417 +++++---- .../algolia/model/ListIndicesResponse.java | 35 +- .../com/algolia/model/MultipleQueries.java | 93 +- .../algolia/model/MultipleQueriesObject.java | 45 +- .../model/MultipleQueriesResponse.java | 20 +- .../com/algolia/model/OneOfintegerstring.java | 3 + .../com/algolia/model/Operation.java | 59 +- .../algolia/model/OperationIndexObject.java | 96 +- .../algolia/model/OperationIndexResponse.java | 40 +- .../com/algolia/model/RankingInfo.java | 237 +- .../model/RankingInfoMatchedGeoLocation.java | 50 +- .../com/algolia/model/Record.java | 106 +- .../com/algolia/model/SaveObjectResponse.java | 51 +- .../com/algolia/model/SearchHits.java | 20 +- .../com/algolia/model/SearchParams.java | 2003 +++++++----- .../com/algolia/model/SearchResponse.java | 510 ++-- .../algolia/model/SetSettingsResponse.java | 40 +- .../com/algolia/model/SnippetResult.java | 64 +- .../com/algolia/search/SearchApi.java | 1573 ++++++---- package.json | 3 +- scripts/post-gen-java.sh | 4 + specs/search/common/schemas/SearchParams.yml | 6 +- yarn.lock | 47 + 49 files changed, 8385 insertions(+), 6138 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java index cd5a695708..856ee70a4a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java @@ -3,20 +3,18 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; import java.io.IOException; - -import java.util.Map; import java.util.List; +import java.util.Map; /** * Callback for asynchronous API call. @@ -24,39 +22,47 @@ * @param The return type */ public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure( + ApiException e, + int statusCode, + Map> responseHeaders + ); - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess( + T result, + int statusCode, + Map> responseHeaders + ); - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index e8aed4ec74..b393a793d5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -3,25 +3,17 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.BufferedSink; -import okio.Okio; - -import javax.net.ssl.*; +import com.algolia.auth.ApiKeyAuth; +import com.algolia.auth.Authentication; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -48,1264 +40,1458 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; - -import com.algolia.auth.Authentication; -import com.algolia.auth.ApiKeyAuth; +import javax.net.ssl.*; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; public class ApiClient { - private String basePath = "http://localhost"; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; - - /* - * Basic constructor for ApiClient - */ - public ApiClient() { - init(); - initHttpClient(); - - // Setup authentications (key: authentication name, value: authentication). - authentications.put("apiKey", new ApiKeyAuth("header", "X-Algolia-API-Key")); - authentications.put("appId", new ApiKeyAuth("header", "X-Algolia-Application-Id")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /* - * Basic constructor with custom OkHttpClient - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication). - authentications.put("apiKey", new ApiKeyAuth("header", "X-Algolia-API-Key")); - authentications.put("appId", new ApiKeyAuth("header", "X-Algolia-Application-Id")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { - builder.addInterceptor(interceptor); - } - + private String basePath = "http://localhost"; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put( + "apiKey", + new ApiKeyAuth("header", "X-Algolia-API-Key") + ); + authentications.put( + "appId", + new ApiKeyAuth("header", "X-Algolia-Application-Id") + ); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Basic constructor with custom OkHttpClient + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put( + "apiKey", + new ApiKeyAuth("header", "X-Algolia-API-Key") + ); + authentications.put( + "appId", + new ApiKeyAuth("header", "X-Algolia-Application-Id") + ); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor : interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.1.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = + Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + this.json.setOffsetDateTimeFormat(dateFormat); + return this; + } + + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + this.json.setLocalDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = + httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); httpClient = builder.build(); - } - - private void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/0.1.0/java"); - - authentications = new HashMap(); - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g http://localhost - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client, which must never be null. - * - * @param newHttpClient An instance of OkHttpClient - * @return Api Client - * @throws NullPointerException when newHttpClient is null - */ - public ApiClient setHttpClient(OkHttpClient newHttpClient) { - this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); - return this; - } - - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); - return this; - } - - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); - return this; - } - - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { - //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = + httpClient + .newBuilder() + .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) + .build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = + httpClient + .newBuilder() + .readTimeout(readTimeout, TimeUnit.MILLISECONDS) + .build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = + httpClient + .newBuilder() + .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) + .build(); + return this; + } + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if ( + param instanceof Date || + param instanceof OffsetDateTime || + param instanceof LocalDate + ) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if ( + name == null || + name.isEmpty() || + value == null || + value instanceof Collection + ) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs( + String collectionFormat, + String name, + Collection value + ) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString( + String collectionFormat, + Collection value + ) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = + "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) + throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) respBody = + response.body().string(); else respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + + contentType + + "\" is not supported for type: " + + returnType, + response.code(), + response.headers().toMultimap(), + respBody + ); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) + throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported" + ); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) prefix = "download-"; + } + + if (tempFolderPath == null) return Files + .createTempFile(prefix, suffix) + .toFile(); else return Files + .createTempFile(Paths.get(tempFolderPath), prefix, suffix) + .toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) + throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse( + response.code(), + response.headers().toMultimap(), + data + ); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync( + Call call, + final Type returnType, + final ApiCallback callback + ) { + call.enqueue( + new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); } - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); + @Override + public void onResponse(Call call, Response response) + throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure( + e, + response.code(), + response.headers().toMultimap() + ); + return; + } catch (Exception e) { + callback.onFailure( + new ApiException(e), + response.code(), + response.headers().toMultimap() + ); + return; + } + callback.onSuccess( + result, + response.code(), + response.headers().toMultimap() + ); } - - return sb.substring(delimiter.length()); - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { + } + ); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) + throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); + response.message(), + e, + response.code(), + response.headers().toMultimap() + ); + } } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; + respBody = response.body().string(); } catch (IOException e) { - throw new ApiException(e); + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap() + ); } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } + } + throw new ApiException( + response.message(), + response.code(), + response.headers().toMultimap(), + respBody + ); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String[] authNames, + ApiCallback callback + ) throws ApiException { + Request request = buildRequest( + path, + method, + queryParams, + collectionQueryParams, + body, + headerParams, + cookieParams, + formParams, + authNames, + callback + ); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String[] authNames, + ApiCallback callback + ) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody( + reqBody, + callback + ); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl( + String path, + List queryParams, + List collectionQueryParams + ) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url + .append(escapeString(param.getName())) + .append("=") + .append(escapeString(value)); } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams( + Map headerParams, + Request.Builder reqBuilder + ) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header( + header.getKey(), + parameterToString(header.getValue()) + ); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams( + Map cookieParams, + Request.Builder reqBuilder + ) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader( + "Cookie", + String.format("%s=%s", param.getKey(), param.getValue()) + ); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader( + "Cookie", + String.format("%s=%s", param.getKey(), param.getValue()) + ); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + public void updateParamsForAuth( + String[] authNames, + List queryParams, + Map headerParams, + Map cookieParams + ) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding( + Map formParams + ) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder() + .setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of( + "Content-Disposition", + "form-data; name=\"" + + param.getKey() + + "\"; filename=\"" + + file.getName() + + "\"" + ); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } else { + Headers partHeaders = Headers.of( + "Content-Disposition", + "form-data; name=\"" + param.getKey() + "\"" + ); + mpBuilder.addPart( + partHeaders, + RequestBody.create(parameterToString(param.getValue()), null) + ); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse + .newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = + new TrustManager[] { + new X509TrustManager() { + @Override + public void checkClientTrusted( + java.security.cert.X509Certificate[] chain, + String authType + ) throws CertificateException {} + + @Override + public void checkServerTrusted( + java.security.cert.X509Certificate[] chain, + String authType + ) throws CertificateException {} + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[] {}; + } + }, + }; + hostnameVerifier = + new HostnameVerifier() { @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws ApiException If fail to serialize the request body object - */ - public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - - final String url = buildUrl(path, queryParams, collectionQueryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); + public boolean verify(String hostname, SSLSession session) { + return true; } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( + TrustManagerFactory.getDefaultAlgorithm() + ); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); } else { - reqBody = serialize(body, contentType); + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance( + "X.509" + ); + Collection certificates = certificateFactory.generateCertificates( + sslCaCert + ); + if (certificates.isEmpty()) { + throw new IllegalArgumentException( + "expected non-empty set of trusted certificates" + ); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); } - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams, List collectionQueryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = new TrustManager[]{ - new X509TrustManager() { - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[]{}; - } - } - }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = + httpClient + .newBuilder() + .sslSocketFactory( + sslContext.getSocketFactory(), + (X509TrustManager) trustManagers[0] + ) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) + throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java index a91ca3c379..243e8c54e5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -3,88 +3,113 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; -import java.util.Map; import java.util.List; +import java.util.Map; public class ApiException extends Exception { - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders, + String responseBody + ) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException( + String message, + int code, + Map> responseHeaders, + String responseBody + ) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders + ) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException( + int code, + Map> responseHeaders, + String responseBody + ) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException( + int code, + String message, + Map> responseHeaders, + String responseBody + ) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java index d584798448..2e0cf698d2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java @@ -3,14 +3,13 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.List; @@ -22,38 +21,43 @@ * @param The type of data that is deserialized from response body */ public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } + + private final int statusCode; + private final Map> headers; + private final T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse( + int statusCode, + Map> headers, + T data + ) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java index 6ccb969cd5..d91ae1cff3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java @@ -3,36 +3,36 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java index 068722b623..1453bef5a0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java @@ -3,83 +3,90 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; +import java.io.IOException; import okhttp3.*; import okio.Buffer; import okio.BufferedSink; import okio.GzipSink; import okio.Okio; -import java.io.IOException; - /** * Encodes request bodies using gzip. * * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if ( + originalRequest.body() == null || + originalRequest.header("Content-Encoding") != null + ) { + return chain.proceed(originalRequest); } - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } + Request compressedRequest = originalRequest + .newBuilder() + .header("Content-Encoding", "gzip") + .method( + originalRequest.method(), + forceContentLength(gzip(originalRequest.body())) + ) + .build(); + return chain.proceed(compressedRequest); + } - @Override - public long contentLength() { - return buffer.size(); - } + private RequestBody forceContentLength(final RequestBody requestBody) + throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } + @Override + public long contentLength() { + return buffer.size(); + } - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java index 6049431f35..5da4757deb 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java @@ -3,30 +3,26 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; +import com.algolia.model.*; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; - -import com.algolia.model.*; -import okio.ByteString; - import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; @@ -37,367 +33,381 @@ import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; +import java.util.HashMap; import java.util.Locale; import java.util.Map; -import java.util.HashMap; +import okio.ByteString; public class JSON { - private Gson gson; - private boolean isLenientOnJson = false; - private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - - @SuppressWarnings("unchecked") - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder() - ; - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; - } - private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { - JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if (null == element) { - throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); - } - return element.getAsString(); + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue( + JsonElement readElement, + String discriminatorField + ) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException( + "missing discriminator field: <" + discriminatorField + ">" + ); } - - /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. - * - * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. - * @return The Java class that implements the OpenAPI schema - */ - private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); - if (null == clazz) { - throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); - } - return clazz; + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator( + Map classByDiscriminatorValue, + String discriminatorValue + ) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException( + "cannot determine model class of name: <" + discriminatorValue + ">" + ); } - - public JSON() { - gson = createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - .registerTypeAdapter(byte[].class, byteArrayAdapter) - .create(); + return clazz; + } + + public JSON() { + gson = + createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } } - - /** - * Get Gson. - * - * @return Gson - */ - public Gson getGson() { - return gson; + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } } - /** - * Set Gson. - * - * @param gson Gson - * @return JSON - */ - public JSON setGson(Gson gson) { - this.gson = gson; - return this; + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } } + } - public JSON setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - return this; - } + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter + extends TypeAdapter { - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } + private DateTimeFormatter formatter; - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); } - /** - * Gson TypeAdapter for Byte Array type - */ - public class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; } - /** - * Gson TypeAdapter for JSR310 OffsetDateTime type - */ - public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } - private DateTimeFormatter formatter; + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length() - 5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } + private DateTimeFormatter formatter; - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length()-5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } - } + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; } - /** - * Gson TypeAdapter for JSR310 LocalDate type - */ - public class LocalDateTypeAdapter extends TypeAdapter { + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } - private DateTimeFormatter formatter; + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } + private DateFormat dateFormat; - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } + public SqlDateTypeAdapter() {} - public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - return this; + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; } - public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - return this; + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; } - /** - * Gson TypeAdapter for java.sql.Date type - * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used - * (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); } + out.value(value); + } + } - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); - } catch (ParseException e) { - throw new JsonParseException(e); - } + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); } - } + return new java.sql.Date( + ISO8601Utils.parse(date, new ParsePosition(0)).getTime() + ); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } } + } - /** - * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. - */ - public static class DateTypeAdapter extends TypeAdapter { + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { - private DateFormat dateFormat; + private DateFormat dateFormat; - public DateTypeAdapter() {} + public DateTypeAdapter() {} - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); } + out.value(value); + } + } - @Override - public Date read(JsonReader in) throws IOException { + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); } } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } } + } - public JSON setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - return this; - } - - public JSON setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - return this; - } + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java index efdb7750f7..752fe67775 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java @@ -3,58 +3,58 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; public class Pair { - private String name = ""; - private String value = ""; - public Pair (String name, String value) { - setName(name); - setValue(value); - } + private String name = ""; + private String value = ""; - private void setName(String name) { - if (!isValidString(name)) { - return; - } + public Pair(String name, String value) { + setName(name); + setValue(value); + } - this.name = name; + private void setName(String name) { + if (!isValidString(name)) { + return; } - private void setValue(String value) { - if (!isValidString(value)) { - return; - } + this.name = name; + } - this.value = value; + private void setValue(String value) { + if (!isValidString(value)) { + return; } - public String getName() { - return this.name; - } + this.value = value; + } - public String getValue() { - return this.value; - } + public String getName() { + return this.name; + } - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } + public String getValue() { + return this.value; + } - if (arg.trim().isEmpty()) { - return false; - } + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } - return true; + if (arg.trim().isEmpty()) { + return false; } + + return true; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java index 6f1a3259dc..1b84b55603 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java @@ -3,21 +3,18 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; +import java.io.IOException; import okhttp3.MediaType; import okhttp3.RequestBody; - -import java.io.IOException; - import okio.Buffer; import okio.BufferedSink; import okio.ForwardingSink; @@ -26,48 +23,51 @@ public class ProgressRequestBody extends RequestBody { - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress( + bytesWritten, + contentLength, + bytesWritten == contentLength + ); + } + }; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java index 42ecddfdf0..f85f459d87 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java @@ -3,21 +3,18 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; +import java.io.IOException; import okhttp3.MediaType; import okhttp3.ResponseBody; - -import java.io.IOException; - import okio.Buffer; import okio.BufferedSource; import okio.ForwardingSource; @@ -26,45 +23,49 @@ public class ProgressResponseBody extends ResponseBody { - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } - @Override - public MediaType contentType() { - return responseBody.contentType(); - } + @Override + public MediaType contentType() { + return responseBody.contentType(); + } - @Override - public long contentLength() { - return responseBody.contentLength(); - } + @Override + public long contentLength() { + return responseBody.contentLength(); + } - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); } + return bufferedSource; + } - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress( + totalBytesRead, + responseBody.contentLength(), + bytesRead == -1 + ); + return bytesRead; + } + }; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java index d0efe8e078..6dbe7a0216 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java @@ -6,53 +6,67 @@ * Representing a Server configuration. */ public class ServerConfiguration { - public String URL; - public String description; - public Map variables; - - /** - * @param URL A URL to the target host. - * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. - */ - public ServerConfiguration(String URL, String description, Map variables) { - this.URL = URL; - this.description = description; - this.variables = variables; - } - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL(Map variables) { - String url = this.URL; - - // go through variables and replace placeholders - for (Map.Entry variable: this.variables.entrySet()) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; - - if (variables != null && variables.containsKey(name)) { - value = variables.get(name); - if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); - } - } - url = url.replaceAll("\\{" + name + "\\}", value); + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration( + String URL, + String description, + Map variables + ) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable : this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if ( + serverVariable.enumValues.size() > 0 && + !serverVariable.enumValues.contains(value) + ) { + throw new RuntimeException( + "The variable " + + name + + " in the server URL has invalid value " + + value + + "." + ); } - return url; + } + url = url.replaceAll("\\{" + name + "\\}", value); } + return url; + } - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() { - return URL(null); - } + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java index 42b70a4fae..52b3a21d57 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java @@ -6,18 +6,23 @@ * Representing a Server Variable for server URL template substitution. */ public class ServerVariable { - public String description; - public String defaultValue; - public HashSet enumValues = null; - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. - */ - public ServerVariable(String description, String defaultValue, HashSet enumValues) { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable( + String description, + String defaultValue, + HashSet enumValues + ) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java index bcd3c61b02..db6060f596 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java @@ -3,20 +3,20 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.Collection; import java.util.Iterator; public class StringUtil { + /** * Check if the given array contains the given value (with case-insensitive comparison). * diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java index e7a8b970e0..1fd1cbd75c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java @@ -3,22 +3,21 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.auth; import com.algolia.Pair; - -import java.util.Map; import java.util.List; +import java.util.Map; public class ApiKeyAuth implements Authentication { + private final String location; private final String paramName; @@ -55,7 +54,11 @@ public void setApiKeyPrefix(String apiKeyPrefix) { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ) { if (apiKey == null) { return; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java index 264c9d42e0..8a2b1bcd3d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java @@ -3,28 +3,30 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.auth; import com.algolia.Pair; - -import java.util.Map; import java.util.List; +import java.util.Map; public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams); + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index af4d3aa4de..4348835904 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,66 +21,87 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * BaseIndexSettings */ public class BaseIndexSettings { + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; - public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = + "paginationLimitedTo"; + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = + "disableTypoToleranceOnWords"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = + "attributesToTransliterate"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = + "camelCaseAttributes"; + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = + "decompoundedAttributes"; + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) private List indexLanguages = null; public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) private Boolean filterPromotes = false; - public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = + "disablePrefixOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + "allowCompressionOfIntegerArray"; + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = + "numericAttributesForFiltering"; + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; - public BaseIndexSettings replicas(List replicas) { - this.replicas = replicas; return this; } @@ -96,53 +114,51 @@ public BaseIndexSettings addReplicasItem(String replicasItem) { return this; } - /** + /** * Creates replicas, exact copies of an index. * @return replicas - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") - public List getReplicas() { return replicas; } - public void setReplicas(List replicas) { this.replicas = replicas; } - public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; return this; } - /** + /** * Set the maximum number of hits accessible via pagination. * @return paginationLimitedTo - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Set the maximum number of hits accessible via pagination.") - + @ApiModelProperty( + value = "Set the maximum number of hits accessible via pagination." + ) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } - public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } - - public BaseIndexSettings disableTypoToleranceOnWords(List disableTypoToleranceOnWords) { - + public BaseIndexSettings disableTypoToleranceOnWords( + List disableTypoToleranceOnWords + ) { this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; return this; } - public BaseIndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { + public BaseIndexSettings addDisableTypoToleranceOnWordsItem( + String disableTypoToleranceOnWordsItem + ) { if (this.disableTypoToleranceOnWords == null) { this.disableTypoToleranceOnWords = new ArrayList<>(); } @@ -150,30 +166,34 @@ public BaseIndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoTo return this; } - /** + /** * A list of words for which you want to turn off typo tolerance. * @return disableTypoToleranceOnWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of words for which you want to turn off typo tolerance.") - + @ApiModelProperty( + value = "A list of words for which you want to turn off typo tolerance." + ) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } - - public void setDisableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + public void setDisableTypoToleranceOnWords( + List disableTypoToleranceOnWords + ) { this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; } - - public BaseIndexSettings attributesToTransliterate(List attributesToTransliterate) { - + public BaseIndexSettings attributesToTransliterate( + List attributesToTransliterate + ) { this.attributesToTransliterate = attributesToTransliterate; return this; } - public BaseIndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { + public BaseIndexSettings addAttributesToTransliterateItem( + String attributesToTransliterateItem + ) { if (this.attributesToTransliterate == null) { this.attributesToTransliterate = new ArrayList<>(); } @@ -181,30 +201,34 @@ public BaseIndexSettings addAttributesToTransliterateItem(String attributesToTra return this; } - /** + /** * Specify on which attributes to apply transliteration. * @return attributesToTransliterate - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Specify on which attributes to apply transliteration.") - + @ApiModelProperty( + value = "Specify on which attributes to apply transliteration." + ) public List getAttributesToTransliterate() { return attributesToTransliterate; } - - public void setAttributesToTransliterate(List attributesToTransliterate) { + public void setAttributesToTransliterate( + List attributesToTransliterate + ) { this.attributesToTransliterate = attributesToTransliterate; } - - public BaseIndexSettings camelCaseAttributes(List camelCaseAttributes) { - + public BaseIndexSettings camelCaseAttributes( + List camelCaseAttributes + ) { this.camelCaseAttributes = camelCaseAttributes; return this; } - public BaseIndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { + public BaseIndexSettings addCamelCaseAttributesItem( + String camelCaseAttributesItem + ) { if (this.camelCaseAttributes == null) { this.camelCaseAttributes = new ArrayList<>(); } @@ -212,30 +236,33 @@ public BaseIndexSettings addCamelCaseAttributesItem(String camelCaseAttributesIt return this; } - /** + /** * List of attributes on which to do a decomposition of camel case words. * @return camelCaseAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which to do a decomposition of camel case words.") - + @ApiModelProperty( + value = "List of attributes on which to do a decomposition of camel case words." + ) public List getCamelCaseAttributes() { return camelCaseAttributes; } - public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } - - public BaseIndexSettings decompoundedAttributes(Map decompoundedAttributes) { - + public BaseIndexSettings decompoundedAttributes( + Map decompoundedAttributes + ) { this.decompoundedAttributes = decompoundedAttributes; return this; } - public BaseIndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { + public BaseIndexSettings putDecompoundedAttributesItem( + String key, + Object decompoundedAttributesItem + ) { if (this.decompoundedAttributes == null) { this.decompoundedAttributes = new HashMap<>(); } @@ -243,25 +270,25 @@ public BaseIndexSettings putDecompoundedAttributesItem(String key, Object decomp return this; } - /** + /** * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. * @return decompoundedAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.") - + @ApiModelProperty( + value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." + ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } - - public void setDecompoundedAttributes(Map decompoundedAttributes) { + public void setDecompoundedAttributes( + Map decompoundedAttributes + ) { this.decompoundedAttributes = decompoundedAttributes; } - public BaseIndexSettings indexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; return this; } @@ -274,53 +301,53 @@ public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { return this; } - /** + /** * Sets the languages at the index level for language-specific processing such as tokenization and normalization. * @return indexLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization.") - + @ApiModelProperty( + value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." + ) public List getIndexLanguages() { return indexLanguages; } - public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } - public BaseIndexSettings filterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; return this; } - /** + /** * Whether promoted results should match the filters of the current search, except for geographic filters. * @return filterPromotes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether promoted results should match the filters of the current search, except for geographic filters.") - + @ApiModelProperty( + value = "Whether promoted results should match the filters of the current search, except for geographic filters." + ) public Boolean getFilterPromotes() { return filterPromotes; } - public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } - - public BaseIndexSettings disablePrefixOnAttributes(List disablePrefixOnAttributes) { - + public BaseIndexSettings disablePrefixOnAttributes( + List disablePrefixOnAttributes + ) { this.disablePrefixOnAttributes = disablePrefixOnAttributes; return this; } - public BaseIndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { + public BaseIndexSettings addDisablePrefixOnAttributesItem( + String disablePrefixOnAttributesItem + ) { if (this.disablePrefixOnAttributes == null) { this.disablePrefixOnAttributes = new ArrayList<>(); } @@ -328,53 +355,57 @@ public BaseIndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOn return this; } - /** + /** * List of attributes on which you want to disable prefix matching. * @return disablePrefixOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable prefix matching.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable prefix matching." + ) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } - - public void setDisablePrefixOnAttributes(List disablePrefixOnAttributes) { + public void setDisablePrefixOnAttributes( + List disablePrefixOnAttributes + ) { this.disablePrefixOnAttributes = disablePrefixOnAttributes; } - - public BaseIndexSettings allowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { - + public BaseIndexSettings allowCompressionOfIntegerArray( + Boolean allowCompressionOfIntegerArray + ) { this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; return this; } - /** + /** * Enables compression of large integer arrays. * @return allowCompressionOfIntegerArray - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") - public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } - - public void setAllowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + public void setAllowCompressionOfIntegerArray( + Boolean allowCompressionOfIntegerArray + ) { this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; } - - public BaseIndexSettings numericAttributesForFiltering(List numericAttributesForFiltering) { - + public BaseIndexSettings numericAttributesForFiltering( + List numericAttributesForFiltering + ) { this.numericAttributesForFiltering = numericAttributesForFiltering; return this; } - public BaseIndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { + public BaseIndexSettings addNumericAttributesForFilteringItem( + String numericAttributesForFilteringItem + ) { if (this.numericAttributesForFiltering == null) { this.numericAttributesForFiltering = new ArrayList<>(); } @@ -382,25 +413,25 @@ public BaseIndexSettings addNumericAttributesForFilteringItem(String numericAttr return this; } - /** + /** * List of numeric attributes that can be used as numerical filters. * @return numericAttributesForFiltering - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of numeric attributes that can be used as numerical filters.") - + @ApiModelProperty( + value = "List of numeric attributes that can be used as numerical filters." + ) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } - - public void setNumericAttributesForFiltering(List numericAttributesForFiltering) { + public void setNumericAttributesForFiltering( + List numericAttributesForFiltering + ) { this.numericAttributesForFiltering = numericAttributesForFiltering; } - public BaseIndexSettings userData(Map userData) { - this.userData = userData; return this; } @@ -413,23 +444,20 @@ public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { return this; } - /** + /** * Lets you store custom data in your indices. * @return userData - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - public Map getUserData() { return userData; } - public void setUserData(Map userData) { this.userData = userData; } - @Override public boolean equals(Object o) { if (this == o) { @@ -439,23 +467,62 @@ public boolean equals(Object o) { return false; } BaseIndexSettings baseIndexSettings = (BaseIndexSettings) o; - return Objects.equals(this.replicas, baseIndexSettings.replicas) && - Objects.equals(this.paginationLimitedTo, baseIndexSettings.paginationLimitedTo) && - Objects.equals(this.disableTypoToleranceOnWords, baseIndexSettings.disableTypoToleranceOnWords) && - Objects.equals(this.attributesToTransliterate, baseIndexSettings.attributesToTransliterate) && - Objects.equals(this.camelCaseAttributes, baseIndexSettings.camelCaseAttributes) && - Objects.equals(this.decompoundedAttributes, baseIndexSettings.decompoundedAttributes) && - Objects.equals(this.indexLanguages, baseIndexSettings.indexLanguages) && - Objects.equals(this.filterPromotes, baseIndexSettings.filterPromotes) && - Objects.equals(this.disablePrefixOnAttributes, baseIndexSettings.disablePrefixOnAttributes) && - Objects.equals(this.allowCompressionOfIntegerArray, baseIndexSettings.allowCompressionOfIntegerArray) && - Objects.equals(this.numericAttributesForFiltering, baseIndexSettings.numericAttributesForFiltering) && - Objects.equals(this.userData, baseIndexSettings.userData); + return ( + Objects.equals(this.replicas, baseIndexSettings.replicas) && + Objects.equals( + this.paginationLimitedTo, + baseIndexSettings.paginationLimitedTo + ) && + Objects.equals( + this.disableTypoToleranceOnWords, + baseIndexSettings.disableTypoToleranceOnWords + ) && + Objects.equals( + this.attributesToTransliterate, + baseIndexSettings.attributesToTransliterate + ) && + Objects.equals( + this.camelCaseAttributes, + baseIndexSettings.camelCaseAttributes + ) && + Objects.equals( + this.decompoundedAttributes, + baseIndexSettings.decompoundedAttributes + ) && + Objects.equals(this.indexLanguages, baseIndexSettings.indexLanguages) && + Objects.equals(this.filterPromotes, baseIndexSettings.filterPromotes) && + Objects.equals( + this.disablePrefixOnAttributes, + baseIndexSettings.disablePrefixOnAttributes + ) && + Objects.equals( + this.allowCompressionOfIntegerArray, + baseIndexSettings.allowCompressionOfIntegerArray + ) && + Objects.equals( + this.numericAttributesForFiltering, + baseIndexSettings.numericAttributesForFiltering + ) && + Objects.equals(this.userData, baseIndexSettings.userData) + ); } @Override public int hashCode() { - return Objects.hash(replicas, paginationLimitedTo, disableTypoToleranceOnWords, attributesToTransliterate, camelCaseAttributes, decompoundedAttributes, indexLanguages, filterPromotes, disablePrefixOnAttributes, allowCompressionOfIntegerArray, numericAttributesForFiltering, userData); + return Objects.hash( + replicas, + paginationLimitedTo, + disableTypoToleranceOnWords, + attributesToTransliterate, + camelCaseAttributes, + decompoundedAttributes, + indexLanguages, + filterPromotes, + disablePrefixOnAttributes, + allowCompressionOfIntegerArray, + numericAttributesForFiltering, + userData + ); } @Override @@ -463,16 +530,46 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BaseIndexSettings {\n"); sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); - sb.append(" paginationLimitedTo: ").append(toIndentedString(paginationLimitedTo)).append("\n"); - sb.append(" disableTypoToleranceOnWords: ").append(toIndentedString(disableTypoToleranceOnWords)).append("\n"); - sb.append(" attributesToTransliterate: ").append(toIndentedString(attributesToTransliterate)).append("\n"); - sb.append(" camelCaseAttributes: ").append(toIndentedString(camelCaseAttributes)).append("\n"); - sb.append(" decompoundedAttributes: ").append(toIndentedString(decompoundedAttributes)).append("\n"); - sb.append(" indexLanguages: ").append(toIndentedString(indexLanguages)).append("\n"); - sb.append(" filterPromotes: ").append(toIndentedString(filterPromotes)).append("\n"); - sb.append(" disablePrefixOnAttributes: ").append(toIndentedString(disablePrefixOnAttributes)).append("\n"); - sb.append(" allowCompressionOfIntegerArray: ").append(toIndentedString(allowCompressionOfIntegerArray)).append("\n"); - sb.append(" numericAttributesForFiltering: ").append(toIndentedString(numericAttributesForFiltering)).append("\n"); + sb + .append(" paginationLimitedTo: ") + .append(toIndentedString(paginationLimitedTo)) + .append("\n"); + sb + .append(" disableTypoToleranceOnWords: ") + .append(toIndentedString(disableTypoToleranceOnWords)) + .append("\n"); + sb + .append(" attributesToTransliterate: ") + .append(toIndentedString(attributesToTransliterate)) + .append("\n"); + sb + .append(" camelCaseAttributes: ") + .append(toIndentedString(camelCaseAttributes)) + .append("\n"); + sb + .append(" decompoundedAttributes: ") + .append(toIndentedString(decompoundedAttributes)) + .append("\n"); + sb + .append(" indexLanguages: ") + .append(toIndentedString(indexLanguages)) + .append("\n"); + sb + .append(" filterPromotes: ") + .append(toIndentedString(filterPromotes)) + .append("\n"); + sb + .append(" disablePrefixOnAttributes: ") + .append(toIndentedString(disablePrefixOnAttributes)) + .append("\n"); + sb + .append(" allowCompressionOfIntegerArray: ") + .append(toIndentedString(allowCompressionOfIntegerArray)) + .append("\n"); + sb + .append(" numericAttributesForFiltering: ") + .append(toIndentedString(numericAttributesForFiltering)) + .append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append("}"); return sb.toString(); @@ -488,6 +585,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index 49c5b863db..782d59a76c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -3,18 +3,16 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; +import com.algolia.model.OneOfintegerstring; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -25,217 +23,258 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** * BaseSearchParams */ public class BaseSearchParams { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) private String similarQuery = ""; public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) private String filters = ""; public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) private List facetFilters = null; - public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = "optionalFilters"; + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = + "optionalFilters"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) private List optionalFilters = null; public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) private List numericFilters = null; public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) private List tagFilters = null; - public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = + "sumOrFiltersScores"; + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) private List facets = null; - public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = + "maxValuesPerFacet"; + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = + "facetingAfterDistinct"; + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = + "sortFacetValuesBy"; + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) private Integer offset; public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) private Integer length; public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng = ""; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = + "aroundLatLngViaIP"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) - private Integer aroundRadius; + private OneOfintegerstring aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = + "aroundPrecision"; - public static final String SERIALIZED_NAME_AROUND_PRECISION = "aroundPrecision"; @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) private Integer aroundPrecision = 10; - public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = + "minimumAroundRadius"; + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = + "insideBoundingBox"; + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) private List insidePolygon = null; - public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = + "naturalLanguages"; + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) private List ruleContexts = null; - public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = + "personalizationImpact"; + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + @SerializedName(SERIALIZED_NAME_USER_TOKEN) private String userToken; - public static final String SERIALIZED_NAME_GET_RANKING_INFO = "getRankingInfo"; + public static final String SERIALIZED_NAME_GET_RANKING_INFO = + "getRankingInfo"; + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) private Boolean getRankingInfo = false; public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) private Boolean clickAnalytics = false; public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + @SerializedName(SERIALIZED_NAME_ANALYTICS) private Boolean analytics = true; public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) private List analyticsTags = null; - public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = + "percentileComputation"; + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) private Boolean enableABTest = true; - public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = + "enableReRanking"; + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; - public BaseSearchParams query(String query) { - this.query = query; return this; } - /** + /** * The text to search in the index. * @return query - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - public String getQuery() { return query; } - public void setQuery(String query) { this.query = query; } - public BaseSearchParams similarQuery(String similarQuery) { - this.similarQuery = similarQuery; return this; } - /** + /** * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. * @return similarQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.") - + @ApiModelProperty( + value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." + ) public String getSimilarQuery() { return similarQuery; } - public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } - public BaseSearchParams filters(String filters) { - this.filters = filters; return this; } - /** + /** * Filter the query with numeric, facet and/or tag filters. * @return filters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Filter the query with numeric, facet and/or tag filters.") - + @ApiModelProperty( + value = "Filter the query with numeric, facet and/or tag filters." + ) public String getFilters() { return filters; } - public void setFilters(String filters) { this.filters = filters; } - public BaseSearchParams facetFilters(List facetFilters) { - this.facetFilters = facetFilters; return this; } @@ -248,25 +287,21 @@ public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { return this; } - /** + /** * Filter hits by facet value. * @return facetFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") - public List getFacetFilters() { return facetFilters; } - public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } - public BaseSearchParams optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; return this; } @@ -279,25 +314,23 @@ public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { return this; } - /** + /** * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. * @return optionalFilters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.") - + @ApiModelProperty( + value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." + ) public List getOptionalFilters() { return optionalFilters; } - public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } - public BaseSearchParams numericFilters(List numericFilters) { - this.numericFilters = numericFilters; return this; } @@ -310,25 +343,21 @@ public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { return this; } - /** + /** * Filter on numeric attributes. * @return numericFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") - public List getNumericFilters() { return numericFilters; } - public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } - public BaseSearchParams tagFilters(List tagFilters) { - this.tagFilters = tagFilters; return this; } @@ -341,48 +370,42 @@ public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { return this; } - /** + /** * Filter hits by tags. * @return tagFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") - public List getTagFilters() { return tagFilters; } - public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } - public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; return this; } - /** + /** * Determines how to calculate the total score for filtering. * @return sumOrFiltersScores - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Determines how to calculate the total score for filtering.") - + @ApiModelProperty( + value = "Determines how to calculate the total score for filtering." + ) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } - public BaseSearchParams facets(List facets) { - this.facets = facets; return this; } @@ -395,286 +418,258 @@ public BaseSearchParams addFacetsItem(String facetsItem) { return this; } - /** + /** * Retrieve facets and their facet values. * @return facets - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") - public List getFacets() { return facets; } - public void setFacets(List facets) { this.facets = facets; } - public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; return this; } - /** + /** * Maximum number of facet values to return for each facet during a regular search. * @return maxValuesPerFacet - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Maximum number of facet values to return for each facet during a regular search.") - + @ApiModelProperty( + value = "Maximum number of facet values to return for each facet during a regular search." + ) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } - public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; return this; } - /** + /** * Force faceting to be applied after de-duplication (via the Distinct setting). * @return facetingAfterDistinct - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Force faceting to be applied after de-duplication (via the Distinct setting).") - + @ApiModelProperty( + value = "Force faceting to be applied after de-duplication (via the Distinct setting)." + ) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } - public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; return this; } - /** + /** * Controls how facet values are fetched. * @return sortFacetValuesBy - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") - public String getSortFacetValuesBy() { return sortFacetValuesBy; } - public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } - public BaseSearchParams page(Integer page) { - this.page = page; return this; } - /** + /** * Specify the page to retrieve. * @return page - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") - public Integer getPage() { return page; } - public void setPage(Integer page) { this.page = page; } - public BaseSearchParams offset(Integer offset) { - this.offset = offset; return this; } - /** + /** * Specify the offset of the first hit to return. * @return offset - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") - public Integer getOffset() { return offset; } - public void setOffset(Integer offset) { this.offset = offset; } - public BaseSearchParams length(Integer length) { - this.length = length; return this; } - /** + /** * Set the number of hits to retrieve (used only with offset). * minimum: 1 * maximum: 1000 * @return length - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Set the number of hits to retrieve (used only with offset).") - + @ApiModelProperty( + value = "Set the number of hits to retrieve (used only with offset)." + ) public Integer getLength() { return length; } - public void setLength(Integer length) { this.length = length; } - public BaseSearchParams aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; return this; } - /** + /** * Search for entries around a central geolocation, enabling a geo search within a circular area. * @return aroundLatLng - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search for entries around a central geolocation, enabling a geo search within a circular area.") - + @ApiModelProperty( + value = "Search for entries around a central geolocation, enabling a geo search within a circular area." + ) public String getAroundLatLng() { return aroundLatLng; } - public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } - public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; return this; } - /** + /** * Search for entries around a given location automatically computed from the requester’s IP address. * @return aroundLatLngViaIP - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search for entries around a given location automatically computed from the requester’s IP address.") - + @ApiModelProperty( + value = "Search for entries around a given location automatically computed from the requester’s IP address." + ) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } - - public BaseSearchParams aroundRadius(Integer aroundRadius) { - + public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { this.aroundRadius = aroundRadius; return this; } - /** + /** * Define the maximum radius for a geo search (in meters). * @return aroundRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Define the maximum radius for a geo search (in meters).") - - public Integer getAroundRadius() { + @ApiModelProperty( + value = "Define the maximum radius for a geo search (in meters)." + ) + public OneOfintegerstring getAroundRadius() { return aroundRadius; } - - public void setAroundRadius(Integer aroundRadius) { + public void setAroundRadius(OneOfintegerstring aroundRadius) { this.aroundRadius = aroundRadius; } - public BaseSearchParams aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; return this; } - /** + /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. * @return aroundPrecision - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula.") - + @ApiModelProperty( + value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." + ) public Integer getAroundPrecision() { return aroundPrecision; } - public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } - public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; return this; } - /** + /** * Minimum radius (in meters) used for a geo search when aroundRadius is not set. * minimum: 1 * @return minimumAroundRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set.") - + @ApiModelProperty( + value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." + ) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } - - public BaseSearchParams insideBoundingBox(List insideBoundingBox) { - + public BaseSearchParams insideBoundingBox( + List insideBoundingBox + ) { this.insideBoundingBox = insideBoundingBox; return this; } - public BaseSearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { + public BaseSearchParams addInsideBoundingBoxItem( + BigDecimal insideBoundingBoxItem + ) { if (this.insideBoundingBox == null) { this.insideBoundingBox = new ArrayList<>(); } @@ -682,25 +677,23 @@ public BaseSearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxIte return this; } - /** + /** * Search inside a rectangular area (in geo coordinates). * @return insideBoundingBox - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search inside a rectangular area (in geo coordinates).") - + @ApiModelProperty( + value = "Search inside a rectangular area (in geo coordinates)." + ) public List getInsideBoundingBox() { return insideBoundingBox; } - public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } - public BaseSearchParams insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; return this; } @@ -713,25 +706,21 @@ public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { return this; } - /** + /** * Search inside a polygon (in geo coordinates). * @return insidePolygon - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") - public List getInsidePolygon() { return insidePolygon; } - public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } - public BaseSearchParams naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; return this; } @@ -744,25 +733,23 @@ public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { return this; } - /** + /** * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. * @return naturalLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.") - + @ApiModelProperty( + value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." + ) public List getNaturalLanguages() { return naturalLanguages; } - public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } - public BaseSearchParams ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; return this; } @@ -775,140 +762,120 @@ public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { return this; } - /** + /** * Enables contextual rules. * @return ruleContexts - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") - public List getRuleContexts() { return ruleContexts; } - public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } - public BaseSearchParams personalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; return this; } - /** + /** * Define the impact of the Personalization feature. * @return personalizationImpact - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") - public Integer getPersonalizationImpact() { return personalizationImpact; } - public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } - public BaseSearchParams userToken(String userToken) { - this.userToken = userToken; return this; } - /** + /** * Associates a certain user token with the current search. * @return userToken - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Associates a certain user token with the current search.") - + @ApiModelProperty( + value = "Associates a certain user token with the current search." + ) public String getUserToken() { return userToken; } - public void setUserToken(String userToken) { this.userToken = userToken; } - public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; return this; } - /** + /** * Retrieve detailed ranking information. * @return getRankingInfo - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") - public Boolean getGetRankingInfo() { return getRankingInfo; } - public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } - public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; return this; } - /** + /** * Enable the Click Analytics feature. * @return clickAnalytics - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") - public Boolean getClickAnalytics() { return clickAnalytics; } - public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } - public BaseSearchParams analytics(Boolean analytics) { - this.analytics = analytics; return this; } - /** + /** * Whether the current query will be taken into account in the Analytics. * @return analytics - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the current query will be taken into account in the Analytics.") - + @ApiModelProperty( + value = "Whether the current query will be taken into account in the Analytics." + ) public Boolean getAnalytics() { return analytics; } - public void setAnalytics(Boolean analytics) { this.analytics = analytics; } - public BaseSearchParams analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; return this; } @@ -921,92 +888,83 @@ public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { return this; } - /** + /** * List of tags to apply to the query for analytics purposes. * @return analyticsTags - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of tags to apply to the query for analytics purposes.") - + @ApiModelProperty( + value = "List of tags to apply to the query for analytics purposes." + ) public List getAnalyticsTags() { return analyticsTags; } - public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } - public BaseSearchParams percentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; return this; } - /** + /** * Whether to include or exclude a query from the processing-time percentile computation. * @return percentileComputation - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to include or exclude a query from the processing-time percentile computation.") - + @ApiModelProperty( + value = "Whether to include or exclude a query from the processing-time percentile computation." + ) public Boolean getPercentileComputation() { return percentileComputation; } - public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } - public BaseSearchParams enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; return this; } - /** + /** * Whether this search should participate in running AB tests. * @return enableABTest - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this search should participate in running AB tests.") - + @ApiModelProperty( + value = "Whether this search should participate in running AB tests." + ) public Boolean getEnableABTest() { return enableABTest; } - public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } - public BaseSearchParams enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; return this; } - /** + /** * Whether this search should use AI Re-Ranking. * @return enableReRanking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") - public Boolean getEnableReRanking() { return enableReRanking; } - public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } - @Override public boolean equals(Object o) { if (this == o) { @@ -1016,44 +974,133 @@ public boolean equals(Object o) { return false; } BaseSearchParams baseSearchParams = (BaseSearchParams) o; - return Objects.equals(this.query, baseSearchParams.query) && - Objects.equals(this.similarQuery, baseSearchParams.similarQuery) && - Objects.equals(this.filters, baseSearchParams.filters) && - Objects.equals(this.facetFilters, baseSearchParams.facetFilters) && - Objects.equals(this.optionalFilters, baseSearchParams.optionalFilters) && - Objects.equals(this.numericFilters, baseSearchParams.numericFilters) && - Objects.equals(this.tagFilters, baseSearchParams.tagFilters) && - Objects.equals(this.sumOrFiltersScores, baseSearchParams.sumOrFiltersScores) && - Objects.equals(this.facets, baseSearchParams.facets) && - Objects.equals(this.maxValuesPerFacet, baseSearchParams.maxValuesPerFacet) && - Objects.equals(this.facetingAfterDistinct, baseSearchParams.facetingAfterDistinct) && - Objects.equals(this.sortFacetValuesBy, baseSearchParams.sortFacetValuesBy) && - Objects.equals(this.page, baseSearchParams.page) && - Objects.equals(this.offset, baseSearchParams.offset) && - Objects.equals(this.length, baseSearchParams.length) && - Objects.equals(this.aroundLatLng, baseSearchParams.aroundLatLng) && - Objects.equals(this.aroundLatLngViaIP, baseSearchParams.aroundLatLngViaIP) && - Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && - Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && - Objects.equals(this.minimumAroundRadius, baseSearchParams.minimumAroundRadius) && - Objects.equals(this.insideBoundingBox, baseSearchParams.insideBoundingBox) && - Objects.equals(this.insidePolygon, baseSearchParams.insidePolygon) && - Objects.equals(this.naturalLanguages, baseSearchParams.naturalLanguages) && - Objects.equals(this.ruleContexts, baseSearchParams.ruleContexts) && - Objects.equals(this.personalizationImpact, baseSearchParams.personalizationImpact) && - Objects.equals(this.userToken, baseSearchParams.userToken) && - Objects.equals(this.getRankingInfo, baseSearchParams.getRankingInfo) && - Objects.equals(this.clickAnalytics, baseSearchParams.clickAnalytics) && - Objects.equals(this.analytics, baseSearchParams.analytics) && - Objects.equals(this.analyticsTags, baseSearchParams.analyticsTags) && - Objects.equals(this.percentileComputation, baseSearchParams.percentileComputation) && - Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && - Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking); + return ( + Objects.equals(this.query, baseSearchParams.query) && + Objects.equals(this.similarQuery, baseSearchParams.similarQuery) && + Objects.equals(this.filters, baseSearchParams.filters) && + Objects.equals(this.facetFilters, baseSearchParams.facetFilters) && + Objects.equals(this.optionalFilters, baseSearchParams.optionalFilters) && + Objects.equals(this.numericFilters, baseSearchParams.numericFilters) && + Objects.equals(this.tagFilters, baseSearchParams.tagFilters) && + Objects.equals( + this.sumOrFiltersScores, + baseSearchParams.sumOrFiltersScores + ) && + Objects.equals(this.facets, baseSearchParams.facets) && + Objects.equals( + this.maxValuesPerFacet, + baseSearchParams.maxValuesPerFacet + ) && + Objects.equals( + this.facetingAfterDistinct, + baseSearchParams.facetingAfterDistinct + ) && + Objects.equals( + this.sortFacetValuesBy, + baseSearchParams.sortFacetValuesBy + ) && + Objects.equals(this.page, baseSearchParams.page) && + Objects.equals(this.offset, baseSearchParams.offset) && + Objects.equals(this.length, baseSearchParams.length) && + Objects.equals(this.aroundLatLng, baseSearchParams.aroundLatLng) && + Objects.equals( + this.aroundLatLngViaIP, + baseSearchParams.aroundLatLngViaIP + ) && + Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && + Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && + Objects.equals( + this.minimumAroundRadius, + baseSearchParams.minimumAroundRadius + ) && + Objects.equals( + this.insideBoundingBox, + baseSearchParams.insideBoundingBox + ) && + Objects.equals(this.insidePolygon, baseSearchParams.insidePolygon) && + Objects.equals( + this.naturalLanguages, + baseSearchParams.naturalLanguages + ) && + Objects.equals(this.ruleContexts, baseSearchParams.ruleContexts) && + Objects.equals( + this.personalizationImpact, + baseSearchParams.personalizationImpact + ) && + Objects.equals(this.userToken, baseSearchParams.userToken) && + Objects.equals(this.getRankingInfo, baseSearchParams.getRankingInfo) && + Objects.equals(this.clickAnalytics, baseSearchParams.clickAnalytics) && + Objects.equals(this.analytics, baseSearchParams.analytics) && + Objects.equals(this.analyticsTags, baseSearchParams.analyticsTags) && + Objects.equals( + this.percentileComputation, + baseSearchParams.percentileComputation + ) && + Objects.equals(this.enableABTest, baseSearchParams.enableABTest) && + Objects.equals(this.enableReRanking, baseSearchParams.enableReRanking) + ); + } + + private static boolean equalsNullable( + JsonNullable a, + JsonNullable b + ) { + return ( + a == b || + ( + a != null && + b != null && + a.isPresent() && + b.isPresent() && + Objects.deepEquals(a.get(), b.get()) + ) + ); } @Override public int hashCode() { - return Objects.hash(query, similarQuery, filters, facetFilters, optionalFilters, numericFilters, tagFilters, sumOrFiltersScores, facets, maxValuesPerFacet, facetingAfterDistinct, sortFacetValuesBy, page, offset, length, aroundLatLng, aroundLatLngViaIP, aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, insidePolygon, naturalLanguages, ruleContexts, personalizationImpact, userToken, getRankingInfo, clickAnalytics, analytics, analyticsTags, percentileComputation, enableABTest, enableReRanking); + return Objects.hash( + query, + similarQuery, + filters, + facetFilters, + optionalFilters, + numericFilters, + tagFilters, + sumOrFiltersScores, + facets, + maxValuesPerFacet, + facetingAfterDistinct, + sortFacetValuesBy, + page, + offset, + length, + aroundLatLng, + aroundLatLngViaIP, + aroundRadius, + aroundPrecision, + minimumAroundRadius, + insideBoundingBox, + insidePolygon, + naturalLanguages, + ruleContexts, + personalizationImpact, + userToken, + getRankingInfo, + clickAnalytics, + analytics, + analyticsTags, + percentileComputation, + enableABTest, + enableReRanking + ); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31; } @Override @@ -1061,38 +1108,119 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BaseSearchParams {\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" similarQuery: ").append(toIndentedString(similarQuery)).append("\n"); + sb + .append(" similarQuery: ") + .append(toIndentedString(similarQuery)) + .append("\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" facetFilters: ").append(toIndentedString(facetFilters)).append("\n"); - sb.append(" optionalFilters: ").append(toIndentedString(optionalFilters)).append("\n"); - sb.append(" numericFilters: ").append(toIndentedString(numericFilters)).append("\n"); - sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); - sb.append(" sumOrFiltersScores: ").append(toIndentedString(sumOrFiltersScores)).append("\n"); + sb + .append(" facetFilters: ") + .append(toIndentedString(facetFilters)) + .append("\n"); + sb + .append(" optionalFilters: ") + .append(toIndentedString(optionalFilters)) + .append("\n"); + sb + .append(" numericFilters: ") + .append(toIndentedString(numericFilters)) + .append("\n"); + sb + .append(" tagFilters: ") + .append(toIndentedString(tagFilters)) + .append("\n"); + sb + .append(" sumOrFiltersScores: ") + .append(toIndentedString(sumOrFiltersScores)) + .append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); - sb.append(" facetingAfterDistinct: ").append(toIndentedString(facetingAfterDistinct)).append("\n"); - sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); + sb + .append(" maxValuesPerFacet: ") + .append(toIndentedString(maxValuesPerFacet)) + .append("\n"); + sb + .append(" facetingAfterDistinct: ") + .append(toIndentedString(facetingAfterDistinct)) + .append("\n"); + sb + .append(" sortFacetValuesBy: ") + .append(toIndentedString(sortFacetValuesBy)) + .append("\n"); sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); - sb.append(" aroundLatLngViaIP: ").append(toIndentedString(aroundLatLngViaIP)).append("\n"); - sb.append(" aroundRadius: ").append(toIndentedString(aroundRadius)).append("\n"); - sb.append(" aroundPrecision: ").append(toIndentedString(aroundPrecision)).append("\n"); - sb.append(" minimumAroundRadius: ").append(toIndentedString(minimumAroundRadius)).append("\n"); - sb.append(" insideBoundingBox: ").append(toIndentedString(insideBoundingBox)).append("\n"); - sb.append(" insidePolygon: ").append(toIndentedString(insidePolygon)).append("\n"); - sb.append(" naturalLanguages: ").append(toIndentedString(naturalLanguages)).append("\n"); - sb.append(" ruleContexts: ").append(toIndentedString(ruleContexts)).append("\n"); - sb.append(" personalizationImpact: ").append(toIndentedString(personalizationImpact)).append("\n"); - sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n"); - sb.append(" getRankingInfo: ").append(toIndentedString(getRankingInfo)).append("\n"); - sb.append(" clickAnalytics: ").append(toIndentedString(clickAnalytics)).append("\n"); - sb.append(" analytics: ").append(toIndentedString(analytics)).append("\n"); - sb.append(" analyticsTags: ").append(toIndentedString(analyticsTags)).append("\n"); - sb.append(" percentileComputation: ").append(toIndentedString(percentileComputation)).append("\n"); - sb.append(" enableABTest: ").append(toIndentedString(enableABTest)).append("\n"); - sb.append(" enableReRanking: ").append(toIndentedString(enableReRanking)).append("\n"); + sb + .append(" aroundLatLng: ") + .append(toIndentedString(aroundLatLng)) + .append("\n"); + sb + .append(" aroundLatLngViaIP: ") + .append(toIndentedString(aroundLatLngViaIP)) + .append("\n"); + sb + .append(" aroundRadius: ") + .append(toIndentedString(aroundRadius)) + .append("\n"); + sb + .append(" aroundPrecision: ") + .append(toIndentedString(aroundPrecision)) + .append("\n"); + sb + .append(" minimumAroundRadius: ") + .append(toIndentedString(minimumAroundRadius)) + .append("\n"); + sb + .append(" insideBoundingBox: ") + .append(toIndentedString(insideBoundingBox)) + .append("\n"); + sb + .append(" insidePolygon: ") + .append(toIndentedString(insidePolygon)) + .append("\n"); + sb + .append(" naturalLanguages: ") + .append(toIndentedString(naturalLanguages)) + .append("\n"); + sb + .append(" ruleContexts: ") + .append(toIndentedString(ruleContexts)) + .append("\n"); + sb + .append(" personalizationImpact: ") + .append(toIndentedString(personalizationImpact)) + .append("\n"); + sb + .append(" userToken: ") + .append(toIndentedString(userToken)) + .append("\n"); + sb + .append(" getRankingInfo: ") + .append(toIndentedString(getRankingInfo)) + .append("\n"); + sb + .append(" clickAnalytics: ") + .append(toIndentedString(clickAnalytics)) + .append("\n"); + sb + .append(" analytics: ") + .append(toIndentedString(analytics)) + .append("\n"); + sb + .append(" analyticsTags: ") + .append(toIndentedString(analyticsTags)) + .append("\n"); + sb + .append(" percentileComputation: ") + .append(toIndentedString(percentileComputation)) + .append("\n"); + sb + .append(" enableABTest: ") + .append(toIndentedString(enableABTest)) + .append("\n"); + sb + .append(" enableReRanking: ") + .append(toIndentedString(enableReRanking)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -1107,6 +1235,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index 1c6619c9d3..47c13c8bd5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.BaseSearchResponseFacetsStats; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -24,280 +21,302 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * BaseSearchResponse */ public class BaseSearchResponse { + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) private Integer abTestID; - public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = + "abTestVariantID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng; - public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = "automaticRadius"; + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = + "automaticRadius"; + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) private String automaticRadius; - public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = + "exhaustiveFacetsCount"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = + "exhaustiveNbHits"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) private Boolean exhaustiveTypo; public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) private Map> facets = null; public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + @SerializedName(SERIALIZED_NAME_FACETS_STATS) private Map facetsStats = null; public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) private String index; public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + @SerializedName(SERIALIZED_NAME_INDEX_USED) private String indexUsed; public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + @SerializedName(SERIALIZED_NAME_NB_HITS) private Integer nbHits; public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) private Integer nbSortedHits; public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) private String parsedQuery; - public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = + "processingTimeMS"; + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = + "queryAfterRemoval"; + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + @SerializedName(SERIALIZED_NAME_SERVER_USED) private String serverUsed; public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; - public BaseSearchResponse abTestID(Integer abTestID) { - this.abTestID = abTestID; return this; } - /** + /** * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. * @return abTestID - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.") - + @ApiModelProperty( + value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." + ) public Integer getAbTestID() { return abTestID; } - public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } - public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; return this; } - /** + /** * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. * @return abTestVariantID - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.") - + @ApiModelProperty( + value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." + ) public Integer getAbTestVariantID() { return abTestVariantID; } - public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } - public BaseSearchResponse aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; return this; } - /** + /** * The computed geo location. * @return aroundLatLng - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") - public String getAroundLatLng() { return aroundLatLng; } - public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } - public BaseSearchResponse automaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; return this; } - /** + /** * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. * @return automaticRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.") - + @ApiModelProperty( + value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." + ) public String getAutomaticRadius() { return automaticRadius; } - public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } - - public BaseSearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - + public BaseSearchResponse exhaustiveFacetsCount( + Boolean exhaustiveFacetsCount + ) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; return this; } - /** + /** * Whether the facet count is exhaustive or approximate. * @return exhaustiveFacetsCount - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the facet count is exhaustive or approximate.") - + @ApiModelProperty( + value = "Whether the facet count is exhaustive or approximate." + ) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } - public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } - public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; return this; } - /** + /** * Indicate if the nbHits count was exhaustive or approximate * @return exhaustiveNbHits - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Indicate if the nbHits count was exhaustive or approximate") - + @ApiModelProperty( + required = true, + value = "Indicate if the nbHits count was exhaustive or approximate" + ) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } - public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } - public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; return this; } - /** + /** * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) * @return exhaustiveTypo - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)") - + @ApiModelProperty( + required = true, + value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" + ) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } - public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } - public BaseSearchResponse facets(Map> facets) { - this.facets = facets; return this; } - public BaseSearchResponse putFacetsItem(String key, Map facetsItem) { + public BaseSearchResponse putFacetsItem( + String key, + Map facetsItem + ) { if (this.facets == null) { this.facets = new HashMap<>(); } @@ -305,30 +324,34 @@ public BaseSearchResponse putFacetsItem(String key, Map facetsIt return this; } - /** + /** * A mapping of each facet name to the corresponding facet counts. * @return facets - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts.") - + @ApiModelProperty( + example = "{\"category\":{\"food\":1,\"tech\":42}}", + value = "A mapping of each facet name to the corresponding facet counts." + ) public Map> getFacets() { return facets; } - public void setFacets(Map> facets) { this.facets = facets; } - - public BaseSearchResponse facetsStats(Map facetsStats) { - + public BaseSearchResponse facetsStats( + Map facetsStats + ) { this.facetsStats = facetsStats; return this; } - public BaseSearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { + public BaseSearchResponse putFacetsStatsItem( + String key, + BaseSearchResponseFacetsStats facetsStatsItem + ) { if (this.facetsStats == null) { this.facetsStats = new HashMap<>(); } @@ -336,347 +359,320 @@ public BaseSearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacet return this; } - /** + /** * Statistics for numerical facets. * @return facetsStats - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") - public Map getFacetsStats() { return facetsStats; } - - public void setFacetsStats(Map facetsStats) { + public void setFacetsStats( + Map facetsStats + ) { this.facetsStats = facetsStats; } - public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; return this; } - /** + /** * Set the number of hits per page. * @return hitsPerPage - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") - public Integer getHitsPerPage() { return hitsPerPage; } - public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } - public BaseSearchResponse index(String index) { - this.index = index; return this; } - /** + /** * Index name used for the query. * @return index - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "indexName", value = "Index name used for the query.") - + @ApiModelProperty( + example = "indexName", + value = "Index name used for the query." + ) public String getIndex() { return index; } - public void setIndex(String index) { this.index = index; } - public BaseSearchResponse indexUsed(String indexUsed) { - this.indexUsed = indexUsed; return this; } - /** + /** * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. * @return indexUsed - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.") - + @ApiModelProperty( + example = "indexNameAlt", + value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." + ) public String getIndexUsed() { return indexUsed; } - public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } - public BaseSearchResponse message(String message) { - this.message = message; return this; } - /** + /** * Used to return warnings about the query. * @return message - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - public BaseSearchResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; return this; } - /** + /** * Number of hits that the search query matched * @return nbHits - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "20", required = true, value = "Number of hits that the search query matched") - + @ApiModelProperty( + example = "20", + required = true, + value = "Number of hits that the search query matched" + ) public Integer getNbHits() { return nbHits; } - public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } - public BaseSearchResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; return this; } - /** + /** * Number of pages available for the current query * @return nbPages - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "1", required = true, value = "Number of pages available for the current query") - + @ApiModelProperty( + example = "1", + required = true, + value = "Number of pages available for the current query" + ) public Integer getNbPages() { return nbPages; } - public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } - public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; return this; } - /** + /** * The number of hits selected and sorted by the relevant sort algorithm * @return nbSortedHits - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm") - + @ApiModelProperty( + example = "20", + value = "The number of hits selected and sorted by the relevant sort algorithm" + ) public Integer getNbSortedHits() { return nbSortedHits; } - public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } - public BaseSearchResponse page(Integer page) { - this.page = page; return this; } - /** + /** * Specify the page to retrieve. * @return page - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") - public Integer getPage() { return page; } - public void setPage(Integer page) { this.page = page; } - public BaseSearchResponse params(String params) { - this.params = params; return this; } - /** + /** * A url-encoded string of all search parameters. * @return params - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "query=a&hitsPerPage=20", required = true, value = "A url-encoded string of all search parameters.") - + @ApiModelProperty( + example = "query=a&hitsPerPage=20", + required = true, + value = "A url-encoded string of all search parameters." + ) public String getParams() { return params; } - public void setParams(String params) { this.params = params; } - public BaseSearchResponse parsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; return this; } - /** + /** * The query string that will be searched, after normalization. * @return parsedQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The query string that will be searched, after normalization.") - + @ApiModelProperty( + value = "The query string that will be searched, after normalization." + ) public String getParsedQuery() { return parsedQuery; } - public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } - public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; return this; } - /** + /** * Time the server took to process the request, in milliseconds. * @return processingTimeMS - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "20", required = true, value = "Time the server took to process the request, in milliseconds.") - + @ApiModelProperty( + example = "20", + required = true, + value = "Time the server took to process the request, in milliseconds." + ) public Integer getProcessingTimeMS() { return processingTimeMS; } - public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } - public BaseSearchResponse query(String query) { - this.query = query; return this; } - /** + /** * The text to search in the index. * @return query - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - public String getQuery() { return query; } - public void setQuery(String query) { this.query = query; } - public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; return this; } - /** + /** * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. * @return queryAfterRemoval - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.") - + @ApiModelProperty( + value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." + ) public String getQueryAfterRemoval() { return queryAfterRemoval; } - public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } - public BaseSearchResponse serverUsed(String serverUsed) { - this.serverUsed = serverUsed; return this; } - /** + /** * Actual host name of the server that processed the request. * @return serverUsed - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Actual host name of the server that processed the request.") - + @ApiModelProperty( + value = "Actual host name of the server that processed the request." + ) public String getServerUsed() { return serverUsed; } - public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } - public BaseSearchResponse userData(Map userData) { - this.userData = userData; return this; } @@ -689,23 +685,20 @@ public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { return this; } - /** + /** * Lets you store custom data in your indices. * @return userData - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - public Map getUserData() { return userData; } - public void setUserData(Map userData) { this.userData = userData; } - @Override public boolean equals(Object o) { if (this == o) { @@ -715,35 +708,80 @@ public boolean equals(Object o) { return false; } BaseSearchResponse baseSearchResponse = (BaseSearchResponse) o; - return Objects.equals(this.abTestID, baseSearchResponse.abTestID) && - Objects.equals(this.abTestVariantID, baseSearchResponse.abTestVariantID) && - Objects.equals(this.aroundLatLng, baseSearchResponse.aroundLatLng) && - Objects.equals(this.automaticRadius, baseSearchResponse.automaticRadius) && - Objects.equals(this.exhaustiveFacetsCount, baseSearchResponse.exhaustiveFacetsCount) && - Objects.equals(this.exhaustiveNbHits, baseSearchResponse.exhaustiveNbHits) && - Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && - Objects.equals(this.facets, baseSearchResponse.facets) && - Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && - Objects.equals(this.index, baseSearchResponse.index) && - Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && - Objects.equals(this.message, baseSearchResponse.message) && - Objects.equals(this.nbHits, baseSearchResponse.nbHits) && - Objects.equals(this.nbPages, baseSearchResponse.nbPages) && - Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && - Objects.equals(this.page, baseSearchResponse.page) && - Objects.equals(this.params, baseSearchResponse.params) && - Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && - Objects.equals(this.processingTimeMS, baseSearchResponse.processingTimeMS) && - Objects.equals(this.query, baseSearchResponse.query) && - Objects.equals(this.queryAfterRemoval, baseSearchResponse.queryAfterRemoval) && - Objects.equals(this.serverUsed, baseSearchResponse.serverUsed) && - Objects.equals(this.userData, baseSearchResponse.userData); + return ( + Objects.equals(this.abTestID, baseSearchResponse.abTestID) && + Objects.equals( + this.abTestVariantID, + baseSearchResponse.abTestVariantID + ) && + Objects.equals(this.aroundLatLng, baseSearchResponse.aroundLatLng) && + Objects.equals( + this.automaticRadius, + baseSearchResponse.automaticRadius + ) && + Objects.equals( + this.exhaustiveFacetsCount, + baseSearchResponse.exhaustiveFacetsCount + ) && + Objects.equals( + this.exhaustiveNbHits, + baseSearchResponse.exhaustiveNbHits + ) && + Objects.equals(this.exhaustiveTypo, baseSearchResponse.exhaustiveTypo) && + Objects.equals(this.facets, baseSearchResponse.facets) && + Objects.equals(this.facetsStats, baseSearchResponse.facetsStats) && + Objects.equals(this.hitsPerPage, baseSearchResponse.hitsPerPage) && + Objects.equals(this.index, baseSearchResponse.index) && + Objects.equals(this.indexUsed, baseSearchResponse.indexUsed) && + Objects.equals(this.message, baseSearchResponse.message) && + Objects.equals(this.nbHits, baseSearchResponse.nbHits) && + Objects.equals(this.nbPages, baseSearchResponse.nbPages) && + Objects.equals(this.nbSortedHits, baseSearchResponse.nbSortedHits) && + Objects.equals(this.page, baseSearchResponse.page) && + Objects.equals(this.params, baseSearchResponse.params) && + Objects.equals(this.parsedQuery, baseSearchResponse.parsedQuery) && + Objects.equals( + this.processingTimeMS, + baseSearchResponse.processingTimeMS + ) && + Objects.equals(this.query, baseSearchResponse.query) && + Objects.equals( + this.queryAfterRemoval, + baseSearchResponse.queryAfterRemoval + ) && + Objects.equals(this.serverUsed, baseSearchResponse.serverUsed) && + Objects.equals(this.userData, baseSearchResponse.userData) + ); } @Override public int hashCode() { - return Objects.hash(abTestID, abTestVariantID, aroundLatLng, automaticRadius, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, facets, facetsStats, hitsPerPage, index, indexUsed, message, nbHits, nbPages, nbSortedHits, page, params, parsedQuery, processingTimeMS, query, queryAfterRemoval, serverUsed, userData); + return Objects.hash( + abTestID, + abTestVariantID, + aroundLatLng, + automaticRadius, + exhaustiveFacetsCount, + exhaustiveNbHits, + exhaustiveTypo, + facets, + facetsStats, + hitsPerPage, + index, + indexUsed, + message, + nbHits, + nbPages, + nbSortedHits, + page, + params, + parsedQuery, + processingTimeMS, + query, + queryAfterRemoval, + serverUsed, + userData + ); } @Override @@ -751,28 +789,70 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BaseSearchResponse {\n"); sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); - sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); - sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); - sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); - sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); - sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); - sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); + sb + .append(" abTestVariantID: ") + .append(toIndentedString(abTestVariantID)) + .append("\n"); + sb + .append(" aroundLatLng: ") + .append(toIndentedString(aroundLatLng)) + .append("\n"); + sb + .append(" automaticRadius: ") + .append(toIndentedString(automaticRadius)) + .append("\n"); + sb + .append(" exhaustiveFacetsCount: ") + .append(toIndentedString(exhaustiveFacetsCount)) + .append("\n"); + sb + .append(" exhaustiveNbHits: ") + .append(toIndentedString(exhaustiveNbHits)) + .append("\n"); + sb + .append(" exhaustiveTypo: ") + .append(toIndentedString(exhaustiveTypo)) + .append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb + .append(" facetsStats: ") + .append(toIndentedString(facetsStats)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); + sb + .append(" indexUsed: ") + .append(toIndentedString(indexUsed)) + .append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); + sb + .append(" nbSortedHits: ") + .append(toIndentedString(nbSortedHits)) + .append("\n"); sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); - sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb + .append(" parsedQuery: ") + .append(toIndentedString(parsedQuery)) + .append("\n"); + sb + .append(" processingTimeMS: ") + .append(toIndentedString(processingTimeMS)) + .append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); - sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); + sb + .append(" queryAfterRemoval: ") + .append(toIndentedString(queryAfterRemoval)) + .append("\n"); + sb + .append(" serverUsed: ") + .append(toIndentedString(serverUsed)) + .append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append("}"); return sb.toString(); @@ -788,6 +868,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java index 088f082087..8dc09c94d6 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,121 +20,111 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; /** * BaseSearchResponseFacetsStats */ public class BaseSearchResponseFacetsStats { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) private Integer min; public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) private Integer max; public static final String SERIALIZED_NAME_AVG = "avg"; + @SerializedName(SERIALIZED_NAME_AVG) private Integer avg; public static final String SERIALIZED_NAME_SUM = "sum"; + @SerializedName(SERIALIZED_NAME_SUM) private Integer sum; - public BaseSearchResponseFacetsStats min(Integer min) { - this.min = min; return this; } - /** + /** * The minimum value in the result set. * @return min - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The minimum value in the result set.") - public Integer getMin() { return min; } - public void setMin(Integer min) { this.min = min; } - public BaseSearchResponseFacetsStats max(Integer max) { - this.max = max; return this; } - /** + /** * The maximum value in the result set. * @return max - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The maximum value in the result set.") - public Integer getMax() { return max; } - public void setMax(Integer max) { this.max = max; } - public BaseSearchResponseFacetsStats avg(Integer avg) { - this.avg = avg; return this; } - /** + /** * The average facet value in the result set. * @return avg - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The average facet value in the result set.") - public Integer getAvg() { return avg; } - public void setAvg(Integer avg) { this.avg = avg; } - public BaseSearchResponseFacetsStats sum(Integer sum) { - this.sum = sum; return this; } - /** + /** * The sum of all values in the result set. * @return sum - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The sum of all values in the result set.") - public Integer getSum() { return sum; } - public void setSum(Integer sum) { this.sum = sum; } - @Override public boolean equals(Object o) { if (this == o) { @@ -147,10 +134,12 @@ public boolean equals(Object o) { return false; } BaseSearchResponseFacetsStats baseSearchResponseFacetsStats = (BaseSearchResponseFacetsStats) o; - return Objects.equals(this.min, baseSearchResponseFacetsStats.min) && - Objects.equals(this.max, baseSearchResponseFacetsStats.max) && - Objects.equals(this.avg, baseSearchResponseFacetsStats.avg) && - Objects.equals(this.sum, baseSearchResponseFacetsStats.sum); + return ( + Objects.equals(this.min, baseSearchResponseFacetsStats.min) && + Objects.equals(this.max, baseSearchResponseFacetsStats.max) && + Objects.equals(this.avg, baseSearchResponseFacetsStats.avg) && + Objects.equals(this.sum, baseSearchResponseFacetsStats.sum) + ); } @Override @@ -180,6 +169,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 9cc9f057a4..64947bc44d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.Operation; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,21 +22,22 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * The `batch` requests. */ @ApiModel(description = "The `batch` requests.") - public class BatchObject { + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + @SerializedName(SERIALIZED_NAME_REQUESTS) private List requests = null; - public BatchObject requests(List requests) { - this.requests = requests; return this; } @@ -52,23 +50,20 @@ public BatchObject addRequestsItem(Operation requestsItem) { return this; } - /** + /** * Get requests * @return requests - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public List getRequests() { return requests; } - public void setRequests(List requests) { this.requests = requests; } - @Override public boolean equals(Object o) { if (this == o) { @@ -105,6 +100,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index 92c766e8cd..d342ddb303 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,47 +21,46 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * BatchResponse */ public class BatchResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; public static final String SERIALIZED_NAME_OBJECT_I_DS = "objectIDs"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_DS) private List objectIDs = null; - public BatchResponse taskID(Integer taskID) { - this.taskID = taskID; return this; } - /** + /** * taskID of the indexing task to wait for. * @return taskID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { return taskID; } - public void setTaskID(Integer taskID) { this.taskID = taskID; } - public BatchResponse objectIDs(List objectIDs) { - this.objectIDs = objectIDs; return this; } @@ -77,23 +73,20 @@ public BatchResponse addObjectIDsItem(String objectIDsItem) { return this; } - /** + /** * List of objectID. * @return objectIDs - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of objectID.") - public List getObjectIDs() { return objectIDs; } - public void setObjectIDs(List objectIDs) { this.objectIDs = objectIDs; } - @Override public boolean equals(Object o) { if (this == o) { @@ -103,8 +96,10 @@ public boolean equals(Object o) { return false; } BatchResponse batchResponse = (BatchResponse) o; - return Objects.equals(this.taskID, batchResponse.taskID) && - Objects.equals(this.objectIDs, batchResponse.objectIDs); + return ( + Objects.equals(this.taskID, batchResponse.taskID) && + Objects.equals(this.objectIDs, batchResponse.objectIDs) + ); } @Override @@ -117,7 +112,10 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BatchResponse {\n"); sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb.append(" objectIDs: ").append(toIndentedString(objectIDs)).append("\n"); + sb + .append(" objectIDs: ") + .append(toIndentedString(objectIDs)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -132,6 +130,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index 7a6a7b55ee..a135d459c3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,67 +21,63 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Objects; /** * DeleteIndexResponse */ public class DeleteIndexResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; public static final String SERIALIZED_NAME_DELETE_AT = "deleteAt"; + @SerializedName(SERIALIZED_NAME_DELETE_AT) private OffsetDateTime deleteAt; - public DeleteIndexResponse taskID(Integer taskID) { - this.taskID = taskID; return this; } - /** + /** * taskID of the indexing task to wait for. * @return taskID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { return taskID; } - public void setTaskID(Integer taskID) { this.taskID = taskID; } - public DeleteIndexResponse deleteAt(OffsetDateTime deleteAt) { - this.deleteAt = deleteAt; return this; } - /** + /** * Date of deletion (ISO-8601 format). * @return deleteAt - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") - public OffsetDateTime getDeleteAt() { return deleteAt; } - public void setDeleteAt(OffsetDateTime deleteAt) { this.deleteAt = deleteAt; } - @Override public boolean equals(Object o) { if (this == o) { @@ -94,8 +87,10 @@ public boolean equals(Object o) { return false; } DeleteIndexResponse deleteIndexResponse = (DeleteIndexResponse) o; - return Objects.equals(this.taskID, deleteIndexResponse.taskID) && - Objects.equals(this.deleteAt, deleteIndexResponse.deleteAt); + return ( + Objects.equals(this.taskID, deleteIndexResponse.taskID) && + Objects.equals(this.deleteAt, deleteIndexResponse.deleteAt) + ); } @Override @@ -123,6 +118,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java index 67e1f67cd1..f0b6978dcb 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,43 +20,41 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** * Error. */ @ApiModel(description = "Error.") - public class ErrorBase extends HashMap { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; - public ErrorBase message(String message) { - this.message = message; return this; } - /** + /** * Get message * @return message - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(example = "Invalid Application-Id or API-Key", value = "") - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - @Override public boolean equals(Object o) { if (this == o) { @@ -69,8 +64,7 @@ public boolean equals(Object o) { return false; } ErrorBase errorBase = (ErrorBase) o; - return Objects.equals(this.message, errorBase.message) && - super.equals(o); + return Objects.equals(this.message, errorBase.message) && super.equals(o); } @Override @@ -98,6 +92,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index 476549e64f..96992f50fa 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,14 +21,18 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * HighlightResult */ public class HighlightResult { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) private String value; @@ -41,9 +42,9 @@ public class HighlightResult { @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), - + PARTIAL("partial"), - + FULL("full"); private String value; @@ -71,80 +72,84 @@ public static MatchLevelEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final MatchLevelEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final MatchLevelEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public MatchLevelEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public MatchLevelEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return MatchLevelEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) private MatchLevelEnum matchLevel; public static final String SERIALIZED_NAME_MATCHED_WORDS = "matchedWords"; + @SerializedName(SERIALIZED_NAME_MATCHED_WORDS) private List matchedWords = null; - public static final String SERIALIZED_NAME_FULLY_HIGHLIGHTED = "fullyHighlighted"; + public static final String SERIALIZED_NAME_FULLY_HIGHLIGHTED = + "fullyHighlighted"; + @SerializedName(SERIALIZED_NAME_FULLY_HIGHLIGHTED) private Boolean fullyHighlighted; - public HighlightResult value(String value) { - this.value = value; return this; } - /** + /** * Markup text with occurrences highlighted. * @return value - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "George Clooney", value = "Markup text with occurrences highlighted.") - + @ApiModelProperty( + example = "George Clooney", + value = "Markup text with occurrences highlighted." + ) public String getValue() { return value; } - public void setValue(String value) { this.value = value; } - public HighlightResult matchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; return this; } - /** + /** * Indicates how well the attribute matched the search query. * @return matchLevel - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Indicates how well the attribute matched the search query.") - + @ApiModelProperty( + value = "Indicates how well the attribute matched the search query." + ) public MatchLevelEnum getMatchLevel() { return matchLevel; } - public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } - public HighlightResult matchedWords(List matchedWords) { - this.matchedWords = matchedWords; return this; } @@ -157,46 +162,43 @@ public HighlightResult addMatchedWordsItem(String matchedWordsItem) { return this; } - /** + /** * List of words from the query that matched the object. * @return matchedWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of words from the query that matched the object.") - + @ApiModelProperty( + value = "List of words from the query that matched the object." + ) public List getMatchedWords() { return matchedWords; } - public void setMatchedWords(List matchedWords) { this.matchedWords = matchedWords; } - public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { - this.fullyHighlighted = fullyHighlighted; return this; } - /** + /** * Whether the entire attribute value is highlighted. * @return fullyHighlighted - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the entire attribute value is highlighted.") - + @ApiModelProperty( + value = "Whether the entire attribute value is highlighted." + ) public Boolean getFullyHighlighted() { return fullyHighlighted; } - public void setFullyHighlighted(Boolean fullyHighlighted) { this.fullyHighlighted = fullyHighlighted; } - @Override public boolean equals(Object o) { if (this == o) { @@ -206,10 +208,12 @@ public boolean equals(Object o) { return false; } HighlightResult highlightResult = (HighlightResult) o; - return Objects.equals(this.value, highlightResult.value) && - Objects.equals(this.matchLevel, highlightResult.matchLevel) && - Objects.equals(this.matchedWords, highlightResult.matchedWords) && - Objects.equals(this.fullyHighlighted, highlightResult.fullyHighlighted); + return ( + Objects.equals(this.value, highlightResult.value) && + Objects.equals(this.matchLevel, highlightResult.matchLevel) && + Objects.equals(this.matchedWords, highlightResult.matchedWords) && + Objects.equals(this.fullyHighlighted, highlightResult.fullyHighlighted) + ); } @Override @@ -222,9 +226,18 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class HighlightResult {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).append("\n"); - sb.append(" matchedWords: ").append(toIndentedString(matchedWords)).append("\n"); - sb.append(" fullyHighlighted: ").append(toIndentedString(fullyHighlighted)).append("\n"); + sb + .append(" matchLevel: ") + .append(toIndentedString(matchLevel)) + .append("\n"); + sb + .append(" matchedWords: ") + .append(toIndentedString(matchedWords)) + .append("\n"); + sb + .append(" fullyHighlighted: ") + .append(toIndentedString(fullyHighlighted)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -239,6 +252,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index d757f932ae..d5e1885d5b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -25,290 +22,286 @@ import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * Index */ public class Index { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) private String name; public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) private OffsetDateTime createdAt; public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; public static final String SERIALIZED_NAME_ENTRIES = "entries"; + @SerializedName(SERIALIZED_NAME_ENTRIES) private Integer entries; public static final String SERIALIZED_NAME_DATA_SIZE = "dataSize"; + @SerializedName(SERIALIZED_NAME_DATA_SIZE) private Integer dataSize; public static final String SERIALIZED_NAME_FILE_SIZE = "fileSize"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) private Integer fileSize; - public static final String SERIALIZED_NAME_LAST_BUILD_TIME_S = "lastBuildTimeS"; + public static final String SERIALIZED_NAME_LAST_BUILD_TIME_S = + "lastBuildTimeS"; + @SerializedName(SERIALIZED_NAME_LAST_BUILD_TIME_S) private Integer lastBuildTimeS; - public static final String SERIALIZED_NAME_NUMBER_OF_PENDING_TASK = "numberOfPendingTask"; + public static final String SERIALIZED_NAME_NUMBER_OF_PENDING_TASK = + "numberOfPendingTask"; + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PENDING_TASK) private Integer numberOfPendingTask; public static final String SERIALIZED_NAME_PENDING_TASK = "pendingTask"; + @SerializedName(SERIALIZED_NAME_PENDING_TASK) private Boolean pendingTask; public static final String SERIALIZED_NAME_PRIMARY = "primary"; + @SerializedName(SERIALIZED_NAME_PRIMARY) private String primary; public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; - public Index name(String name) { - this.name = name; return this; } - /** + /** * Index name. * @return name - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Index name.") - public String getName() { return name; } - public void setName(String name) { this.name = name; } - public Index createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; return this; } - /** + /** * Index creation date. An empty string means that the index has no records. * @return createdAt - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Index creation date. An empty string means that the index has no records.") - + @ApiModelProperty( + required = true, + value = "Index creation date. An empty string means that the index has no records." + ) public OffsetDateTime getCreatedAt() { return createdAt; } - public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; } - public Index updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; return this; } - /** + /** * Date of last update (ISO-8601 format). * @return updatedAt - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Date of last update (ISO-8601 format).") - + @ApiModelProperty( + required = true, + value = "Date of last update (ISO-8601 format)." + ) public OffsetDateTime getUpdatedAt() { return updatedAt; } - public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } - public Index entries(Integer entries) { - this.entries = entries; return this; } - /** + /** * Number of records contained in the index. * @return entries - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Number of records contained in the index.") - + @ApiModelProperty( + required = true, + value = "Number of records contained in the index." + ) public Integer getEntries() { return entries; } - public void setEntries(Integer entries) { this.entries = entries; } - public Index dataSize(Integer dataSize) { - this.dataSize = dataSize; return this; } - /** + /** * Number of bytes of the index in minified format. * @return dataSize - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Number of bytes of the index in minified format.") - + @ApiModelProperty( + required = true, + value = "Number of bytes of the index in minified format." + ) public Integer getDataSize() { return dataSize; } - public void setDataSize(Integer dataSize) { this.dataSize = dataSize; } - public Index fileSize(Integer fileSize) { - this.fileSize = fileSize; return this; } - /** + /** * Number of bytes of the index binary file. * @return fileSize - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Number of bytes of the index binary file.") - + @ApiModelProperty( + required = true, + value = "Number of bytes of the index binary file." + ) public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { this.fileSize = fileSize; } - public Index lastBuildTimeS(Integer lastBuildTimeS) { - this.lastBuildTimeS = lastBuildTimeS; return this; } - /** + /** * Last build time * @return lastBuildTimeS - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Last build time") - public Integer getLastBuildTimeS() { return lastBuildTimeS; } - public void setLastBuildTimeS(Integer lastBuildTimeS) { this.lastBuildTimeS = lastBuildTimeS; } - public Index numberOfPendingTask(Integer numberOfPendingTask) { - this.numberOfPendingTask = numberOfPendingTask; return this; } - /** + /** * Number of pending indexing operations. This value is deprecated and should not be used. * @return numberOfPendingTask - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of pending indexing operations. This value is deprecated and should not be used.") - + @ApiModelProperty( + value = "Number of pending indexing operations. This value is deprecated and should not be used." + ) public Integer getNumberOfPendingTask() { return numberOfPendingTask; } - public void setNumberOfPendingTask(Integer numberOfPendingTask) { this.numberOfPendingTask = numberOfPendingTask; } - public Index pendingTask(Boolean pendingTask) { - this.pendingTask = pendingTask; return this; } - /** + /** * A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. * @return pendingTask - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "A boolean which says whether the index has pending tasks. This value is deprecated and should not be used.") - + @ApiModelProperty( + required = true, + value = "A boolean which says whether the index has pending tasks. This value is deprecated and should not be used." + ) public Boolean getPendingTask() { return pendingTask; } - public void setPendingTask(Boolean pendingTask) { this.pendingTask = pendingTask; } - public Index primary(String primary) { - this.primary = primary; return this; } - /** + /** * Only present if the index is a replica. Contains the name of the related primary index. * @return primary - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Only present if the index is a replica. Contains the name of the related primary index.") - + @ApiModelProperty( + value = "Only present if the index is a replica. Contains the name of the related primary index." + ) public String getPrimary() { return primary; } - public void setPrimary(String primary) { this.primary = primary; } - public Index replicas(List replicas) { - this.replicas = replicas; return this; } @@ -321,23 +314,22 @@ public Index addReplicasItem(String replicasItem) { return this; } - /** + /** * Only present if the index is a primary index with replicas. Contains the names of all linked replicas. * @return replicas - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Only present if the index is a primary index with replicas. Contains the names of all linked replicas.") - + @ApiModelProperty( + value = "Only present if the index is a primary index with replicas. Contains the names of all linked replicas." + ) public List getReplicas() { return replicas; } - public void setReplicas(List replicas) { this.replicas = replicas; } - @Override public boolean equals(Object o) { if (this == o) { @@ -347,22 +339,36 @@ public boolean equals(Object o) { return false; } Index index = (Index) o; - return Objects.equals(this.name, index.name) && - Objects.equals(this.createdAt, index.createdAt) && - Objects.equals(this.updatedAt, index.updatedAt) && - Objects.equals(this.entries, index.entries) && - Objects.equals(this.dataSize, index.dataSize) && - Objects.equals(this.fileSize, index.fileSize) && - Objects.equals(this.lastBuildTimeS, index.lastBuildTimeS) && - Objects.equals(this.numberOfPendingTask, index.numberOfPendingTask) && - Objects.equals(this.pendingTask, index.pendingTask) && - Objects.equals(this.primary, index.primary) && - Objects.equals(this.replicas, index.replicas); + return ( + Objects.equals(this.name, index.name) && + Objects.equals(this.createdAt, index.createdAt) && + Objects.equals(this.updatedAt, index.updatedAt) && + Objects.equals(this.entries, index.entries) && + Objects.equals(this.dataSize, index.dataSize) && + Objects.equals(this.fileSize, index.fileSize) && + Objects.equals(this.lastBuildTimeS, index.lastBuildTimeS) && + Objects.equals(this.numberOfPendingTask, index.numberOfPendingTask) && + Objects.equals(this.pendingTask, index.pendingTask) && + Objects.equals(this.primary, index.primary) && + Objects.equals(this.replicas, index.replicas) + ); } @Override public int hashCode() { - return Objects.hash(name, createdAt, updatedAt, entries, dataSize, fileSize, lastBuildTimeS, numberOfPendingTask, pendingTask, primary, replicas); + return Objects.hash( + name, + createdAt, + updatedAt, + entries, + dataSize, + fileSize, + lastBuildTimeS, + numberOfPendingTask, + pendingTask, + primary, + replicas + ); } @Override @@ -370,14 +376,29 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Index {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb + .append(" createdAt: ") + .append(toIndentedString(createdAt)) + .append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .append("\n"); sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); sb.append(" dataSize: ").append(toIndentedString(dataSize)).append("\n"); sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); - sb.append(" lastBuildTimeS: ").append(toIndentedString(lastBuildTimeS)).append("\n"); - sb.append(" numberOfPendingTask: ").append(toIndentedString(numberOfPendingTask)).append("\n"); - sb.append(" pendingTask: ").append(toIndentedString(pendingTask)).append("\n"); + sb + .append(" lastBuildTimeS: ") + .append(toIndentedString(lastBuildTimeS)) + .append("\n"); + sb + .append(" numberOfPendingTask: ") + .append(toIndentedString(numberOfPendingTask)) + .append("\n"); + sb + .append(" pendingTask: ") + .append(toIndentedString(pendingTask)) + .append("\n"); sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); sb.append("}"); @@ -394,6 +415,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index b073e36709..b0fb71edc7 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.BaseIndexSettings; import com.algolia.model.IndexSettingsAsSearchParams; import com.google.gson.TypeAdapter; @@ -26,129 +23,182 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * The Algolia index settings. */ @ApiModel(description = "The Algolia index settings.") - public class IndexSettings { + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; - public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = + "paginationLimitedTo"; + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = + "disableTypoToleranceOnWords"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = + "attributesToTransliterate"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = + "camelCaseAttributes"; + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = + "decompoundedAttributes"; + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) private List indexLanguages = null; public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) private Boolean filterPromotes = false; - public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = + "disablePrefixOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + "allowCompressionOfIntegerArray"; + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = + "numericAttributesForFiltering"; + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; @@ -158,11 +208,11 @@ public class IndexSettings { @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), - + FALSE("false"), - + MIN("min"), - + STRICT("strict"); private String value; @@ -190,60 +240,83 @@ public static TypoToleranceEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return TypoToleranceEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; @@ -253,9 +326,9 @@ public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), - + PREFIXALL("prefixAll"), - + PREFIXNONE("prefixNone"); private String value; @@ -283,20 +356,26 @@ public static QueryTypeEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return QueryTypeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; @@ -306,11 +385,11 @@ public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), - + LASTWORDS("lastWords"), - + FIRSTWORDS("firstWords"), - + ALLOPTIONAL("allOptional"); private String value; @@ -337,33 +416,46 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return RemoveWordsIfNoResultsEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = + RemoveWordsIfNoResultsEnum.NONE; public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; @@ -373,9 +465,9 @@ public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), - + NONE("none"), - + WORD("word"); private String value; @@ -402,23 +494,32 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return ExactOnSingleWordQueryEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = + ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact @@ -426,9 +527,9 @@ public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), - + SINGLEWORDSYNONYM("singleWordSynonym"), - + MULTIWORDSSYNONYM("multiWordsSynonym"); private String value; @@ -456,20 +557,27 @@ public static AlternativesAsExactEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AlternativesAsExactEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; @@ -479,7 +587,7 @@ public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOExcept @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), - + EXCLUDEWORDS("excludeWords"); private String value; @@ -506,59 +614,76 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AdvancedSyntaxFeaturesEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + public static final String SERIALIZED_NAME_RENDERING_CONTENT = + "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); - public IndexSettings replicas(List replicas) { - this.replicas = replicas; return this; } @@ -571,53 +696,51 @@ public IndexSettings addReplicasItem(String replicasItem) { return this; } - /** + /** * Creates replicas, exact copies of an index. * @return replicas - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") - public List getReplicas() { return replicas; } - public void setReplicas(List replicas) { this.replicas = replicas; } - public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { - this.paginationLimitedTo = paginationLimitedTo; return this; } - /** + /** * Set the maximum number of hits accessible via pagination. * @return paginationLimitedTo - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Set the maximum number of hits accessible via pagination.") - + @ApiModelProperty( + value = "Set the maximum number of hits accessible via pagination." + ) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } - public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } - - public IndexSettings disableTypoToleranceOnWords(List disableTypoToleranceOnWords) { - + public IndexSettings disableTypoToleranceOnWords( + List disableTypoToleranceOnWords + ) { this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; return this; } - public IndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoToleranceOnWordsItem) { + public IndexSettings addDisableTypoToleranceOnWordsItem( + String disableTypoToleranceOnWordsItem + ) { if (this.disableTypoToleranceOnWords == null) { this.disableTypoToleranceOnWords = new ArrayList<>(); } @@ -625,30 +748,34 @@ public IndexSettings addDisableTypoToleranceOnWordsItem(String disableTypoTolera return this; } - /** + /** * A list of words for which you want to turn off typo tolerance. * @return disableTypoToleranceOnWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of words for which you want to turn off typo tolerance.") - + @ApiModelProperty( + value = "A list of words for which you want to turn off typo tolerance." + ) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } - - public void setDisableTypoToleranceOnWords(List disableTypoToleranceOnWords) { + public void setDisableTypoToleranceOnWords( + List disableTypoToleranceOnWords + ) { this.disableTypoToleranceOnWords = disableTypoToleranceOnWords; } - - public IndexSettings attributesToTransliterate(List attributesToTransliterate) { - + public IndexSettings attributesToTransliterate( + List attributesToTransliterate + ) { this.attributesToTransliterate = attributesToTransliterate; return this; } - public IndexSettings addAttributesToTransliterateItem(String attributesToTransliterateItem) { + public IndexSettings addAttributesToTransliterateItem( + String attributesToTransliterateItem + ) { if (this.attributesToTransliterate == null) { this.attributesToTransliterate = new ArrayList<>(); } @@ -656,30 +783,32 @@ public IndexSettings addAttributesToTransliterateItem(String attributesToTransli return this; } - /** + /** * Specify on which attributes to apply transliteration. * @return attributesToTransliterate - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Specify on which attributes to apply transliteration.") - + @ApiModelProperty( + value = "Specify on which attributes to apply transliteration." + ) public List getAttributesToTransliterate() { return attributesToTransliterate; } - - public void setAttributesToTransliterate(List attributesToTransliterate) { + public void setAttributesToTransliterate( + List attributesToTransliterate + ) { this.attributesToTransliterate = attributesToTransliterate; } - public IndexSettings camelCaseAttributes(List camelCaseAttributes) { - this.camelCaseAttributes = camelCaseAttributes; return this; } - public IndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) { + public IndexSettings addCamelCaseAttributesItem( + String camelCaseAttributesItem + ) { if (this.camelCaseAttributes == null) { this.camelCaseAttributes = new ArrayList<>(); } @@ -687,30 +816,33 @@ public IndexSettings addCamelCaseAttributesItem(String camelCaseAttributesItem) return this; } - /** + /** * List of attributes on which to do a decomposition of camel case words. * @return camelCaseAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which to do a decomposition of camel case words.") - + @ApiModelProperty( + value = "List of attributes on which to do a decomposition of camel case words." + ) public List getCamelCaseAttributes() { return camelCaseAttributes; } - public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } - - public IndexSettings decompoundedAttributes(Map decompoundedAttributes) { - + public IndexSettings decompoundedAttributes( + Map decompoundedAttributes + ) { this.decompoundedAttributes = decompoundedAttributes; return this; } - public IndexSettings putDecompoundedAttributesItem(String key, Object decompoundedAttributesItem) { + public IndexSettings putDecompoundedAttributesItem( + String key, + Object decompoundedAttributesItem + ) { if (this.decompoundedAttributes == null) { this.decompoundedAttributes = new HashMap<>(); } @@ -718,25 +850,25 @@ public IndexSettings putDecompoundedAttributesItem(String key, Object decompound return this; } - /** + /** * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. * @return decompoundedAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding.") - + @ApiModelProperty( + value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." + ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } - - public void setDecompoundedAttributes(Map decompoundedAttributes) { + public void setDecompoundedAttributes( + Map decompoundedAttributes + ) { this.decompoundedAttributes = decompoundedAttributes; } - public IndexSettings indexLanguages(List indexLanguages) { - this.indexLanguages = indexLanguages; return this; } @@ -749,53 +881,53 @@ public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { return this; } - /** + /** * Sets the languages at the index level for language-specific processing such as tokenization and normalization. * @return indexLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization.") - + @ApiModelProperty( + value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." + ) public List getIndexLanguages() { return indexLanguages; } - public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } - public IndexSettings filterPromotes(Boolean filterPromotes) { - this.filterPromotes = filterPromotes; return this; } - /** + /** * Whether promoted results should match the filters of the current search, except for geographic filters. * @return filterPromotes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether promoted results should match the filters of the current search, except for geographic filters.") - + @ApiModelProperty( + value = "Whether promoted results should match the filters of the current search, except for geographic filters." + ) public Boolean getFilterPromotes() { return filterPromotes; } - public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } - - public IndexSettings disablePrefixOnAttributes(List disablePrefixOnAttributes) { - + public IndexSettings disablePrefixOnAttributes( + List disablePrefixOnAttributes + ) { this.disablePrefixOnAttributes = disablePrefixOnAttributes; return this; } - public IndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttributesItem) { + public IndexSettings addDisablePrefixOnAttributesItem( + String disablePrefixOnAttributesItem + ) { if (this.disablePrefixOnAttributes == null) { this.disablePrefixOnAttributes = new ArrayList<>(); } @@ -803,53 +935,57 @@ public IndexSettings addDisablePrefixOnAttributesItem(String disablePrefixOnAttr return this; } - /** + /** * List of attributes on which you want to disable prefix matching. * @return disablePrefixOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable prefix matching.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable prefix matching." + ) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } - - public void setDisablePrefixOnAttributes(List disablePrefixOnAttributes) { + public void setDisablePrefixOnAttributes( + List disablePrefixOnAttributes + ) { this.disablePrefixOnAttributes = disablePrefixOnAttributes; } - - public IndexSettings allowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { - + public IndexSettings allowCompressionOfIntegerArray( + Boolean allowCompressionOfIntegerArray + ) { this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; return this; } - /** + /** * Enables compression of large integer arrays. * @return allowCompressionOfIntegerArray - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") - public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } - - public void setAllowCompressionOfIntegerArray(Boolean allowCompressionOfIntegerArray) { + public void setAllowCompressionOfIntegerArray( + Boolean allowCompressionOfIntegerArray + ) { this.allowCompressionOfIntegerArray = allowCompressionOfIntegerArray; } - - public IndexSettings numericAttributesForFiltering(List numericAttributesForFiltering) { - + public IndexSettings numericAttributesForFiltering( + List numericAttributesForFiltering + ) { this.numericAttributesForFiltering = numericAttributesForFiltering; return this; } - public IndexSettings addNumericAttributesForFilteringItem(String numericAttributesForFilteringItem) { + public IndexSettings addNumericAttributesForFilteringItem( + String numericAttributesForFilteringItem + ) { if (this.numericAttributesForFiltering == null) { this.numericAttributesForFiltering = new ArrayList<>(); } @@ -857,25 +993,25 @@ public IndexSettings addNumericAttributesForFilteringItem(String numericAttribut return this; } - /** + /** * List of numeric attributes that can be used as numerical filters. * @return numericAttributesForFiltering - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of numeric attributes that can be used as numerical filters.") - + @ApiModelProperty( + value = "List of numeric attributes that can be used as numerical filters." + ) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } - - public void setNumericAttributesForFiltering(List numericAttributesForFiltering) { + public void setNumericAttributesForFiltering( + List numericAttributesForFiltering + ) { this.numericAttributesForFiltering = numericAttributesForFiltering; } - public IndexSettings userData(Map userData) { - this.userData = userData; return this; } @@ -888,30 +1024,28 @@ public IndexSettings putUserDataItem(String key, Object userDataItem) { return this; } - /** + /** * Lets you store custom data in your indices. * @return userData - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - public Map getUserData() { return userData; } - public void setUserData(Map userData) { this.userData = userData; } - public IndexSettings searchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; return this; } - public IndexSettings addSearchableAttributesItem(String searchableAttributesItem) { + public IndexSettings addSearchableAttributesItem( + String searchableAttributesItem + ) { if (this.searchableAttributes == null) { this.searchableAttributes = new ArrayList<>(); } @@ -919,30 +1053,32 @@ public IndexSettings addSearchableAttributesItem(String searchableAttributesItem return this; } - /** + /** * The complete list of attributes used for searching. * @return searchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes used for searching.") - + @ApiModelProperty( + value = "The complete list of attributes used for searching." + ) public List getSearchableAttributes() { return searchableAttributes; } - public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } - - public IndexSettings attributesForFaceting(List attributesForFaceting) { - + public IndexSettings attributesForFaceting( + List attributesForFaceting + ) { this.attributesForFaceting = attributesForFaceting; return this; } - public IndexSettings addAttributesForFacetingItem(String attributesForFacetingItem) { + public IndexSettings addAttributesForFacetingItem( + String attributesForFacetingItem + ) { if (this.attributesForFaceting == null) { this.attributesForFaceting = new ArrayList<>(); } @@ -950,30 +1086,32 @@ public IndexSettings addAttributesForFacetingItem(String attributesForFacetingIt return this; } - /** + /** * The complete list of attributes that will be used for faceting. * @return attributesForFaceting - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") - + @ApiModelProperty( + value = "The complete list of attributes that will be used for faceting." + ) public List getAttributesForFaceting() { return attributesForFaceting; } - public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } - - public IndexSettings unretrievableAttributes(List unretrievableAttributes) { - + public IndexSettings unretrievableAttributes( + List unretrievableAttributes + ) { this.unretrievableAttributes = unretrievableAttributes; return this; } - public IndexSettings addUnretrievableAttributesItem(String unretrievableAttributesItem) { + public IndexSettings addUnretrievableAttributesItem( + String unretrievableAttributesItem + ) { if (this.unretrievableAttributes == null) { this.unretrievableAttributes = new ArrayList<>(); } @@ -981,30 +1119,30 @@ public IndexSettings addUnretrievableAttributesItem(String unretrievableAttribut return this; } - /** + /** * List of attributes that can’t be retrieved at query time. * @return unretrievableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") - + @ApiModelProperty( + value = "List of attributes that can’t be retrieved at query time." + ) public List getUnretrievableAttributes() { return unretrievableAttributes; } - public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } - public IndexSettings attributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; return this; } - public IndexSettings addAttributesToRetrieveItem(String attributesToRetrieveItem) { + public IndexSettings addAttributesToRetrieveItem( + String attributesToRetrieveItem + ) { if (this.attributesToRetrieve == null) { this.attributesToRetrieve = new ArrayList<>(); } @@ -1012,30 +1150,32 @@ public IndexSettings addAttributesToRetrieveItem(String attributesToRetrieveItem return this; } - /** + /** * This parameter controls which attributes to retrieve and which not to retrieve. * @return attributesToRetrieve - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") - + @ApiModelProperty( + value = "This parameter controls which attributes to retrieve and which not to retrieve." + ) public List getAttributesToRetrieve() { return attributesToRetrieve; } - public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } - - public IndexSettings restrictSearchableAttributes(List restrictSearchableAttributes) { - + public IndexSettings restrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; return this; } - public IndexSettings addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + public IndexSettings addRestrictSearchableAttributesItem( + String restrictSearchableAttributesItem + ) { if (this.restrictSearchableAttributes == null) { this.restrictSearchableAttributes = new ArrayList<>(); } @@ -1043,25 +1183,25 @@ public IndexSettings addRestrictSearchableAttributesItem(String restrictSearchab return this; } - /** + /** * Restricts a given query to look in only a subset of your searchable attributes. * @return restrictSearchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") - + @ApiModelProperty( + value = "Restricts a given query to look in only a subset of your searchable attributes." + ) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - - public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + public void setRestrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; } - public IndexSettings ranking(List ranking) { - this.ranking = ranking; return this; } @@ -1074,25 +1214,21 @@ public IndexSettings addRankingItem(String rankingItem) { return this; } - /** + /** * Controls how Algolia should sort your results. * @return ranking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - public List getRanking() { return ranking; } - public void setRanking(List ranking) { this.ranking = ranking; } - public IndexSettings customRanking(List customRanking) { - this.customRanking = customRanking; return this; } @@ -1105,53 +1241,51 @@ public IndexSettings addCustomRankingItem(String customRankingItem) { return this; } - /** + /** * Specifies the custom ranking criterion. * @return customRanking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - public List getCustomRanking() { return customRanking; } - public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } - public IndexSettings relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; return this; } - /** + /** * Controls the relevancy threshold below which less relevant results aren’t included in the results. * @return relevancyStrictness - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") - + @ApiModelProperty( + value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + ) public Integer getRelevancyStrictness() { return relevancyStrictness; } - public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } - - public IndexSettings attributesToHighlight(List attributesToHighlight) { - + public IndexSettings attributesToHighlight( + List attributesToHighlight + ) { this.attributesToHighlight = attributesToHighlight; return this; } - public IndexSettings addAttributesToHighlightItem(String attributesToHighlightItem) { + public IndexSettings addAttributesToHighlightItem( + String attributesToHighlightItem + ) { if (this.attributesToHighlight == null) { this.attributesToHighlight = new ArrayList<>(); } @@ -1159,30 +1293,28 @@ public IndexSettings addAttributesToHighlightItem(String attributesToHighlightIt return this; } - /** + /** * List of attributes to highlight. * @return attributesToHighlight - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - public List getAttributesToHighlight() { return attributesToHighlight; } - public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } - public IndexSettings attributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; return this; } - public IndexSettings addAttributesToSnippetItem(String attributesToSnippetItem) { + public IndexSettings addAttributesToSnippetItem( + String attributesToSnippetItem + ) { if (this.attributesToSnippet == null) { this.attributesToSnippet = new ArrayList<>(); } @@ -1190,355 +1322,337 @@ public IndexSettings addAttributesToSnippetItem(String attributesToSnippetItem) return this; } - /** + /** * List of attributes to snippet, with an optional maximum number of words to snippet. * @return attributesToSnippet - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") - + @ApiModelProperty( + value = "List of attributes to snippet, with an optional maximum number of words to snippet." + ) public List getAttributesToSnippet() { return attributesToSnippet; } - public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } - public IndexSettings highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; return this; } - /** + /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. * @return highlightPreTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + ) public String getHighlightPreTag() { return highlightPreTag; } - public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } - public IndexSettings highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; return this; } - /** + /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. * @return highlightPostTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + ) public String getHighlightPostTag() { return highlightPostTag; } - public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } - public IndexSettings snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; return this; } - /** + /** * String used as an ellipsis indicator when a snippet is truncated. * @return snippetEllipsisText - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") - + @ApiModelProperty( + value = "String used as an ellipsis indicator when a snippet is truncated." + ) public String getSnippetEllipsisText() { return snippetEllipsisText; } - public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } - - public IndexSettings restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { - + public IndexSettings restrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; return this; } - /** + /** * Restrict highlighting and snippeting to items that matched the query. * @return restrictHighlightAndSnippetArrays - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") - + @ApiModelProperty( + value = "Restrict highlighting and snippeting to items that matched the query." + ) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - - public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + public void setRestrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; } - public IndexSettings hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; return this; } - /** + /** * Set the number of hits per page. * @return hitsPerPage - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - public Integer getHitsPerPage() { return hitsPerPage; } - public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } - public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. * @return minWordSizefor1Typo - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + ) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } - public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. * @return minWordSizefor2Typos - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + ) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } - public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; return this; } - /** + /** * Controls whether typo tolerance is enabled and how it is applied. * @return typoTolerance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") - + @ApiModelProperty( + value = "Controls whether typo tolerance is enabled and how it is applied." + ) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } - - public IndexSettings allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - + public IndexSettings allowTyposOnNumericTokens( + Boolean allowTyposOnNumericTokens + ) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; return this; } - /** + /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. * @return allowTyposOnNumericTokens - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") - + @ApiModelProperty( + value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." + ) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } - - public IndexSettings disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { - + public IndexSettings disableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; return this; } - public IndexSettings addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + public IndexSettings addDisableTypoToleranceOnAttributesItem( + String disableTypoToleranceOnAttributesItem + ) { if (this.disableTypoToleranceOnAttributes == null) { this.disableTypoToleranceOnAttributes = new ArrayList<>(); } - this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + this.disableTypoToleranceOnAttributes.add( + disableTypoToleranceOnAttributesItem + ); return this; } - /** + /** * List of attributes on which you want to disable typo tolerance. * @return disableTypoToleranceOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable typo tolerance." + ) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - - public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + public void setDisableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; } - public IndexSettings separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; return this; } - /** + /** * Control which separators are indexed. * @return separatorsToIndex - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - public String getSeparatorsToIndex() { return separatorsToIndex; } - public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } - public IndexSettings ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; return this; } - /** + /** * Treats singular, plurals, and other forms of declensions as matching terms. * @return ignorePlurals - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") - + @ApiModelProperty( + value = "Treats singular, plurals, and other forms of declensions as matching terms." + ) public String getIgnorePlurals() { return ignorePlurals; } - public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } - public IndexSettings removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; return this; } - /** + /** * Removes stop (common) words from the query before executing it. * @return removeStopWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") - + @ApiModelProperty( + value = "Removes stop (common) words from the query before executing it." + ) public String getRemoveStopWords() { return removeStopWords; } - public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } - - public IndexSettings keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - + public IndexSettings keepDiacriticsOnCharacters( + String keepDiacriticsOnCharacters + ) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; return this; } - /** + /** * List of characters that the engine shouldn’t automatically normalize. * @return keepDiacriticsOnCharacters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") - + @ApiModelProperty( + value = "List of characters that the engine shouldn’t automatically normalize." + ) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } - public IndexSettings queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; return this; } @@ -1551,163 +1665,147 @@ public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { return this; } - /** + /** * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. * @return queryLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") - + @ApiModelProperty( + value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + ) public List getQueryLanguages() { return queryLanguages; } - public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } - public IndexSettings decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; return this; } - /** + /** * Splits compound words into their composing atoms in the query. * @return decompoundQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") - + @ApiModelProperty( + value = "Splits compound words into their composing atoms in the query." + ) public Boolean getDecompoundQuery() { return decompoundQuery; } - public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } - public IndexSettings enableRules(Boolean enableRules) { - this.enableRules = enableRules; return this; } - /** + /** * Whether Rules should be globally enabled. * @return enableRules - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - public Boolean getEnableRules() { return enableRules; } - public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } - public IndexSettings enablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; return this; } - /** + /** * Enable the Personalization feature. * @return enablePersonalization - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - public Boolean getEnablePersonalization() { return enablePersonalization; } - public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } - public IndexSettings queryType(QueryTypeEnum queryType) { - this.queryType = queryType; return this; } - /** + /** * Controls if and how query words are interpreted as prefixes. * @return queryType - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") - + @ApiModelProperty( + value = "Controls if and how query words are interpreted as prefixes." + ) public QueryTypeEnum getQueryType() { return queryType; } - public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } - - public IndexSettings removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { - + public IndexSettings removeWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; return this; } - /** + /** * Selects a strategy to remove words from the query when it doesn’t match any hits. * @return removeWordsIfNoResults - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") - + @ApiModelProperty( + value = "Selects a strategy to remove words from the query when it doesn’t match any hits." + ) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - - public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + public void setRemoveWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; } - public IndexSettings advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; return this; } - /** + /** * Enables the advanced query syntax. * @return advancedSyntax - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - public Boolean getAdvancedSyntax() { return advancedSyntax; } - public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } - public IndexSettings optionalWords(List optionalWords) { - this.optionalWords = optionalWords; return this; } @@ -1720,30 +1818,32 @@ public IndexSettings addOptionalWordsItem(String optionalWordsItem) { return this; } - /** + /** * A list of words that should be considered as optional when found in the query. * @return optionalWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") - + @ApiModelProperty( + value = "A list of words that should be considered as optional when found in the query." + ) public List getOptionalWords() { return optionalWords; } - public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } - - public IndexSettings disableExactOnAttributes(List disableExactOnAttributes) { - + public IndexSettings disableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; return this; } - public IndexSettings addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + public IndexSettings addDisableExactOnAttributesItem( + String disableExactOnAttributesItem + ) { if (this.disableExactOnAttributes == null) { this.disableExactOnAttributes = new ArrayList<>(); } @@ -1751,53 +1851,59 @@ public IndexSettings addDisableExactOnAttributesItem(String disableExactOnAttrib return this; } - /** + /** * List of attributes on which you want to disable the exact ranking criterion. * @return disableExactOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable the exact ranking criterion." + ) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - - public void setDisableExactOnAttributes(List disableExactOnAttributes) { + public void setDisableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; } - - public IndexSettings exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { - + public IndexSettings exactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; return this; } - /** + /** * Controls how the exact ranking criterion is computed when the query contains only one word. * @return exactOnSingleWordQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") - + @ApiModelProperty( + value = "Controls how the exact ranking criterion is computed when the query contains only one word." + ) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - - public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + public void setExactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; } - - public IndexSettings alternativesAsExact(List alternativesAsExact) { - + public IndexSettings alternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; return this; } - public IndexSettings addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + public IndexSettings addAlternativesAsExactItem( + AlternativesAsExactEnum alternativesAsExactItem + ) { if (this.alternativesAsExact == null) { this.alternativesAsExact = new ArrayList<>(); } @@ -1805,30 +1911,34 @@ public IndexSettings addAlternativesAsExactItem(AlternativesAsExactEnum alternat return this; } - /** + /** * List of alternatives that should be considered an exact match by the exact ranking criterion. * @return alternativesAsExact - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") - + @ApiModelProperty( + value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + ) public List getAlternativesAsExact() { return alternativesAsExact; } - - public void setAlternativesAsExact(List alternativesAsExact) { + public void setAlternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; } - - public IndexSettings advancedSyntaxFeatures(List advancedSyntaxFeatures) { - + public IndexSettings advancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; return this; } - public IndexSettings addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + public IndexSettings addAdvancedSyntaxFeaturesItem( + AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem + ) { if (this.advancedSyntaxFeatures == null) { this.advancedSyntaxFeatures = new ArrayList<>(); } @@ -1836,121 +1946,113 @@ public IndexSettings addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum ad return this; } - /** + /** * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. * @return advancedSyntaxFeatures - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") - + @ApiModelProperty( + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + ) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - - public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + public void setAdvancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; } - public IndexSettings distinct(Integer distinct) { - this.distinct = distinct; return this; } - /** + /** * Enables de-duplication or grouping of results. * minimum: 0 * maximum: 4 * @return distinct - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - public Integer getDistinct() { return distinct; } - public void setDistinct(Integer distinct) { this.distinct = distinct; } - public IndexSettings synonyms(Boolean synonyms) { - this.synonyms = synonyms; return this; } - /** + /** * Whether to take into account an index’s synonyms for a particular search. * @return synonyms - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") - + @ApiModelProperty( + value = "Whether to take into account an index’s synonyms for a particular search." + ) public Boolean getSynonyms() { return synonyms; } - public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } - - public IndexSettings replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { - + public IndexSettings replaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; return this; } - /** + /** * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. * @return replaceSynonymsInHighlight - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") - + @ApiModelProperty( + value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + ) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - - public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + public void setReplaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; } - public IndexSettings minProximity(Integer minProximity) { - this.minProximity = minProximity; return this; } - /** + /** * Precision of the proximity ranking criterion. * minimum: 1 * maximum: 7 * @return minProximity - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - public Integer getMinProximity() { return minProximity; } - public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } - public IndexSettings responseFields(List responseFields) { - this.responseFields = responseFields; return this; } @@ -1963,92 +2065,91 @@ public IndexSettings addResponseFieldsItem(String responseFieldsItem) { return this; } - /** + /** * Choose which fields to return in the API response. This parameters applies to search and browse queries. * @return responseFields - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") - + @ApiModelProperty( + value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + ) public List getResponseFields() { return responseFields; } - public void setResponseFields(List responseFields) { this.responseFields = responseFields; } - public IndexSettings maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; return this; } - /** + /** * Maximum number of facet hits to return during a search for facet values. * @return maxFacetHits - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") - + @ApiModelProperty( + value = "Maximum number of facet hits to return during a search for facet values." + ) public Integer getMaxFacetHits() { return maxFacetHits; } - public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } - - public IndexSettings attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public IndexSettings attributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; return this; } - /** + /** * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. * @return attributeCriteriaComputedByMinProximity - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") - + @ApiModelProperty( + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + ) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - - public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public void setAttributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; } - public IndexSettings renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; return this; } - /** + /** * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. * @return renderingContent - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") - + @ApiModelProperty( + value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + ) public Object getRenderingContent() { return renderingContent; } - public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } - @Override public boolean equals(Object o) { if (this == o) { @@ -2058,67 +2159,219 @@ public boolean equals(Object o) { return false; } IndexSettings indexSettings = (IndexSettings) o; - return Objects.equals(this.replicas, indexSettings.replicas) && - Objects.equals(this.paginationLimitedTo, indexSettings.paginationLimitedTo) && - Objects.equals(this.disableTypoToleranceOnWords, indexSettings.disableTypoToleranceOnWords) && - Objects.equals(this.attributesToTransliterate, indexSettings.attributesToTransliterate) && - Objects.equals(this.camelCaseAttributes, indexSettings.camelCaseAttributes) && - Objects.equals(this.decompoundedAttributes, indexSettings.decompoundedAttributes) && - Objects.equals(this.indexLanguages, indexSettings.indexLanguages) && - Objects.equals(this.filterPromotes, indexSettings.filterPromotes) && - Objects.equals(this.disablePrefixOnAttributes, indexSettings.disablePrefixOnAttributes) && - Objects.equals(this.allowCompressionOfIntegerArray, indexSettings.allowCompressionOfIntegerArray) && - Objects.equals(this.numericAttributesForFiltering, indexSettings.numericAttributesForFiltering) && - Objects.equals(this.userData, indexSettings.userData) && - Objects.equals(this.searchableAttributes, indexSettings.searchableAttributes) && - Objects.equals(this.attributesForFaceting, indexSettings.attributesForFaceting) && - Objects.equals(this.unretrievableAttributes, indexSettings.unretrievableAttributes) && - Objects.equals(this.attributesToRetrieve, indexSettings.attributesToRetrieve) && - Objects.equals(this.restrictSearchableAttributes, indexSettings.restrictSearchableAttributes) && - Objects.equals(this.ranking, indexSettings.ranking) && - Objects.equals(this.customRanking, indexSettings.customRanking) && - Objects.equals(this.relevancyStrictness, indexSettings.relevancyStrictness) && - Objects.equals(this.attributesToHighlight, indexSettings.attributesToHighlight) && - Objects.equals(this.attributesToSnippet, indexSettings.attributesToSnippet) && - Objects.equals(this.highlightPreTag, indexSettings.highlightPreTag) && - Objects.equals(this.highlightPostTag, indexSettings.highlightPostTag) && - Objects.equals(this.snippetEllipsisText, indexSettings.snippetEllipsisText) && - Objects.equals(this.restrictHighlightAndSnippetArrays, indexSettings.restrictHighlightAndSnippetArrays) && - Objects.equals(this.hitsPerPage, indexSettings.hitsPerPage) && - Objects.equals(this.minWordSizefor1Typo, indexSettings.minWordSizefor1Typo) && - Objects.equals(this.minWordSizefor2Typos, indexSettings.minWordSizefor2Typos) && - Objects.equals(this.typoTolerance, indexSettings.typoTolerance) && - Objects.equals(this.allowTyposOnNumericTokens, indexSettings.allowTyposOnNumericTokens) && - Objects.equals(this.disableTypoToleranceOnAttributes, indexSettings.disableTypoToleranceOnAttributes) && - Objects.equals(this.separatorsToIndex, indexSettings.separatorsToIndex) && - Objects.equals(this.ignorePlurals, indexSettings.ignorePlurals) && - Objects.equals(this.removeStopWords, indexSettings.removeStopWords) && - Objects.equals(this.keepDiacriticsOnCharacters, indexSettings.keepDiacriticsOnCharacters) && - Objects.equals(this.queryLanguages, indexSettings.queryLanguages) && - Objects.equals(this.decompoundQuery, indexSettings.decompoundQuery) && - Objects.equals(this.enableRules, indexSettings.enableRules) && - Objects.equals(this.enablePersonalization, indexSettings.enablePersonalization) && - Objects.equals(this.queryType, indexSettings.queryType) && - Objects.equals(this.removeWordsIfNoResults, indexSettings.removeWordsIfNoResults) && - Objects.equals(this.advancedSyntax, indexSettings.advancedSyntax) && - Objects.equals(this.optionalWords, indexSettings.optionalWords) && - Objects.equals(this.disableExactOnAttributes, indexSettings.disableExactOnAttributes) && - Objects.equals(this.exactOnSingleWordQuery, indexSettings.exactOnSingleWordQuery) && - Objects.equals(this.alternativesAsExact, indexSettings.alternativesAsExact) && - Objects.equals(this.advancedSyntaxFeatures, indexSettings.advancedSyntaxFeatures) && - Objects.equals(this.distinct, indexSettings.distinct) && - Objects.equals(this.synonyms, indexSettings.synonyms) && - Objects.equals(this.replaceSynonymsInHighlight, indexSettings.replaceSynonymsInHighlight) && - Objects.equals(this.minProximity, indexSettings.minProximity) && - Objects.equals(this.responseFields, indexSettings.responseFields) && - Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && - Objects.equals(this.attributeCriteriaComputedByMinProximity, indexSettings.attributeCriteriaComputedByMinProximity) && - Objects.equals(this.renderingContent, indexSettings.renderingContent); + return ( + Objects.equals(this.replicas, indexSettings.replicas) && + Objects.equals( + this.paginationLimitedTo, + indexSettings.paginationLimitedTo + ) && + Objects.equals( + this.disableTypoToleranceOnWords, + indexSettings.disableTypoToleranceOnWords + ) && + Objects.equals( + this.attributesToTransliterate, + indexSettings.attributesToTransliterate + ) && + Objects.equals( + this.camelCaseAttributes, + indexSettings.camelCaseAttributes + ) && + Objects.equals( + this.decompoundedAttributes, + indexSettings.decompoundedAttributes + ) && + Objects.equals(this.indexLanguages, indexSettings.indexLanguages) && + Objects.equals(this.filterPromotes, indexSettings.filterPromotes) && + Objects.equals( + this.disablePrefixOnAttributes, + indexSettings.disablePrefixOnAttributes + ) && + Objects.equals( + this.allowCompressionOfIntegerArray, + indexSettings.allowCompressionOfIntegerArray + ) && + Objects.equals( + this.numericAttributesForFiltering, + indexSettings.numericAttributesForFiltering + ) && + Objects.equals(this.userData, indexSettings.userData) && + Objects.equals( + this.searchableAttributes, + indexSettings.searchableAttributes + ) && + Objects.equals( + this.attributesForFaceting, + indexSettings.attributesForFaceting + ) && + Objects.equals( + this.unretrievableAttributes, + indexSettings.unretrievableAttributes + ) && + Objects.equals( + this.attributesToRetrieve, + indexSettings.attributesToRetrieve + ) && + Objects.equals( + this.restrictSearchableAttributes, + indexSettings.restrictSearchableAttributes + ) && + Objects.equals(this.ranking, indexSettings.ranking) && + Objects.equals(this.customRanking, indexSettings.customRanking) && + Objects.equals( + this.relevancyStrictness, + indexSettings.relevancyStrictness + ) && + Objects.equals( + this.attributesToHighlight, + indexSettings.attributesToHighlight + ) && + Objects.equals( + this.attributesToSnippet, + indexSettings.attributesToSnippet + ) && + Objects.equals(this.highlightPreTag, indexSettings.highlightPreTag) && + Objects.equals(this.highlightPostTag, indexSettings.highlightPostTag) && + Objects.equals( + this.snippetEllipsisText, + indexSettings.snippetEllipsisText + ) && + Objects.equals( + this.restrictHighlightAndSnippetArrays, + indexSettings.restrictHighlightAndSnippetArrays + ) && + Objects.equals(this.hitsPerPage, indexSettings.hitsPerPage) && + Objects.equals( + this.minWordSizefor1Typo, + indexSettings.minWordSizefor1Typo + ) && + Objects.equals( + this.minWordSizefor2Typos, + indexSettings.minWordSizefor2Typos + ) && + Objects.equals(this.typoTolerance, indexSettings.typoTolerance) && + Objects.equals( + this.allowTyposOnNumericTokens, + indexSettings.allowTyposOnNumericTokens + ) && + Objects.equals( + this.disableTypoToleranceOnAttributes, + indexSettings.disableTypoToleranceOnAttributes + ) && + Objects.equals(this.separatorsToIndex, indexSettings.separatorsToIndex) && + Objects.equals(this.ignorePlurals, indexSettings.ignorePlurals) && + Objects.equals(this.removeStopWords, indexSettings.removeStopWords) && + Objects.equals( + this.keepDiacriticsOnCharacters, + indexSettings.keepDiacriticsOnCharacters + ) && + Objects.equals(this.queryLanguages, indexSettings.queryLanguages) && + Objects.equals(this.decompoundQuery, indexSettings.decompoundQuery) && + Objects.equals(this.enableRules, indexSettings.enableRules) && + Objects.equals( + this.enablePersonalization, + indexSettings.enablePersonalization + ) && + Objects.equals(this.queryType, indexSettings.queryType) && + Objects.equals( + this.removeWordsIfNoResults, + indexSettings.removeWordsIfNoResults + ) && + Objects.equals(this.advancedSyntax, indexSettings.advancedSyntax) && + Objects.equals(this.optionalWords, indexSettings.optionalWords) && + Objects.equals( + this.disableExactOnAttributes, + indexSettings.disableExactOnAttributes + ) && + Objects.equals( + this.exactOnSingleWordQuery, + indexSettings.exactOnSingleWordQuery + ) && + Objects.equals( + this.alternativesAsExact, + indexSettings.alternativesAsExact + ) && + Objects.equals( + this.advancedSyntaxFeatures, + indexSettings.advancedSyntaxFeatures + ) && + Objects.equals(this.distinct, indexSettings.distinct) && + Objects.equals(this.synonyms, indexSettings.synonyms) && + Objects.equals( + this.replaceSynonymsInHighlight, + indexSettings.replaceSynonymsInHighlight + ) && + Objects.equals(this.minProximity, indexSettings.minProximity) && + Objects.equals(this.responseFields, indexSettings.responseFields) && + Objects.equals(this.maxFacetHits, indexSettings.maxFacetHits) && + Objects.equals( + this.attributeCriteriaComputedByMinProximity, + indexSettings.attributeCriteriaComputedByMinProximity + ) && + Objects.equals(this.renderingContent, indexSettings.renderingContent) + ); } @Override public int hashCode() { - return Objects.hash(replicas, paginationLimitedTo, disableTypoToleranceOnWords, attributesToTransliterate, camelCaseAttributes, decompoundedAttributes, indexLanguages, filterPromotes, disablePrefixOnAttributes, allowCompressionOfIntegerArray, numericAttributesForFiltering, userData, searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + return Objects.hash( + replicas, + paginationLimitedTo, + disableTypoToleranceOnWords, + attributesToTransliterate, + camelCaseAttributes, + decompoundedAttributes, + indexLanguages, + filterPromotes, + disablePrefixOnAttributes, + allowCompressionOfIntegerArray, + numericAttributesForFiltering, + userData, + searchableAttributes, + attributesForFaceting, + unretrievableAttributes, + attributesToRetrieve, + restrictSearchableAttributes, + ranking, + customRanking, + relevancyStrictness, + attributesToHighlight, + attributesToSnippet, + highlightPreTag, + highlightPostTag, + snippetEllipsisText, + restrictHighlightAndSnippetArrays, + hitsPerPage, + minWordSizefor1Typo, + minWordSizefor2Typos, + typoTolerance, + allowTyposOnNumericTokens, + disableTypoToleranceOnAttributes, + separatorsToIndex, + ignorePlurals, + removeStopWords, + keepDiacriticsOnCharacters, + queryLanguages, + decompoundQuery, + enableRules, + enablePersonalization, + queryType, + removeWordsIfNoResults, + advancedSyntax, + optionalWords, + disableExactOnAttributes, + exactOnSingleWordQuery, + alternativesAsExact, + advancedSyntaxFeatures, + distinct, + synonyms, + replaceSynonymsInHighlight, + minProximity, + responseFields, + maxFacetHits, + attributeCriteriaComputedByMinProximity, + renderingContent + ); } @Override @@ -2126,61 +2379,214 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IndexSettings {\n"); sb.append(" replicas: ").append(toIndentedString(replicas)).append("\n"); - sb.append(" paginationLimitedTo: ").append(toIndentedString(paginationLimitedTo)).append("\n"); - sb.append(" disableTypoToleranceOnWords: ").append(toIndentedString(disableTypoToleranceOnWords)).append("\n"); - sb.append(" attributesToTransliterate: ").append(toIndentedString(attributesToTransliterate)).append("\n"); - sb.append(" camelCaseAttributes: ").append(toIndentedString(camelCaseAttributes)).append("\n"); - sb.append(" decompoundedAttributes: ").append(toIndentedString(decompoundedAttributes)).append("\n"); - sb.append(" indexLanguages: ").append(toIndentedString(indexLanguages)).append("\n"); - sb.append(" filterPromotes: ").append(toIndentedString(filterPromotes)).append("\n"); - sb.append(" disablePrefixOnAttributes: ").append(toIndentedString(disablePrefixOnAttributes)).append("\n"); - sb.append(" allowCompressionOfIntegerArray: ").append(toIndentedString(allowCompressionOfIntegerArray)).append("\n"); - sb.append(" numericAttributesForFiltering: ").append(toIndentedString(numericAttributesForFiltering)).append("\n"); + sb + .append(" paginationLimitedTo: ") + .append(toIndentedString(paginationLimitedTo)) + .append("\n"); + sb + .append(" disableTypoToleranceOnWords: ") + .append(toIndentedString(disableTypoToleranceOnWords)) + .append("\n"); + sb + .append(" attributesToTransliterate: ") + .append(toIndentedString(attributesToTransliterate)) + .append("\n"); + sb + .append(" camelCaseAttributes: ") + .append(toIndentedString(camelCaseAttributes)) + .append("\n"); + sb + .append(" decompoundedAttributes: ") + .append(toIndentedString(decompoundedAttributes)) + .append("\n"); + sb + .append(" indexLanguages: ") + .append(toIndentedString(indexLanguages)) + .append("\n"); + sb + .append(" filterPromotes: ") + .append(toIndentedString(filterPromotes)) + .append("\n"); + sb + .append(" disablePrefixOnAttributes: ") + .append(toIndentedString(disablePrefixOnAttributes)) + .append("\n"); + sb + .append(" allowCompressionOfIntegerArray: ") + .append(toIndentedString(allowCompressionOfIntegerArray)) + .append("\n"); + sb + .append(" numericAttributesForFiltering: ") + .append(toIndentedString(numericAttributesForFiltering)) + .append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); - sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); - sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); - sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); - sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); - sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb + .append(" searchableAttributes: ") + .append(toIndentedString(searchableAttributes)) + .append("\n"); + sb + .append(" attributesForFaceting: ") + .append(toIndentedString(attributesForFaceting)) + .append("\n"); + sb + .append(" unretrievableAttributes: ") + .append(toIndentedString(unretrievableAttributes)) + .append("\n"); + sb + .append(" attributesToRetrieve: ") + .append(toIndentedString(attributesToRetrieve)) + .append("\n"); + sb + .append(" restrictSearchableAttributes: ") + .append(toIndentedString(restrictSearchableAttributes)) + .append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); - sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); - sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); - sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); - sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); - sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); - sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); - sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); - sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); - sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); - sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); - sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); - sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); - sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); - sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); - sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); - sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); - sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); - sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); - sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); - sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); - sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); - sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); - sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); - sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); - sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); - sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); - sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); - sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb + .append(" customRanking: ") + .append(toIndentedString(customRanking)) + .append("\n"); + sb + .append(" relevancyStrictness: ") + .append(toIndentedString(relevancyStrictness)) + .append("\n"); + sb + .append(" attributesToHighlight: ") + .append(toIndentedString(attributesToHighlight)) + .append("\n"); + sb + .append(" attributesToSnippet: ") + .append(toIndentedString(attributesToSnippet)) + .append("\n"); + sb + .append(" highlightPreTag: ") + .append(toIndentedString(highlightPreTag)) + .append("\n"); + sb + .append(" highlightPostTag: ") + .append(toIndentedString(highlightPostTag)) + .append("\n"); + sb + .append(" snippetEllipsisText: ") + .append(toIndentedString(snippetEllipsisText)) + .append("\n"); + sb + .append(" restrictHighlightAndSnippetArrays: ") + .append(toIndentedString(restrictHighlightAndSnippetArrays)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); + sb + .append(" minWordSizefor1Typo: ") + .append(toIndentedString(minWordSizefor1Typo)) + .append("\n"); + sb + .append(" minWordSizefor2Typos: ") + .append(toIndentedString(minWordSizefor2Typos)) + .append("\n"); + sb + .append(" typoTolerance: ") + .append(toIndentedString(typoTolerance)) + .append("\n"); + sb + .append(" allowTyposOnNumericTokens: ") + .append(toIndentedString(allowTyposOnNumericTokens)) + .append("\n"); + sb + .append(" disableTypoToleranceOnAttributes: ") + .append(toIndentedString(disableTypoToleranceOnAttributes)) + .append("\n"); + sb + .append(" separatorsToIndex: ") + .append(toIndentedString(separatorsToIndex)) + .append("\n"); + sb + .append(" ignorePlurals: ") + .append(toIndentedString(ignorePlurals)) + .append("\n"); + sb + .append(" removeStopWords: ") + .append(toIndentedString(removeStopWords)) + .append("\n"); + sb + .append(" keepDiacriticsOnCharacters: ") + .append(toIndentedString(keepDiacriticsOnCharacters)) + .append("\n"); + sb + .append(" queryLanguages: ") + .append(toIndentedString(queryLanguages)) + .append("\n"); + sb + .append(" decompoundQuery: ") + .append(toIndentedString(decompoundQuery)) + .append("\n"); + sb + .append(" enableRules: ") + .append(toIndentedString(enableRules)) + .append("\n"); + sb + .append(" enablePersonalization: ") + .append(toIndentedString(enablePersonalization)) + .append("\n"); + sb + .append(" queryType: ") + .append(toIndentedString(queryType)) + .append("\n"); + sb + .append(" removeWordsIfNoResults: ") + .append(toIndentedString(removeWordsIfNoResults)) + .append("\n"); + sb + .append(" advancedSyntax: ") + .append(toIndentedString(advancedSyntax)) + .append("\n"); + sb + .append(" optionalWords: ") + .append(toIndentedString(optionalWords)) + .append("\n"); + sb + .append(" disableExactOnAttributes: ") + .append(toIndentedString(disableExactOnAttributes)) + .append("\n"); + sb + .append(" exactOnSingleWordQuery: ") + .append(toIndentedString(exactOnSingleWordQuery)) + .append("\n"); + sb + .append(" alternativesAsExact: ") + .append(toIndentedString(alternativesAsExact)) + .append("\n"); + sb + .append(" advancedSyntaxFeatures: ") + .append(toIndentedString(advancedSyntaxFeatures)) + .append("\n"); sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); - sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); - sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); - sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb + .append(" replaceSynonymsInHighlight: ") + .append(toIndentedString(replaceSynonymsInHighlight)) + .append("\n"); + sb + .append(" minProximity: ") + .append(toIndentedString(minProximity)) + .append("\n"); + sb + .append(" responseFields: ") + .append(toIndentedString(responseFields)) + .append("\n"); + sb + .append(" maxFacetHits: ") + .append(toIndentedString(maxFacetHits)) + .append("\n"); + sb + .append(" attributeCriteriaComputedByMinProximity: ") + .append(toIndentedString(attributeCriteriaComputedByMinProximity)) + .append("\n"); + sb + .append(" renderingContent: ") + .append(toIndentedString(renderingContent)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -2195,6 +2601,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index f315c72f79..bb1c6a3d7b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,78 +21,112 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * IndexSettingsAsSearchParams */ public class IndexSettingsAsSearchParams { - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; @@ -105,11 +136,11 @@ public class IndexSettingsAsSearchParams { @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), - + FALSE("false"), - + MIN("min"), - + STRICT("strict"); private String value; @@ -137,60 +168,83 @@ public static TypoToleranceEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return TypoToleranceEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; @@ -200,9 +254,9 @@ public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), - + PREFIXALL("prefixAll"), - + PREFIXNONE("prefixNone"); private String value; @@ -230,20 +284,26 @@ public static QueryTypeEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return QueryTypeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; @@ -253,11 +313,11 @@ public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), - + LASTWORDS("lastWords"), - + FIRSTWORDS("firstWords"), - + ALLOPTIONAL("allOptional"); private String value; @@ -284,33 +344,46 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return RemoveWordsIfNoResultsEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = + RemoveWordsIfNoResultsEnum.NONE; public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; @@ -320,9 +393,9 @@ public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), - + NONE("none"), - + WORD("word"); private String value; @@ -349,23 +422,32 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return ExactOnSingleWordQueryEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = + ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact @@ -373,9 +455,9 @@ public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), - + SINGLEWORDSYNONYM("singleWordSynonym"), - + MULTIWORDSSYNONYM("multiWordsSynonym"); private String value; @@ -403,20 +485,27 @@ public static AlternativesAsExactEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AlternativesAsExactEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; @@ -426,7 +515,7 @@ public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOExcept @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), - + EXCLUDEWORDS("excludeWords"); private String value; @@ -453,64 +542,85 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AdvancedSyntaxFeaturesEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + public static final String SERIALIZED_NAME_RENDERING_CONTENT = + "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); - - public IndexSettingsAsSearchParams searchableAttributes(List searchableAttributes) { - + public IndexSettingsAsSearchParams searchableAttributes( + List searchableAttributes + ) { this.searchableAttributes = searchableAttributes; return this; } - public IndexSettingsAsSearchParams addSearchableAttributesItem(String searchableAttributesItem) { + public IndexSettingsAsSearchParams addSearchableAttributesItem( + String searchableAttributesItem + ) { if (this.searchableAttributes == null) { this.searchableAttributes = new ArrayList<>(); } @@ -518,30 +628,32 @@ public IndexSettingsAsSearchParams addSearchableAttributesItem(String searchable return this; } - /** + /** * The complete list of attributes used for searching. * @return searchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes used for searching.") - + @ApiModelProperty( + value = "The complete list of attributes used for searching." + ) public List getSearchableAttributes() { return searchableAttributes; } - public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } - - public IndexSettingsAsSearchParams attributesForFaceting(List attributesForFaceting) { - + public IndexSettingsAsSearchParams attributesForFaceting( + List attributesForFaceting + ) { this.attributesForFaceting = attributesForFaceting; return this; } - public IndexSettingsAsSearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { + public IndexSettingsAsSearchParams addAttributesForFacetingItem( + String attributesForFacetingItem + ) { if (this.attributesForFaceting == null) { this.attributesForFaceting = new ArrayList<>(); } @@ -549,30 +661,32 @@ public IndexSettingsAsSearchParams addAttributesForFacetingItem(String attribute return this; } - /** + /** * The complete list of attributes that will be used for faceting. * @return attributesForFaceting - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") - + @ApiModelProperty( + value = "The complete list of attributes that will be used for faceting." + ) public List getAttributesForFaceting() { return attributesForFaceting; } - public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } - - public IndexSettingsAsSearchParams unretrievableAttributes(List unretrievableAttributes) { - + public IndexSettingsAsSearchParams unretrievableAttributes( + List unretrievableAttributes + ) { this.unretrievableAttributes = unretrievableAttributes; return this; } - public IndexSettingsAsSearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { + public IndexSettingsAsSearchParams addUnretrievableAttributesItem( + String unretrievableAttributesItem + ) { if (this.unretrievableAttributes == null) { this.unretrievableAttributes = new ArrayList<>(); } @@ -580,30 +694,32 @@ public IndexSettingsAsSearchParams addUnretrievableAttributesItem(String unretri return this; } - /** + /** * List of attributes that can’t be retrieved at query time. * @return unretrievableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") - + @ApiModelProperty( + value = "List of attributes that can’t be retrieved at query time." + ) public List getUnretrievableAttributes() { return unretrievableAttributes; } - public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } - - public IndexSettingsAsSearchParams attributesToRetrieve(List attributesToRetrieve) { - + public IndexSettingsAsSearchParams attributesToRetrieve( + List attributesToRetrieve + ) { this.attributesToRetrieve = attributesToRetrieve; return this; } - public IndexSettingsAsSearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { + public IndexSettingsAsSearchParams addAttributesToRetrieveItem( + String attributesToRetrieveItem + ) { if (this.attributesToRetrieve == null) { this.attributesToRetrieve = new ArrayList<>(); } @@ -611,30 +727,32 @@ public IndexSettingsAsSearchParams addAttributesToRetrieveItem(String attributes return this; } - /** + /** * This parameter controls which attributes to retrieve and which not to retrieve. * @return attributesToRetrieve - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") - + @ApiModelProperty( + value = "This parameter controls which attributes to retrieve and which not to retrieve." + ) public List getAttributesToRetrieve() { return attributesToRetrieve; } - public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } - - public IndexSettingsAsSearchParams restrictSearchableAttributes(List restrictSearchableAttributes) { - + public IndexSettingsAsSearchParams restrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; return this; } - public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem( + String restrictSearchableAttributesItem + ) { if (this.restrictSearchableAttributes == null) { this.restrictSearchableAttributes = new ArrayList<>(); } @@ -642,25 +760,25 @@ public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem(String re return this; } - /** + /** * Restricts a given query to look in only a subset of your searchable attributes. * @return restrictSearchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") - + @ApiModelProperty( + value = "Restricts a given query to look in only a subset of your searchable attributes." + ) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - - public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + public void setRestrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; } - public IndexSettingsAsSearchParams ranking(List ranking) { - this.ranking = ranking; return this; } @@ -673,30 +791,28 @@ public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { return this; } - /** + /** * Controls how Algolia should sort your results. * @return ranking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - public List getRanking() { return ranking; } - public void setRanking(List ranking) { this.ranking = ranking; } - public IndexSettingsAsSearchParams customRanking(List customRanking) { - this.customRanking = customRanking; return this; } - public IndexSettingsAsSearchParams addCustomRankingItem(String customRankingItem) { + public IndexSettingsAsSearchParams addCustomRankingItem( + String customRankingItem + ) { if (this.customRanking == null) { this.customRanking = new ArrayList<>(); } @@ -704,53 +820,53 @@ public IndexSettingsAsSearchParams addCustomRankingItem(String customRankingItem return this; } - /** + /** * Specifies the custom ranking criterion. * @return customRanking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - public List getCustomRanking() { return customRanking; } - public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } - - public IndexSettingsAsSearchParams relevancyStrictness(Integer relevancyStrictness) { - + public IndexSettingsAsSearchParams relevancyStrictness( + Integer relevancyStrictness + ) { this.relevancyStrictness = relevancyStrictness; return this; } - /** + /** * Controls the relevancy threshold below which less relevant results aren’t included in the results. * @return relevancyStrictness - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") - + @ApiModelProperty( + value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + ) public Integer getRelevancyStrictness() { return relevancyStrictness; } - public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } - - public IndexSettingsAsSearchParams attributesToHighlight(List attributesToHighlight) { - + public IndexSettingsAsSearchParams attributesToHighlight( + List attributesToHighlight + ) { this.attributesToHighlight = attributesToHighlight; return this; } - public IndexSettingsAsSearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { + public IndexSettingsAsSearchParams addAttributesToHighlightItem( + String attributesToHighlightItem + ) { if (this.attributesToHighlight == null) { this.attributesToHighlight = new ArrayList<>(); } @@ -758,30 +874,30 @@ public IndexSettingsAsSearchParams addAttributesToHighlightItem(String attribute return this; } - /** + /** * List of attributes to highlight. * @return attributesToHighlight - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - public List getAttributesToHighlight() { return attributesToHighlight; } - public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } - - public IndexSettingsAsSearchParams attributesToSnippet(List attributesToSnippet) { - + public IndexSettingsAsSearchParams attributesToSnippet( + List attributesToSnippet + ) { this.attributesToSnippet = attributesToSnippet; return this; } - public IndexSettingsAsSearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { + public IndexSettingsAsSearchParams addAttributesToSnippetItem( + String attributesToSnippetItem + ) { if (this.attributesToSnippet == null) { this.attributesToSnippet = new ArrayList<>(); } @@ -789,360 +905,356 @@ public IndexSettingsAsSearchParams addAttributesToSnippetItem(String attributesT return this; } - /** + /** * List of attributes to snippet, with an optional maximum number of words to snippet. * @return attributesToSnippet - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") - + @ApiModelProperty( + value = "List of attributes to snippet, with an optional maximum number of words to snippet." + ) public List getAttributesToSnippet() { return attributesToSnippet; } - public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } - public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; return this; } - /** + /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. * @return highlightPreTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + ) public String getHighlightPreTag() { return highlightPreTag; } - public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } - public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; return this; } - /** + /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. * @return highlightPostTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + ) public String getHighlightPostTag() { return highlightPostTag; } - public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } - - public IndexSettingsAsSearchParams snippetEllipsisText(String snippetEllipsisText) { - + public IndexSettingsAsSearchParams snippetEllipsisText( + String snippetEllipsisText + ) { this.snippetEllipsisText = snippetEllipsisText; return this; } - /** + /** * String used as an ellipsis indicator when a snippet is truncated. * @return snippetEllipsisText - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") - + @ApiModelProperty( + value = "String used as an ellipsis indicator when a snippet is truncated." + ) public String getSnippetEllipsisText() { return snippetEllipsisText; } - public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } - - public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { - + public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; return this; } - /** + /** * Restrict highlighting and snippeting to items that matched the query. * @return restrictHighlightAndSnippetArrays - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") - + @ApiModelProperty( + value = "Restrict highlighting and snippeting to items that matched the query." + ) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - - public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + public void setRestrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; } - public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; return this; } - /** + /** * Set the number of hits per page. * @return hitsPerPage - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - public Integer getHitsPerPage() { return hitsPerPage; } - public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } - - public IndexSettingsAsSearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { - + public IndexSettingsAsSearchParams minWordSizefor1Typo( + Integer minWordSizefor1Typo + ) { this.minWordSizefor1Typo = minWordSizefor1Typo; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. * @return minWordSizefor1Typo - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + ) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } - - public IndexSettingsAsSearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { - + public IndexSettingsAsSearchParams minWordSizefor2Typos( + Integer minWordSizefor2Typos + ) { this.minWordSizefor2Typos = minWordSizefor2Typos; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. * @return minWordSizefor2Typos - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + ) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } - - public IndexSettingsAsSearchParams typoTolerance(TypoToleranceEnum typoTolerance) { - + public IndexSettingsAsSearchParams typoTolerance( + TypoToleranceEnum typoTolerance + ) { this.typoTolerance = typoTolerance; return this; } - /** + /** * Controls whether typo tolerance is enabled and how it is applied. * @return typoTolerance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") - + @ApiModelProperty( + value = "Controls whether typo tolerance is enabled and how it is applied." + ) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } - - public IndexSettingsAsSearchParams allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - + public IndexSettingsAsSearchParams allowTyposOnNumericTokens( + Boolean allowTyposOnNumericTokens + ) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; return this; } - /** + /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. * @return allowTyposOnNumericTokens - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") - + @ApiModelProperty( + value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." + ) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } - - public IndexSettingsAsSearchParams disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { - + public IndexSettingsAsSearchParams disableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; return this; } - public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem( + String disableTypoToleranceOnAttributesItem + ) { if (this.disableTypoToleranceOnAttributes == null) { this.disableTypoToleranceOnAttributes = new ArrayList<>(); } - this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + this.disableTypoToleranceOnAttributes.add( + disableTypoToleranceOnAttributesItem + ); return this; } - /** + /** * List of attributes on which you want to disable typo tolerance. * @return disableTypoToleranceOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable typo tolerance." + ) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - - public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + public void setDisableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; } - - public IndexSettingsAsSearchParams separatorsToIndex(String separatorsToIndex) { - + public IndexSettingsAsSearchParams separatorsToIndex( + String separatorsToIndex + ) { this.separatorsToIndex = separatorsToIndex; return this; } - /** + /** * Control which separators are indexed. * @return separatorsToIndex - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - public String getSeparatorsToIndex() { return separatorsToIndex; } - public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } - public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; return this; } - /** + /** * Treats singular, plurals, and other forms of declensions as matching terms. * @return ignorePlurals - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") - + @ApiModelProperty( + value = "Treats singular, plurals, and other forms of declensions as matching terms." + ) public String getIgnorePlurals() { return ignorePlurals; } - public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } - public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; return this; } - /** + /** * Removes stop (common) words from the query before executing it. * @return removeStopWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") - + @ApiModelProperty( + value = "Removes stop (common) words from the query before executing it." + ) public String getRemoveStopWords() { return removeStopWords; } - public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } - - public IndexSettingsAsSearchParams keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - + public IndexSettingsAsSearchParams keepDiacriticsOnCharacters( + String keepDiacriticsOnCharacters + ) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; return this; } - /** + /** * List of characters that the engine shouldn’t automatically normalize. * @return keepDiacriticsOnCharacters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") - + @ApiModelProperty( + value = "List of characters that the engine shouldn’t automatically normalize." + ) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } - - public IndexSettingsAsSearchParams queryLanguages(List queryLanguages) { - + public IndexSettingsAsSearchParams queryLanguages( + List queryLanguages + ) { this.queryLanguages = queryLanguages; return this; } - public IndexSettingsAsSearchParams addQueryLanguagesItem(String queryLanguagesItem) { + public IndexSettingsAsSearchParams addQueryLanguagesItem( + String queryLanguagesItem + ) { if (this.queryLanguages == null) { this.queryLanguages = new ArrayList<>(); } @@ -1150,168 +1262,156 @@ public IndexSettingsAsSearchParams addQueryLanguagesItem(String queryLanguagesIt return this; } - /** + /** * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. * @return queryLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") - + @ApiModelProperty( + value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + ) public List getQueryLanguages() { return queryLanguages; } - public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } - public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; return this; } - /** + /** * Splits compound words into their composing atoms in the query. * @return decompoundQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") - + @ApiModelProperty( + value = "Splits compound words into their composing atoms in the query." + ) public Boolean getDecompoundQuery() { return decompoundQuery; } - public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } - public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { - this.enableRules = enableRules; return this; } - /** + /** * Whether Rules should be globally enabled. * @return enableRules - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - public Boolean getEnableRules() { return enableRules; } - public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } - - public IndexSettingsAsSearchParams enablePersonalization(Boolean enablePersonalization) { - + public IndexSettingsAsSearchParams enablePersonalization( + Boolean enablePersonalization + ) { this.enablePersonalization = enablePersonalization; return this; } - /** + /** * Enable the Personalization feature. * @return enablePersonalization - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - public Boolean getEnablePersonalization() { return enablePersonalization; } - public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } - public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { - this.queryType = queryType; return this; } - /** + /** * Controls if and how query words are interpreted as prefixes. * @return queryType - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") - + @ApiModelProperty( + value = "Controls if and how query words are interpreted as prefixes." + ) public QueryTypeEnum getQueryType() { return queryType; } - public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } - - public IndexSettingsAsSearchParams removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { - + public IndexSettingsAsSearchParams removeWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; return this; } - /** + /** * Selects a strategy to remove words from the query when it doesn’t match any hits. * @return removeWordsIfNoResults - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") - + @ApiModelProperty( + value = "Selects a strategy to remove words from the query when it doesn’t match any hits." + ) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - - public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + public void setRemoveWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; } - public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; return this; } - /** + /** * Enables the advanced query syntax. * @return advancedSyntax - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - public Boolean getAdvancedSyntax() { return advancedSyntax; } - public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } - public IndexSettingsAsSearchParams optionalWords(List optionalWords) { - this.optionalWords = optionalWords; return this; } - public IndexSettingsAsSearchParams addOptionalWordsItem(String optionalWordsItem) { + public IndexSettingsAsSearchParams addOptionalWordsItem( + String optionalWordsItem + ) { if (this.optionalWords == null) { this.optionalWords = new ArrayList<>(); } @@ -1319,30 +1419,32 @@ public IndexSettingsAsSearchParams addOptionalWordsItem(String optionalWordsItem return this; } - /** + /** * A list of words that should be considered as optional when found in the query. * @return optionalWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") - + @ApiModelProperty( + value = "A list of words that should be considered as optional when found in the query." + ) public List getOptionalWords() { return optionalWords; } - public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } - - public IndexSettingsAsSearchParams disableExactOnAttributes(List disableExactOnAttributes) { - + public IndexSettingsAsSearchParams disableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; return this; } - public IndexSettingsAsSearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + public IndexSettingsAsSearchParams addDisableExactOnAttributesItem( + String disableExactOnAttributesItem + ) { if (this.disableExactOnAttributes == null) { this.disableExactOnAttributes = new ArrayList<>(); } @@ -1350,53 +1452,59 @@ public IndexSettingsAsSearchParams addDisableExactOnAttributesItem(String disabl return this; } - /** + /** * List of attributes on which you want to disable the exact ranking criterion. * @return disableExactOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable the exact ranking criterion." + ) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - - public void setDisableExactOnAttributes(List disableExactOnAttributes) { + public void setDisableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; } - - public IndexSettingsAsSearchParams exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { - + public IndexSettingsAsSearchParams exactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; return this; } - /** + /** * Controls how the exact ranking criterion is computed when the query contains only one word. * @return exactOnSingleWordQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") - + @ApiModelProperty( + value = "Controls how the exact ranking criterion is computed when the query contains only one word." + ) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - - public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + public void setExactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; } - - public IndexSettingsAsSearchParams alternativesAsExact(List alternativesAsExact) { - + public IndexSettingsAsSearchParams alternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; return this; } - public IndexSettingsAsSearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + public IndexSettingsAsSearchParams addAlternativesAsExactItem( + AlternativesAsExactEnum alternativesAsExactItem + ) { if (this.alternativesAsExact == null) { this.alternativesAsExact = new ArrayList<>(); } @@ -1404,30 +1512,34 @@ public IndexSettingsAsSearchParams addAlternativesAsExactItem(AlternativesAsExac return this; } - /** + /** * List of alternatives that should be considered an exact match by the exact ranking criterion. * @return alternativesAsExact - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") - + @ApiModelProperty( + value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + ) public List getAlternativesAsExact() { return alternativesAsExact; } - - public void setAlternativesAsExact(List alternativesAsExact) { + public void setAlternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; } - - public IndexSettingsAsSearchParams advancedSyntaxFeatures(List advancedSyntaxFeatures) { - + public IndexSettingsAsSearchParams advancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; return this; } - public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem( + AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem + ) { if (this.advancedSyntaxFeatures == null) { this.advancedSyntaxFeatures = new ArrayList<>(); } @@ -1435,126 +1547,122 @@ public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxF return this; } - /** + /** * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. * @return advancedSyntaxFeatures - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") - + @ApiModelProperty( + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + ) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - - public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + public void setAdvancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; } - public IndexSettingsAsSearchParams distinct(Integer distinct) { - this.distinct = distinct; return this; } - /** + /** * Enables de-duplication or grouping of results. * minimum: 0 * maximum: 4 * @return distinct - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - public Integer getDistinct() { return distinct; } - public void setDistinct(Integer distinct) { this.distinct = distinct; } - public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { - this.synonyms = synonyms; return this; } - /** + /** * Whether to take into account an index’s synonyms for a particular search. * @return synonyms - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") - + @ApiModelProperty( + value = "Whether to take into account an index’s synonyms for a particular search." + ) public Boolean getSynonyms() { return synonyms; } - public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } - - public IndexSettingsAsSearchParams replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { - + public IndexSettingsAsSearchParams replaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; return this; } - /** + /** * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. * @return replaceSynonymsInHighlight - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") - + @ApiModelProperty( + value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + ) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - - public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + public void setReplaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; } - public IndexSettingsAsSearchParams minProximity(Integer minProximity) { - this.minProximity = minProximity; return this; } - /** + /** * Precision of the proximity ranking criterion. * minimum: 1 * maximum: 7 * @return minProximity - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - public Integer getMinProximity() { return minProximity; } - public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } - - public IndexSettingsAsSearchParams responseFields(List responseFields) { - + public IndexSettingsAsSearchParams responseFields( + List responseFields + ) { this.responseFields = responseFields; return this; } - public IndexSettingsAsSearchParams addResponseFieldsItem(String responseFieldsItem) { + public IndexSettingsAsSearchParams addResponseFieldsItem( + String responseFieldsItem + ) { if (this.responseFields == null) { this.responseFields = new ArrayList<>(); } @@ -1562,92 +1670,91 @@ public IndexSettingsAsSearchParams addResponseFieldsItem(String responseFieldsIt return this; } - /** + /** * Choose which fields to return in the API response. This parameters applies to search and browse queries. * @return responseFields - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") - + @ApiModelProperty( + value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + ) public List getResponseFields() { return responseFields; } - public void setResponseFields(List responseFields) { this.responseFields = responseFields; } - public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; return this; } - /** + /** * Maximum number of facet hits to return during a search for facet values. * @return maxFacetHits - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") - + @ApiModelProperty( + value = "Maximum number of facet hits to return during a search for facet values." + ) public Integer getMaxFacetHits() { return maxFacetHits; } - public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } - - public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; return this; } - /** + /** * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. * @return attributeCriteriaComputedByMinProximity - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") - + @ApiModelProperty( + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + ) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - - public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public void setAttributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; } - public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; return this; } - /** + /** * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. * @return renderingContent - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") - + @ApiModelProperty( + value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + ) public Object getRenderingContent() { return renderingContent; } - public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } - @Override public boolean equals(Object o) { if (this == o) { @@ -1657,105 +1764,395 @@ public boolean equals(Object o) { return false; } IndexSettingsAsSearchParams indexSettingsAsSearchParams = (IndexSettingsAsSearchParams) o; - return Objects.equals(this.searchableAttributes, indexSettingsAsSearchParams.searchableAttributes) && - Objects.equals(this.attributesForFaceting, indexSettingsAsSearchParams.attributesForFaceting) && - Objects.equals(this.unretrievableAttributes, indexSettingsAsSearchParams.unretrievableAttributes) && - Objects.equals(this.attributesToRetrieve, indexSettingsAsSearchParams.attributesToRetrieve) && - Objects.equals(this.restrictSearchableAttributes, indexSettingsAsSearchParams.restrictSearchableAttributes) && - Objects.equals(this.ranking, indexSettingsAsSearchParams.ranking) && - Objects.equals(this.customRanking, indexSettingsAsSearchParams.customRanking) && - Objects.equals(this.relevancyStrictness, indexSettingsAsSearchParams.relevancyStrictness) && - Objects.equals(this.attributesToHighlight, indexSettingsAsSearchParams.attributesToHighlight) && - Objects.equals(this.attributesToSnippet, indexSettingsAsSearchParams.attributesToSnippet) && - Objects.equals(this.highlightPreTag, indexSettingsAsSearchParams.highlightPreTag) && - Objects.equals(this.highlightPostTag, indexSettingsAsSearchParams.highlightPostTag) && - Objects.equals(this.snippetEllipsisText, indexSettingsAsSearchParams.snippetEllipsisText) && - Objects.equals(this.restrictHighlightAndSnippetArrays, indexSettingsAsSearchParams.restrictHighlightAndSnippetArrays) && - Objects.equals(this.hitsPerPage, indexSettingsAsSearchParams.hitsPerPage) && - Objects.equals(this.minWordSizefor1Typo, indexSettingsAsSearchParams.minWordSizefor1Typo) && - Objects.equals(this.minWordSizefor2Typos, indexSettingsAsSearchParams.minWordSizefor2Typos) && - Objects.equals(this.typoTolerance, indexSettingsAsSearchParams.typoTolerance) && - Objects.equals(this.allowTyposOnNumericTokens, indexSettingsAsSearchParams.allowTyposOnNumericTokens) && - Objects.equals(this.disableTypoToleranceOnAttributes, indexSettingsAsSearchParams.disableTypoToleranceOnAttributes) && - Objects.equals(this.separatorsToIndex, indexSettingsAsSearchParams.separatorsToIndex) && - Objects.equals(this.ignorePlurals, indexSettingsAsSearchParams.ignorePlurals) && - Objects.equals(this.removeStopWords, indexSettingsAsSearchParams.removeStopWords) && - Objects.equals(this.keepDiacriticsOnCharacters, indexSettingsAsSearchParams.keepDiacriticsOnCharacters) && - Objects.equals(this.queryLanguages, indexSettingsAsSearchParams.queryLanguages) && - Objects.equals(this.decompoundQuery, indexSettingsAsSearchParams.decompoundQuery) && - Objects.equals(this.enableRules, indexSettingsAsSearchParams.enableRules) && - Objects.equals(this.enablePersonalization, indexSettingsAsSearchParams.enablePersonalization) && - Objects.equals(this.queryType, indexSettingsAsSearchParams.queryType) && - Objects.equals(this.removeWordsIfNoResults, indexSettingsAsSearchParams.removeWordsIfNoResults) && - Objects.equals(this.advancedSyntax, indexSettingsAsSearchParams.advancedSyntax) && - Objects.equals(this.optionalWords, indexSettingsAsSearchParams.optionalWords) && - Objects.equals(this.disableExactOnAttributes, indexSettingsAsSearchParams.disableExactOnAttributes) && - Objects.equals(this.exactOnSingleWordQuery, indexSettingsAsSearchParams.exactOnSingleWordQuery) && - Objects.equals(this.alternativesAsExact, indexSettingsAsSearchParams.alternativesAsExact) && - Objects.equals(this.advancedSyntaxFeatures, indexSettingsAsSearchParams.advancedSyntaxFeatures) && - Objects.equals(this.distinct, indexSettingsAsSearchParams.distinct) && - Objects.equals(this.synonyms, indexSettingsAsSearchParams.synonyms) && - Objects.equals(this.replaceSynonymsInHighlight, indexSettingsAsSearchParams.replaceSynonymsInHighlight) && - Objects.equals(this.minProximity, indexSettingsAsSearchParams.minProximity) && - Objects.equals(this.responseFields, indexSettingsAsSearchParams.responseFields) && - Objects.equals(this.maxFacetHits, indexSettingsAsSearchParams.maxFacetHits) && - Objects.equals(this.attributeCriteriaComputedByMinProximity, indexSettingsAsSearchParams.attributeCriteriaComputedByMinProximity) && - Objects.equals(this.renderingContent, indexSettingsAsSearchParams.renderingContent); + return ( + Objects.equals( + this.searchableAttributes, + indexSettingsAsSearchParams.searchableAttributes + ) && + Objects.equals( + this.attributesForFaceting, + indexSettingsAsSearchParams.attributesForFaceting + ) && + Objects.equals( + this.unretrievableAttributes, + indexSettingsAsSearchParams.unretrievableAttributes + ) && + Objects.equals( + this.attributesToRetrieve, + indexSettingsAsSearchParams.attributesToRetrieve + ) && + Objects.equals( + this.restrictSearchableAttributes, + indexSettingsAsSearchParams.restrictSearchableAttributes + ) && + Objects.equals(this.ranking, indexSettingsAsSearchParams.ranking) && + Objects.equals( + this.customRanking, + indexSettingsAsSearchParams.customRanking + ) && + Objects.equals( + this.relevancyStrictness, + indexSettingsAsSearchParams.relevancyStrictness + ) && + Objects.equals( + this.attributesToHighlight, + indexSettingsAsSearchParams.attributesToHighlight + ) && + Objects.equals( + this.attributesToSnippet, + indexSettingsAsSearchParams.attributesToSnippet + ) && + Objects.equals( + this.highlightPreTag, + indexSettingsAsSearchParams.highlightPreTag + ) && + Objects.equals( + this.highlightPostTag, + indexSettingsAsSearchParams.highlightPostTag + ) && + Objects.equals( + this.snippetEllipsisText, + indexSettingsAsSearchParams.snippetEllipsisText + ) && + Objects.equals( + this.restrictHighlightAndSnippetArrays, + indexSettingsAsSearchParams.restrictHighlightAndSnippetArrays + ) && + Objects.equals( + this.hitsPerPage, + indexSettingsAsSearchParams.hitsPerPage + ) && + Objects.equals( + this.minWordSizefor1Typo, + indexSettingsAsSearchParams.minWordSizefor1Typo + ) && + Objects.equals( + this.minWordSizefor2Typos, + indexSettingsAsSearchParams.minWordSizefor2Typos + ) && + Objects.equals( + this.typoTolerance, + indexSettingsAsSearchParams.typoTolerance + ) && + Objects.equals( + this.allowTyposOnNumericTokens, + indexSettingsAsSearchParams.allowTyposOnNumericTokens + ) && + Objects.equals( + this.disableTypoToleranceOnAttributes, + indexSettingsAsSearchParams.disableTypoToleranceOnAttributes + ) && + Objects.equals( + this.separatorsToIndex, + indexSettingsAsSearchParams.separatorsToIndex + ) && + Objects.equals( + this.ignorePlurals, + indexSettingsAsSearchParams.ignorePlurals + ) && + Objects.equals( + this.removeStopWords, + indexSettingsAsSearchParams.removeStopWords + ) && + Objects.equals( + this.keepDiacriticsOnCharacters, + indexSettingsAsSearchParams.keepDiacriticsOnCharacters + ) && + Objects.equals( + this.queryLanguages, + indexSettingsAsSearchParams.queryLanguages + ) && + Objects.equals( + this.decompoundQuery, + indexSettingsAsSearchParams.decompoundQuery + ) && + Objects.equals( + this.enableRules, + indexSettingsAsSearchParams.enableRules + ) && + Objects.equals( + this.enablePersonalization, + indexSettingsAsSearchParams.enablePersonalization + ) && + Objects.equals(this.queryType, indexSettingsAsSearchParams.queryType) && + Objects.equals( + this.removeWordsIfNoResults, + indexSettingsAsSearchParams.removeWordsIfNoResults + ) && + Objects.equals( + this.advancedSyntax, + indexSettingsAsSearchParams.advancedSyntax + ) && + Objects.equals( + this.optionalWords, + indexSettingsAsSearchParams.optionalWords + ) && + Objects.equals( + this.disableExactOnAttributes, + indexSettingsAsSearchParams.disableExactOnAttributes + ) && + Objects.equals( + this.exactOnSingleWordQuery, + indexSettingsAsSearchParams.exactOnSingleWordQuery + ) && + Objects.equals( + this.alternativesAsExact, + indexSettingsAsSearchParams.alternativesAsExact + ) && + Objects.equals( + this.advancedSyntaxFeatures, + indexSettingsAsSearchParams.advancedSyntaxFeatures + ) && + Objects.equals(this.distinct, indexSettingsAsSearchParams.distinct) && + Objects.equals(this.synonyms, indexSettingsAsSearchParams.synonyms) && + Objects.equals( + this.replaceSynonymsInHighlight, + indexSettingsAsSearchParams.replaceSynonymsInHighlight + ) && + Objects.equals( + this.minProximity, + indexSettingsAsSearchParams.minProximity + ) && + Objects.equals( + this.responseFields, + indexSettingsAsSearchParams.responseFields + ) && + Objects.equals( + this.maxFacetHits, + indexSettingsAsSearchParams.maxFacetHits + ) && + Objects.equals( + this.attributeCriteriaComputedByMinProximity, + indexSettingsAsSearchParams.attributeCriteriaComputedByMinProximity + ) && + Objects.equals( + this.renderingContent, + indexSettingsAsSearchParams.renderingContent + ) + ); } @Override public int hashCode() { - return Objects.hash(searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + return Objects.hash( + searchableAttributes, + attributesForFaceting, + unretrievableAttributes, + attributesToRetrieve, + restrictSearchableAttributes, + ranking, + customRanking, + relevancyStrictness, + attributesToHighlight, + attributesToSnippet, + highlightPreTag, + highlightPostTag, + snippetEllipsisText, + restrictHighlightAndSnippetArrays, + hitsPerPage, + minWordSizefor1Typo, + minWordSizefor2Typos, + typoTolerance, + allowTyposOnNumericTokens, + disableTypoToleranceOnAttributes, + separatorsToIndex, + ignorePlurals, + removeStopWords, + keepDiacriticsOnCharacters, + queryLanguages, + decompoundQuery, + enableRules, + enablePersonalization, + queryType, + removeWordsIfNoResults, + advancedSyntax, + optionalWords, + disableExactOnAttributes, + exactOnSingleWordQuery, + alternativesAsExact, + advancedSyntaxFeatures, + distinct, + synonyms, + replaceSynonymsInHighlight, + minProximity, + responseFields, + maxFacetHits, + attributeCriteriaComputedByMinProximity, + renderingContent + ); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IndexSettingsAsSearchParams {\n"); - sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); - sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); - sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); - sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); - sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb + .append(" searchableAttributes: ") + .append(toIndentedString(searchableAttributes)) + .append("\n"); + sb + .append(" attributesForFaceting: ") + .append(toIndentedString(attributesForFaceting)) + .append("\n"); + sb + .append(" unretrievableAttributes: ") + .append(toIndentedString(unretrievableAttributes)) + .append("\n"); + sb + .append(" attributesToRetrieve: ") + .append(toIndentedString(attributesToRetrieve)) + .append("\n"); + sb + .append(" restrictSearchableAttributes: ") + .append(toIndentedString(restrictSearchableAttributes)) + .append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); - sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); - sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); - sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); - sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); - sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); - sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); - sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); - sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); - sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); - sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); - sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); - sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); - sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); - sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); - sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); - sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); - sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); - sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); - sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); - sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); - sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); - sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); - sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); - sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); - sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); - sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); - sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); - sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb + .append(" customRanking: ") + .append(toIndentedString(customRanking)) + .append("\n"); + sb + .append(" relevancyStrictness: ") + .append(toIndentedString(relevancyStrictness)) + .append("\n"); + sb + .append(" attributesToHighlight: ") + .append(toIndentedString(attributesToHighlight)) + .append("\n"); + sb + .append(" attributesToSnippet: ") + .append(toIndentedString(attributesToSnippet)) + .append("\n"); + sb + .append(" highlightPreTag: ") + .append(toIndentedString(highlightPreTag)) + .append("\n"); + sb + .append(" highlightPostTag: ") + .append(toIndentedString(highlightPostTag)) + .append("\n"); + sb + .append(" snippetEllipsisText: ") + .append(toIndentedString(snippetEllipsisText)) + .append("\n"); + sb + .append(" restrictHighlightAndSnippetArrays: ") + .append(toIndentedString(restrictHighlightAndSnippetArrays)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); + sb + .append(" minWordSizefor1Typo: ") + .append(toIndentedString(minWordSizefor1Typo)) + .append("\n"); + sb + .append(" minWordSizefor2Typos: ") + .append(toIndentedString(minWordSizefor2Typos)) + .append("\n"); + sb + .append(" typoTolerance: ") + .append(toIndentedString(typoTolerance)) + .append("\n"); + sb + .append(" allowTyposOnNumericTokens: ") + .append(toIndentedString(allowTyposOnNumericTokens)) + .append("\n"); + sb + .append(" disableTypoToleranceOnAttributes: ") + .append(toIndentedString(disableTypoToleranceOnAttributes)) + .append("\n"); + sb + .append(" separatorsToIndex: ") + .append(toIndentedString(separatorsToIndex)) + .append("\n"); + sb + .append(" ignorePlurals: ") + .append(toIndentedString(ignorePlurals)) + .append("\n"); + sb + .append(" removeStopWords: ") + .append(toIndentedString(removeStopWords)) + .append("\n"); + sb + .append(" keepDiacriticsOnCharacters: ") + .append(toIndentedString(keepDiacriticsOnCharacters)) + .append("\n"); + sb + .append(" queryLanguages: ") + .append(toIndentedString(queryLanguages)) + .append("\n"); + sb + .append(" decompoundQuery: ") + .append(toIndentedString(decompoundQuery)) + .append("\n"); + sb + .append(" enableRules: ") + .append(toIndentedString(enableRules)) + .append("\n"); + sb + .append(" enablePersonalization: ") + .append(toIndentedString(enablePersonalization)) + .append("\n"); + sb + .append(" queryType: ") + .append(toIndentedString(queryType)) + .append("\n"); + sb + .append(" removeWordsIfNoResults: ") + .append(toIndentedString(removeWordsIfNoResults)) + .append("\n"); + sb + .append(" advancedSyntax: ") + .append(toIndentedString(advancedSyntax)) + .append("\n"); + sb + .append(" optionalWords: ") + .append(toIndentedString(optionalWords)) + .append("\n"); + sb + .append(" disableExactOnAttributes: ") + .append(toIndentedString(disableExactOnAttributes)) + .append("\n"); + sb + .append(" exactOnSingleWordQuery: ") + .append(toIndentedString(exactOnSingleWordQuery)) + .append("\n"); + sb + .append(" alternativesAsExact: ") + .append(toIndentedString(alternativesAsExact)) + .append("\n"); + sb + .append(" advancedSyntaxFeatures: ") + .append(toIndentedString(advancedSyntaxFeatures)) + .append("\n"); sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); - sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); - sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); - sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb + .append(" replaceSynonymsInHighlight: ") + .append(toIndentedString(replaceSynonymsInHighlight)) + .append("\n"); + sb + .append(" minProximity: ") + .append(toIndentedString(minProximity)) + .append("\n"); + sb + .append(" responseFields: ") + .append(toIndentedString(responseFields)) + .append("\n"); + sb + .append(" maxFacetHits: ") + .append(toIndentedString(maxFacetHits)) + .append("\n"); + sb + .append(" attributeCriteriaComputedByMinProximity: ") + .append(toIndentedString(attributeCriteriaComputedByMinProximity)) + .append("\n"); + sb + .append(" renderingContent: ") + .append(toIndentedString(renderingContent)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -1770,6 +2167,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index 5b0ff84cb0..3a8746e335 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.Index; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,24 +22,27 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * ListIndicesResponse */ public class ListIndicesResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) private List items = null; public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; - public ListIndicesResponse items(List items) { - this.items = items; return this; } @@ -55,46 +55,39 @@ public ListIndicesResponse addItemsItem(Index itemsItem) { return this; } - /** + /** * List of the fetched indices. * @return items - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of the fetched indices.") - public List getItems() { return items; } - public void setItems(List items) { this.items = items; } - public ListIndicesResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; return this; } - /** + /** * Number of pages. * @return nbPages - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(example = "100", value = "Number of pages.") - public Integer getNbPages() { return nbPages; } - public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } - @Override public boolean equals(Object o) { if (this == o) { @@ -104,8 +97,10 @@ public boolean equals(Object o) { return false; } ListIndicesResponse listIndicesResponse = (ListIndicesResponse) o; - return Objects.equals(this.items, listIndicesResponse.items) && - Objects.equals(this.nbPages, listIndicesResponse.nbPages); + return ( + Objects.equals(this.items, listIndicesResponse.items) && + Objects.equals(this.nbPages, listIndicesResponse.nbPages) + ); } @Override @@ -133,6 +128,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java index b24e1f6500..322f8db101 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,17 +20,22 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; /** * MultipleQueries */ public class MultipleQueries { + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) private String indexName; public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; @@ -43,7 +45,7 @@ public class MultipleQueries { @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DEFAULT("default"), - + FACET("facet"); private String value; @@ -71,147 +73,139 @@ public static TypeEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final TypeEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) private TypeEnum type = TypeEnum.DEFAULT; public static final String SERIALIZED_NAME_FACET = "facet"; + @SerializedName(SERIALIZED_NAME_FACET) private String facet; public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; - public MultipleQueries indexName(String indexName) { - this.indexName = indexName; return this; } - /** + /** * The Algolia index name. * @return indexName - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "products", required = true, value = "The Algolia index name.") - + @ApiModelProperty( + example = "products", + required = true, + value = "The Algolia index name." + ) public String getIndexName() { return indexName; } - public void setIndexName(String indexName) { this.indexName = indexName; } - public MultipleQueries query(String query) { - this.query = query; return this; } - /** + /** * The text to search in the index. * @return query - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The text to search in the index.") - public String getQuery() { return query; } - public void setQuery(String query) { this.query = query; } - public MultipleQueries type(TypeEnum type) { - this.type = type; return this; } - /** + /** * Perform a search query with `default`, will search for facet values if `facet` is given. * @return type - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Perform a search query with `default`, will search for facet values if `facet` is given.") - + @ApiModelProperty( + value = "Perform a search query with `default`, will search for facet values if `facet` is given." + ) public TypeEnum getType() { return type; } - public void setType(TypeEnum type) { this.type = type; } - public MultipleQueries facet(String facet) { - this.facet = facet; return this; } - /** + /** * The `facet` name. * @return facet - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The `facet` name.") - public String getFacet() { return facet; } - public void setFacet(String facet) { this.facet = facet; } - public MultipleQueries params(String params) { - this.params = params; return this; } - /** + /** * A query string of search parameters. * @return params - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "A query string of search parameters.") - public String getParams() { return params; } - public void setParams(String params) { this.params = params; } - @Override public boolean equals(Object o) { if (this == o) { @@ -221,11 +215,13 @@ public boolean equals(Object o) { return false; } MultipleQueries multipleQueries = (MultipleQueries) o; - return Objects.equals(this.indexName, multipleQueries.indexName) && - Objects.equals(this.query, multipleQueries.query) && - Objects.equals(this.type, multipleQueries.type) && - Objects.equals(this.facet, multipleQueries.facet) && - Objects.equals(this.params, multipleQueries.params); + return ( + Objects.equals(this.indexName, multipleQueries.indexName) && + Objects.equals(this.query, multipleQueries.query) && + Objects.equals(this.type, multipleQueries.type) && + Objects.equals(this.facet, multipleQueries.facet) && + Objects.equals(this.params, multipleQueries.params) + ); } @Override @@ -237,7 +233,10 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MultipleQueries {\n"); - sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb + .append(" indexName: ") + .append(toIndentedString(indexName)) + .append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); @@ -256,6 +255,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index e2c144a16b..56b4fc0aad 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.MultipleQueries; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,14 +22,18 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * MultipleQueriesObject */ public class MultipleQueriesObject { + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + @SerializedName(SERIALIZED_NAME_REQUESTS) private List requests = new ArrayList<>(); @@ -42,7 +43,7 @@ public class MultipleQueriesObject { @JsonAdapter(StrategyEnum.Adapter.class) public enum StrategyEnum { NONE("none"), - + STOPIFENOUGHMATCHES("stopIfEnoughMatches"); private String value; @@ -70,26 +71,29 @@ public static StrategyEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final StrategyEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final StrategyEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public StrategyEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + String value = jsonReader.nextString(); return StrategyEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + @SerializedName(SERIALIZED_NAME_STRATEGY) private StrategyEnum strategy; - public MultipleQueriesObject requests(List requests) { - this.requests = requests; return this; } @@ -99,46 +103,39 @@ public MultipleQueriesObject addRequestsItem(MultipleQueries requestsItem) { return this; } - /** + /** * Get requests * @return requests - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public List getRequests() { return requests; } - public void setRequests(List requests) { this.requests = requests; } - public MultipleQueriesObject strategy(StrategyEnum strategy) { - this.strategy = strategy; return this; } - /** + /** * Get strategy * @return strategy - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public StrategyEnum getStrategy() { return strategy; } - public void setStrategy(StrategyEnum strategy) { this.strategy = strategy; } - @Override public boolean equals(Object o) { if (this == o) { @@ -148,8 +145,10 @@ public boolean equals(Object o) { return false; } MultipleQueriesObject multipleQueriesObject = (MultipleQueriesObject) o; - return Objects.equals(this.requests, multipleQueriesObject.requests) && - Objects.equals(this.strategy, multipleQueriesObject.strategy); + return ( + Objects.equals(this.requests, multipleQueriesObject.requests) && + Objects.equals(this.strategy, multipleQueriesObject.strategy) + ); } @Override @@ -177,6 +176,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index bd51afe3a1..181d06b795 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.SearchResponse; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,20 +22,22 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * MultipleQueriesResponse */ public class MultipleQueriesResponse { + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) private List results = null; - public MultipleQueriesResponse results(List results) { - this.results = results; return this; } @@ -51,23 +50,20 @@ public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { return this; } - /** + /** * Get results * @return results - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public List getResults() { return results; } - public void setResults(List results) { this.results = results; } - @Override public boolean equals(Object o) { if (this == o) { @@ -104,6 +100,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java new file mode 100644 index 0000000000..00156b3140 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java @@ -0,0 +1,3 @@ +package com.algolia.model; + +public class OneOfintegerstring {} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index 640e84a15e..c5a4cdf2be 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,32 +20,35 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * Operation */ public class Operation { + /** * type of operation. */ @JsonAdapter(ActionEnum.Adapter.class) public enum ActionEnum { ADDOBJECT("addObject"), - + UPDATEOBJECT("updateObject"), - + PARTIALUPDATEOBJECT("partialUpdateObject"), - + PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"), - + DELETEOBJECT("deleteObject"), - + DELETE("delete"), - + CLEAR("clear"); private String value; @@ -76,53 +76,53 @@ public static ActionEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final ActionEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ActionEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + String value = jsonReader.nextString(); return ActionEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) private ActionEnum action; public static final String SERIALIZED_NAME_BODY = "body"; + @SerializedName(SERIALIZED_NAME_BODY) private Map body = null; - public Operation action(ActionEnum action) { - this.action = action; return this; } - /** + /** * type of operation. * @return action - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "type of operation.") - public ActionEnum getAction() { return action; } - public void setAction(ActionEnum action) { this.action = action; } - public Operation body(Map body) { - this.body = body; return this; } @@ -135,23 +135,22 @@ public Operation putBodyItem(String key, Object bodyItem) { return this; } - /** + /** * arguments to the operation (depends on the type of the operation). * @return body - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "arguments to the operation (depends on the type of the operation).") - + @ApiModelProperty( + value = "arguments to the operation (depends on the type of the operation)." + ) public Map getBody() { return body; } - public void setBody(Map body) { this.body = body; } - @Override public boolean equals(Object o) { if (this == o) { @@ -161,8 +160,10 @@ public boolean equals(Object o) { return false; } Operation operation = (Operation) o; - return Objects.equals(this.action, operation.action) && - Objects.equals(this.body, operation.body); + return ( + Objects.equals(this.action, operation.action) && + Objects.equals(this.body, operation.body) + ); } @Override @@ -190,6 +191,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index b6a5835bc4..f56a2e3494 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,20 +21,23 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * OperationIndexObject */ public class OperationIndexObject { + /** * Type of operation to perform (move or copy). */ @JsonAdapter(OperationEnum.Adapter.class) public enum OperationEnum { MOVE("move"), - + COPY("copy"); private String value; @@ -65,24 +65,31 @@ public static OperationEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final OperationEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final OperationEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public OperationEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public OperationEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return OperationEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_OPERATION = "operation"; + @SerializedName(SERIALIZED_NAME_OPERATION) private OperationEnum operation; public static final String SERIALIZED_NAME_DESTINATION = "destination"; + @SerializedName(SERIALIZED_NAME_DESTINATION) private String destination; @@ -92,9 +99,9 @@ public OperationEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(ScopeEnum.Adapter.class) public enum ScopeEnum { SETTINGS("settings"), - + SYNONYMS("synonyms"), - + RULES("rules"); private String value; @@ -122,72 +129,74 @@ public static ScopeEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final ScopeEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final ScopeEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ScopeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + String value = jsonReader.nextString(); return ScopeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) private List scope = null; - public OperationIndexObject operation(OperationEnum operation) { - this.operation = operation; return this; } - /** + /** * Type of operation to perform (move or copy). * @return operation - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Type of operation to perform (move or copy).") - + @ApiModelProperty( + required = true, + value = "Type of operation to perform (move or copy)." + ) public OperationEnum getOperation() { return operation; } - public void setOperation(OperationEnum operation) { this.operation = operation; } - public OperationIndexObject destination(String destination) { - this.destination = destination; return this; } - /** + /** * The Algolia index name. * @return destination - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "products", required = true, value = "The Algolia index name.") - + @ApiModelProperty( + example = "products", + required = true, + value = "The Algolia index name." + ) public String getDestination() { return destination; } - public void setDestination(String destination) { this.destination = destination; } - public OperationIndexObject scope(List scope) { - this.scope = scope; return this; } @@ -200,23 +209,22 @@ public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { return this; } - /** + /** * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. * @return scope - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied.") - + @ApiModelProperty( + value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied." + ) public List getScope() { return scope; } - public void setScope(List scope) { this.scope = scope; } - @Override public boolean equals(Object o) { if (this == o) { @@ -226,9 +234,11 @@ public boolean equals(Object o) { return false; } OperationIndexObject operationIndexObject = (OperationIndexObject) o; - return Objects.equals(this.operation, operationIndexObject.operation) && - Objects.equals(this.destination, operationIndexObject.destination) && - Objects.equals(this.scope, operationIndexObject.scope); + return ( + Objects.equals(this.operation, operationIndexObject.operation) && + Objects.equals(this.destination, operationIndexObject.destination) && + Objects.equals(this.scope, operationIndexObject.scope) + ); } @Override @@ -240,8 +250,14 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OperationIndexObject {\n"); - sb.append(" operation: ").append(toIndentedString(operation)).append("\n"); - sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb + .append(" operation: ") + .append(toIndentedString(operation)) + .append("\n"); + sb + .append(" destination: ") + .append(toIndentedString(destination)) + .append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append("}"); return sb.toString(); @@ -257,6 +273,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index 670cbd8043..16d43b8023 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,67 +21,63 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Objects; /** * OperationIndexResponse */ public class OperationIndexResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; - public OperationIndexResponse taskID(Integer taskID) { - this.taskID = taskID; return this; } - /** + /** * taskID of the indexing task to wait for. * @return taskID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { return taskID; } - public void setTaskID(Integer taskID) { this.taskID = taskID; } - public OperationIndexResponse updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; return this; } - /** + /** * Date of last update (ISO-8601 format). * @return updatedAt - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - public OffsetDateTime getUpdatedAt() { return updatedAt; } - public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } - @Override public boolean equals(Object o) { if (this == o) { @@ -94,8 +87,10 @@ public boolean equals(Object o) { return false; } OperationIndexResponse operationIndexResponse = (OperationIndexResponse) o; - return Objects.equals(this.taskID, operationIndexResponse.taskID) && - Objects.equals(this.updatedAt, operationIndexResponse.updatedAt); + return ( + Objects.equals(this.taskID, operationIndexResponse.taskID) && + Objects.equals(this.updatedAt, operationIndexResponse.updatedAt) + ); } @Override @@ -108,7 +103,10 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class OperationIndexResponse {\n"); sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -123,6 +121,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index 98d0ba1af8..bf3c52c18f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.RankingInfoMatchedGeoLocation; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -24,159 +21,169 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * RankingInfo */ public class RankingInfo { + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) private Integer filters; - public static final String SERIALIZED_NAME_FIRST_MATCHED_WORD = "firstMatchedWord"; + public static final String SERIALIZED_NAME_FIRST_MATCHED_WORD = + "firstMatchedWord"; + @SerializedName(SERIALIZED_NAME_FIRST_MATCHED_WORD) private Integer firstMatchedWord; public static final String SERIALIZED_NAME_GEO_DISTANCE = "geoDistance"; + @SerializedName(SERIALIZED_NAME_GEO_DISTANCE) private Integer geoDistance; public static final String SERIALIZED_NAME_GEO_PRECISION = "geoPrecision"; + @SerializedName(SERIALIZED_NAME_GEO_PRECISION) private Integer geoPrecision; - public static final String SERIALIZED_NAME_MATCHED_GEO_LOCATION = "matchedGeoLocation"; + public static final String SERIALIZED_NAME_MATCHED_GEO_LOCATION = + "matchedGeoLocation"; + @SerializedName(SERIALIZED_NAME_MATCHED_GEO_LOCATION) private Map matchedGeoLocation = null; public static final String SERIALIZED_NAME_NB_EXACT_WORDS = "nbExactWords"; + @SerializedName(SERIALIZED_NAME_NB_EXACT_WORDS) private Integer nbExactWords; public static final String SERIALIZED_NAME_NB_TYPOS = "nbTypos"; + @SerializedName(SERIALIZED_NAME_NB_TYPOS) private Integer nbTypos; public static final String SERIALIZED_NAME_PROMOTED = "promoted"; + @SerializedName(SERIALIZED_NAME_PROMOTED) private Boolean promoted; - public static final String SERIALIZED_NAME_PROXIMITY_DISTANCE = "proximityDistance"; + public static final String SERIALIZED_NAME_PROXIMITY_DISTANCE = + "proximityDistance"; + @SerializedName(SERIALIZED_NAME_PROXIMITY_DISTANCE) private Integer proximityDistance; public static final String SERIALIZED_NAME_USER_SCORE = "userScore"; + @SerializedName(SERIALIZED_NAME_USER_SCORE) private Integer userScore; public static final String SERIALIZED_NAME_WORD = "word"; + @SerializedName(SERIALIZED_NAME_WORD) private Integer word; - public RankingInfo filters(Integer filters) { - this.filters = filters; return this; } - /** + /** * This field is reserved for advanced usage. * @return filters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "This field is reserved for advanced usage.") - public Integer getFilters() { return filters; } - public void setFilters(Integer filters) { this.filters = filters; } - public RankingInfo firstMatchedWord(Integer firstMatchedWord) { - this.firstMatchedWord = firstMatchedWord; return this; } - /** + /** * Position of the most important matched attribute in the attributes to index list. * @return firstMatchedWord - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Position of the most important matched attribute in the attributes to index list.") - + @ApiModelProperty( + value = "Position of the most important matched attribute in the attributes to index list." + ) public Integer getFirstMatchedWord() { return firstMatchedWord; } - public void setFirstMatchedWord(Integer firstMatchedWord) { this.firstMatchedWord = firstMatchedWord; } - public RankingInfo geoDistance(Integer geoDistance) { - this.geoDistance = geoDistance; return this; } - /** + /** * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). * @return geoDistance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).") - + @ApiModelProperty( + value = "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters)." + ) public Integer getGeoDistance() { return geoDistance; } - public void setGeoDistance(Integer geoDistance) { this.geoDistance = geoDistance; } - public RankingInfo geoPrecision(Integer geoPrecision) { - this.geoPrecision = geoPrecision; return this; } - /** + /** * Precision used when computing the geo distance, in meters. * @return geoPrecision - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Precision used when computing the geo distance, in meters.") - + @ApiModelProperty( + value = "Precision used when computing the geo distance, in meters." + ) public Integer getGeoPrecision() { return geoPrecision; } - public void setGeoPrecision(Integer geoPrecision) { this.geoPrecision = geoPrecision; } - - public RankingInfo matchedGeoLocation(Map matchedGeoLocation) { - + public RankingInfo matchedGeoLocation( + Map matchedGeoLocation + ) { this.matchedGeoLocation = matchedGeoLocation; return this; } - public RankingInfo putMatchedGeoLocationItem(String key, RankingInfoMatchedGeoLocation matchedGeoLocationItem) { + public RankingInfo putMatchedGeoLocationItem( + String key, + RankingInfoMatchedGeoLocation matchedGeoLocationItem + ) { if (this.matchedGeoLocation == null) { this.matchedGeoLocation = new HashMap<>(); } @@ -184,161 +191,146 @@ public RankingInfo putMatchedGeoLocationItem(String key, RankingInfoMatchedGeoLo return this; } - /** + /** * Get matchedGeoLocation * @return matchedGeoLocation - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public Map getMatchedGeoLocation() { return matchedGeoLocation; } - - public void setMatchedGeoLocation(Map matchedGeoLocation) { + public void setMatchedGeoLocation( + Map matchedGeoLocation + ) { this.matchedGeoLocation = matchedGeoLocation; } - public RankingInfo nbExactWords(Integer nbExactWords) { - this.nbExactWords = nbExactWords; return this; } - /** + /** * Number of exactly matched words. * @return nbExactWords - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Number of exactly matched words.") - public Integer getNbExactWords() { return nbExactWords; } - public void setNbExactWords(Integer nbExactWords) { this.nbExactWords = nbExactWords; } - public RankingInfo nbTypos(Integer nbTypos) { - this.nbTypos = nbTypos; return this; } - /** + /** * Number of typos encountered when matching the record. * @return nbTypos - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of typos encountered when matching the record.") - + @ApiModelProperty( + value = "Number of typos encountered when matching the record." + ) public Integer getNbTypos() { return nbTypos; } - public void setNbTypos(Integer nbTypos) { this.nbTypos = nbTypos; } - public RankingInfo promoted(Boolean promoted) { - this.promoted = promoted; return this; } - /** + /** * Present and set to true if a Rule promoted the hit. * @return promoted - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Present and set to true if a Rule promoted the hit.") - + @ApiModelProperty( + value = "Present and set to true if a Rule promoted the hit." + ) public Boolean getPromoted() { return promoted; } - public void setPromoted(Boolean promoted) { this.promoted = promoted; } - public RankingInfo proximityDistance(Integer proximityDistance) { - this.proximityDistance = proximityDistance; return this; } - /** + /** * When the query contains more than one word, the sum of the distances between matched words (in meters). * @return proximityDistance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "When the query contains more than one word, the sum of the distances between matched words (in meters).") - + @ApiModelProperty( + value = "When the query contains more than one word, the sum of the distances between matched words (in meters)." + ) public Integer getProximityDistance() { return proximityDistance; } - public void setProximityDistance(Integer proximityDistance) { this.proximityDistance = proximityDistance; } - public RankingInfo userScore(Integer userScore) { - this.userScore = userScore; return this; } - /** + /** * Custom ranking for the object, expressed as a single integer value. * @return userScore - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Custom ranking for the object, expressed as a single integer value.") - + @ApiModelProperty( + value = "Custom ranking for the object, expressed as a single integer value." + ) public Integer getUserScore() { return userScore; } - public void setUserScore(Integer userScore) { this.userScore = userScore; } - public RankingInfo word(Integer word) { - this.word = word; return this; } - /** + /** * Number of matched words, including prefixes and typos. * @return word - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Number of matched words, including prefixes and typos.") - + @ApiModelProperty( + value = "Number of matched words, including prefixes and typos." + ) public Integer getWord() { return word; } - public void setWord(Integer word) { this.word = word; } - @Override public boolean equals(Object o) { if (this == o) { @@ -348,22 +340,36 @@ public boolean equals(Object o) { return false; } RankingInfo rankingInfo = (RankingInfo) o; - return Objects.equals(this.filters, rankingInfo.filters) && - Objects.equals(this.firstMatchedWord, rankingInfo.firstMatchedWord) && - Objects.equals(this.geoDistance, rankingInfo.geoDistance) && - Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && - Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && - Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && - Objects.equals(this.nbTypos, rankingInfo.nbTypos) && - Objects.equals(this.promoted, rankingInfo.promoted) && - Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && - Objects.equals(this.userScore, rankingInfo.userScore) && - Objects.equals(this.word, rankingInfo.word); + return ( + Objects.equals(this.filters, rankingInfo.filters) && + Objects.equals(this.firstMatchedWord, rankingInfo.firstMatchedWord) && + Objects.equals(this.geoDistance, rankingInfo.geoDistance) && + Objects.equals(this.geoPrecision, rankingInfo.geoPrecision) && + Objects.equals(this.matchedGeoLocation, rankingInfo.matchedGeoLocation) && + Objects.equals(this.nbExactWords, rankingInfo.nbExactWords) && + Objects.equals(this.nbTypos, rankingInfo.nbTypos) && + Objects.equals(this.promoted, rankingInfo.promoted) && + Objects.equals(this.proximityDistance, rankingInfo.proximityDistance) && + Objects.equals(this.userScore, rankingInfo.userScore) && + Objects.equals(this.word, rankingInfo.word) + ); } @Override public int hashCode() { - return Objects.hash(filters, firstMatchedWord, geoDistance, geoPrecision, matchedGeoLocation, nbExactWords, nbTypos, promoted, proximityDistance, userScore, word); + return Objects.hash( + filters, + firstMatchedWord, + geoDistance, + geoPrecision, + matchedGeoLocation, + nbExactWords, + nbTypos, + promoted, + proximityDistance, + userScore, + word + ); } @Override @@ -371,15 +377,36 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RankingInfo {\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" firstMatchedWord: ").append(toIndentedString(firstMatchedWord)).append("\n"); - sb.append(" geoDistance: ").append(toIndentedString(geoDistance)).append("\n"); - sb.append(" geoPrecision: ").append(toIndentedString(geoPrecision)).append("\n"); - sb.append(" matchedGeoLocation: ").append(toIndentedString(matchedGeoLocation)).append("\n"); - sb.append(" nbExactWords: ").append(toIndentedString(nbExactWords)).append("\n"); + sb + .append(" firstMatchedWord: ") + .append(toIndentedString(firstMatchedWord)) + .append("\n"); + sb + .append(" geoDistance: ") + .append(toIndentedString(geoDistance)) + .append("\n"); + sb + .append(" geoPrecision: ") + .append(toIndentedString(geoPrecision)) + .append("\n"); + sb + .append(" matchedGeoLocation: ") + .append(toIndentedString(matchedGeoLocation)) + .append("\n"); + sb + .append(" nbExactWords: ") + .append(toIndentedString(nbExactWords)) + .append("\n"); sb.append(" nbTypos: ").append(toIndentedString(nbTypos)).append("\n"); sb.append(" promoted: ").append(toIndentedString(promoted)).append("\n"); - sb.append(" proximityDistance: ").append(toIndentedString(proximityDistance)).append("\n"); - sb.append(" userScore: ").append(toIndentedString(userScore)).append("\n"); + sb + .append(" proximityDistance: ") + .append(toIndentedString(proximityDistance)) + .append("\n"); + sb + .append(" userScore: ") + .append(toIndentedString(userScore)) + .append("\n"); sb.append(" word: ").append(toIndentedString(word)).append("\n"); sb.append("}"); return sb.toString(); @@ -395,6 +422,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java index 67beb5b3bc..5da7af8d7b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,94 +20,89 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; /** * RankingInfoMatchedGeoLocation */ public class RankingInfoMatchedGeoLocation { + public static final String SERIALIZED_NAME_LAT = "lat"; + @SerializedName(SERIALIZED_NAME_LAT) private Double lat; public static final String SERIALIZED_NAME_LNG = "lng"; + @SerializedName(SERIALIZED_NAME_LNG) private Double lng; public static final String SERIALIZED_NAME_DISTANCE = "distance"; + @SerializedName(SERIALIZED_NAME_DISTANCE) private Integer distance; - public RankingInfoMatchedGeoLocation lat(Double lat) { - this.lat = lat; return this; } - /** + /** * Latitude of the matched location. * @return lat - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Latitude of the matched location.") - public Double getLat() { return lat; } - public void setLat(Double lat) { this.lat = lat; } - public RankingInfoMatchedGeoLocation lng(Double lng) { - this.lng = lng; return this; } - /** + /** * Longitude of the matched location. * @return lng - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Longitude of the matched location.") - public Double getLng() { return lng; } - public void setLng(Double lng) { this.lng = lng; } - public RankingInfoMatchedGeoLocation distance(Integer distance) { - this.distance = distance; return this; } - /** + /** * Distance between the matched location and the search location (in meters). * @return distance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Distance between the matched location and the search location (in meters).") - + @ApiModelProperty( + value = "Distance between the matched location and the search location (in meters)." + ) public Integer getDistance() { return distance; } - public void setDistance(Integer distance) { this.distance = distance; } - @Override public boolean equals(Object o) { if (this == o) { @@ -120,9 +112,11 @@ public boolean equals(Object o) { return false; } RankingInfoMatchedGeoLocation rankingInfoMatchedGeoLocation = (RankingInfoMatchedGeoLocation) o; - return Objects.equals(this.lat, rankingInfoMatchedGeoLocation.lat) && - Objects.equals(this.lng, rankingInfoMatchedGeoLocation.lng) && - Objects.equals(this.distance, rankingInfoMatchedGeoLocation.distance); + return ( + Objects.equals(this.lat, rankingInfoMatchedGeoLocation.lat) && + Objects.equals(this.lng, rankingInfoMatchedGeoLocation.lng) && + Objects.equals(this.distance, rankingInfoMatchedGeoLocation.distance) + ); } @Override @@ -151,6 +145,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java index 5a95b8becd..bdc36ff015 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.HighlightResult; import com.algolia.model.RankingInfo; import com.algolia.model.SnippetResult; @@ -26,151 +23,139 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Objects; /** * A single record. */ @ApiModel(description = "A single record.") - public class Record extends HashMap { + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) private String objectID; - public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = "_highlightResult"; + public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = + "_highlightResult"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_RESULT) private HighlightResult highlightResult; public static final String SERIALIZED_NAME_SNIPPET_RESULT = "_snippetResult"; + @SerializedName(SERIALIZED_NAME_SNIPPET_RESULT) private SnippetResult snippetResult; public static final String SERIALIZED_NAME_RANKING_INFO = "_rankingInfo"; + @SerializedName(SERIALIZED_NAME_RANKING_INFO) private RankingInfo rankingInfo; - public static final String SERIALIZED_NAME_DISTINCT_SEQ_I_D = "_distinctSeqID"; + public static final String SERIALIZED_NAME_DISTINCT_SEQ_I_D = + "_distinctSeqID"; + @SerializedName(SERIALIZED_NAME_DISTINCT_SEQ_I_D) private Integer distinctSeqID; - public Record objectID(String objectID) { - this.objectID = objectID; return this; } - /** + /** * Unique identifier of the object. * @return objectID - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Unique identifier of the object.") - public String getObjectID() { return objectID; } - public void setObjectID(String objectID) { this.objectID = objectID; } - public Record highlightResult(HighlightResult highlightResult) { - this.highlightResult = highlightResult; return this; } - /** + /** * Get highlightResult * @return highlightResult - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public HighlightResult getHighlightResult() { return highlightResult; } - public void setHighlightResult(HighlightResult highlightResult) { this.highlightResult = highlightResult; } - public Record snippetResult(SnippetResult snippetResult) { - this.snippetResult = snippetResult; return this; } - /** + /** * Get snippetResult * @return snippetResult - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public SnippetResult getSnippetResult() { return snippetResult; } - public void setSnippetResult(SnippetResult snippetResult) { this.snippetResult = snippetResult; } - public Record rankingInfo(RankingInfo rankingInfo) { - this.rankingInfo = rankingInfo; return this; } - /** + /** * Get rankingInfo * @return rankingInfo - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public RankingInfo getRankingInfo() { return rankingInfo; } - public void setRankingInfo(RankingInfo rankingInfo) { this.rankingInfo = rankingInfo; } - public Record distinctSeqID(Integer distinctSeqID) { - this.distinctSeqID = distinctSeqID; return this; } - /** + /** * Get distinctSeqID * @return distinctSeqID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public Integer getDistinctSeqID() { return distinctSeqID; } - public void setDistinctSeqID(Integer distinctSeqID) { this.distinctSeqID = distinctSeqID; } - @Override public boolean equals(Object o) { if (this == o) { @@ -180,17 +165,26 @@ public boolean equals(Object o) { return false; } Record record = (Record) o; - return Objects.equals(this.objectID, record.objectID) && - Objects.equals(this.highlightResult, record.highlightResult) && - Objects.equals(this.snippetResult, record.snippetResult) && - Objects.equals(this.rankingInfo, record.rankingInfo) && - Objects.equals(this.distinctSeqID, record.distinctSeqID) && - super.equals(o); + return ( + Objects.equals(this.objectID, record.objectID) && + Objects.equals(this.highlightResult, record.highlightResult) && + Objects.equals(this.snippetResult, record.snippetResult) && + Objects.equals(this.rankingInfo, record.rankingInfo) && + Objects.equals(this.distinctSeqID, record.distinctSeqID) && + super.equals(o) + ); } @Override public int hashCode() { - return Objects.hash(objectID, highlightResult, snippetResult, rankingInfo, distinctSeqID, super.hashCode()); + return Objects.hash( + objectID, + highlightResult, + snippetResult, + rankingInfo, + distinctSeqID, + super.hashCode() + ); } @Override @@ -199,10 +193,22 @@ public String toString() { sb.append("class Record {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); - sb.append(" highlightResult: ").append(toIndentedString(highlightResult)).append("\n"); - sb.append(" snippetResult: ").append(toIndentedString(snippetResult)).append("\n"); - sb.append(" rankingInfo: ").append(toIndentedString(rankingInfo)).append("\n"); - sb.append(" distinctSeqID: ").append(toIndentedString(distinctSeqID)).append("\n"); + sb + .append(" highlightResult: ") + .append(toIndentedString(highlightResult)) + .append("\n"); + sb + .append(" snippetResult: ") + .append(toIndentedString(snippetResult)) + .append("\n"); + sb + .append(" rankingInfo: ") + .append(toIndentedString(rankingInfo)) + .append("\n"); + sb + .append(" distinctSeqID: ") + .append(toIndentedString(distinctSeqID)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -217,6 +223,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index b2882a6625..44cee476c6 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,94 +20,87 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; /** * SaveObjectResponse */ public class SaveObjectResponse { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) private String createdAt; public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) private String objectID; - public SaveObjectResponse createdAt(String createdAt) { - this.createdAt = createdAt; return this; } - /** + /** * Get createdAt * @return createdAt - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public String getCreatedAt() { return createdAt; } - public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } - public SaveObjectResponse taskID(Integer taskID) { - this.taskID = taskID; return this; } - /** + /** * taskID of the indexing task to wait for. * @return taskID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { return taskID; } - public void setTaskID(Integer taskID) { this.taskID = taskID; } - public SaveObjectResponse objectID(String objectID) { - this.objectID = objectID; return this; } - /** + /** * Unique identifier of the object. * @return objectID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Unique identifier of the object.") - public String getObjectID() { return objectID; } - public void setObjectID(String objectID) { this.objectID = objectID; } - @Override public boolean equals(Object o) { if (this == o) { @@ -120,9 +110,11 @@ public boolean equals(Object o) { return false; } SaveObjectResponse saveObjectResponse = (SaveObjectResponse) o; - return Objects.equals(this.createdAt, saveObjectResponse.createdAt) && - Objects.equals(this.taskID, saveObjectResponse.taskID) && - Objects.equals(this.objectID, saveObjectResponse.objectID); + return ( + Objects.equals(this.createdAt, saveObjectResponse.createdAt) && + Objects.equals(this.taskID, saveObjectResponse.taskID) && + Objects.equals(this.objectID, saveObjectResponse.objectID) + ); } @Override @@ -134,7 +126,10 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SaveObjectResponse {\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb + .append(" createdAt: ") + .append(toIndentedString(createdAt)) + .append("\n"); sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); sb.append("}"); @@ -151,6 +146,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index 98d8db1641..47a6827642 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.Record; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,20 +22,22 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * SearchHits */ public class SearchHits { + public static final String SERIALIZED_NAME_HITS = "hits"; + @SerializedName(SERIALIZED_NAME_HITS) private List hits = null; - public SearchHits hits(List hits) { - this.hits = hits; return this; } @@ -51,23 +50,20 @@ public SearchHits addHitsItem(Record hitsItem) { return this; } - /** + /** * Get hits * @return hits - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - public List getHits() { return hits; } - public void setHits(List hits) { this.hits = hits; } - @Override public boolean equals(Object o) { if (this == o) { @@ -104,6 +100,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 43066ac6c8..c6f6c39769 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -3,20 +3,18 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.BaseSearchParams; import com.algolia.model.IndexSettingsAsSearchParams; +import com.algolia.model.OneOfintegerstring; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -27,210 +25,292 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; /** * SearchParams */ public class SearchParams { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) private String similarQuery = ""; public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) private String filters = ""; public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) private List facetFilters = null; - public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = "optionalFilters"; + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = + "optionalFilters"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) private List optionalFilters = null; public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) private List numericFilters = null; public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) private List tagFilters = null; - public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = + "sumOrFiltersScores"; + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) private List facets = null; - public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = + "maxValuesPerFacet"; + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = + "facetingAfterDistinct"; + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = + "sortFacetValuesBy"; + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) private Integer offset; public static final String SERIALIZED_NAME_LENGTH = "length"; + @SerializedName(SERIALIZED_NAME_LENGTH) private Integer length; public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng = ""; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = + "aroundLatLngViaIP"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) - private Integer aroundRadius; + private OneOfintegerstring aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = + "aroundPrecision"; - public static final String SERIALIZED_NAME_AROUND_PRECISION = "aroundPrecision"; @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) private Integer aroundPrecision = 10; - public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = + "minimumAroundRadius"; + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = + "insideBoundingBox"; + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) private List insidePolygon = null; - public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = + "naturalLanguages"; + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) private List ruleContexts = null; - public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = + "personalizationImpact"; + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + @SerializedName(SERIALIZED_NAME_USER_TOKEN) private String userToken; - public static final String SERIALIZED_NAME_GET_RANKING_INFO = "getRankingInfo"; + public static final String SERIALIZED_NAME_GET_RANKING_INFO = + "getRankingInfo"; + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) private Boolean getRankingInfo = false; public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) private Boolean clickAnalytics = false; public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + @SerializedName(SERIALIZED_NAME_ANALYTICS) private Boolean analytics = true; public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) private List analyticsTags = null; - public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = + "percentileComputation"; + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) private Boolean enableABTest = true; - public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = + "enableReRanking"; + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + "searchableAttributes"; + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + "attributesForFaceting"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + "unretrievableAttributes"; + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + "attributesToRetrieve"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + "restrictSearchableAttributes"; + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; public static final String SERIALIZED_NAME_RANKING = "ranking"; + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + "relevancyStrictness"; + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + "attributesToHighlight"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + "attributesToSnippet"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + "highlightPreTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + "highlightPostTag"; + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + "snippetEllipsisText"; + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + "restrictHighlightAndSnippetArrays"; + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + "minWordSizefor1Typo"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + "minWordSizefor2Typos"; + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; @@ -240,11 +320,11 @@ public class SearchParams { @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), - + FALSE("false"), - + MIN("min"), - + STRICT("strict"); private String value; @@ -272,60 +352,83 @@ public static TypoToleranceEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final TypoToleranceEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return TypoToleranceEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + "allowTyposOnNumericTokens"; + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + "disableTypoToleranceOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + "separatorsToIndex"; + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + "removeStopWords"; + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + "keepDiacriticsOnCharacters"; + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + "enablePersonalization"; + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; @@ -335,9 +438,9 @@ public TypoToleranceEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), - + PREFIXALL("prefixAll"), - + PREFIXNONE("prefixNone"); private String value; @@ -365,20 +468,26 @@ public static QueryTypeEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final QueryTypeEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return QueryTypeEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; @@ -388,11 +497,11 @@ public QueryTypeEnum read(final JsonReader jsonReader) throws IOException { @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), - + LASTWORDS("lastWords"), - + FIRSTWORDS("firstWords"), - + ALLOPTIONAL("allOptional"); private String value; @@ -419,33 +528,46 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final RemoveWordsIfNoResultsEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return RemoveWordsIfNoResultsEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + "removeWordsIfNoResults"; + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) - private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; + private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = + RemoveWordsIfNoResultsEnum.NONE; public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + "disableExactOnAttributes"; + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; @@ -455,9 +577,9 @@ public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), - + NONE("none"), - + WORD("word"); private String value; @@ -484,23 +606,32 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final ExactOnSingleWordQueryEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return ExactOnSingleWordQueryEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + "exactOnSingleWordQuery"; + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) - private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; + private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = + ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact @@ -508,9 +639,9 @@ public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) throws IOExc @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), - + SINGLEWORDSYNONYM("singleWordSynonym"), - + MULTIWORDSSYNONYM("multiWordsSynonym"); private String value; @@ -538,20 +669,27 @@ public static AlternativesAsExactEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AlternativesAsExactEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AlternativesAsExactEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + "alternativesAsExact"; + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; @@ -561,7 +699,7 @@ public AlternativesAsExactEnum read(final JsonReader jsonReader) throws IOExcept @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), - + EXCLUDEWORDS("excludeWords"); private String value; @@ -588,128 +726,137 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter + extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final AdvancedSyntaxFeaturesEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return AdvancedSyntaxFeaturesEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + "advancedSyntaxFeatures"; + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + "replaceSynonymsInHighlight"; + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + "attributeCriteriaComputedByMinProximity"; + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + public static final String SERIALIZED_NAME_RENDERING_CONTENT = + "renderingContent"; + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); - public SearchParams query(String query) { - this.query = query; return this; } - /** + /** * The text to search in the index. * @return query - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - public String getQuery() { return query; } - public void setQuery(String query) { this.query = query; } - public SearchParams similarQuery(String similarQuery) { - this.similarQuery = similarQuery; return this; } - /** + /** * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. * @return similarQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results.") - + @ApiModelProperty( + value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." + ) public String getSimilarQuery() { return similarQuery; } - public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } - public SearchParams filters(String filters) { - this.filters = filters; return this; } - /** + /** * Filter the query with numeric, facet and/or tag filters. * @return filters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Filter the query with numeric, facet and/or tag filters.") - + @ApiModelProperty( + value = "Filter the query with numeric, facet and/or tag filters." + ) public String getFilters() { return filters; } - public void setFilters(String filters) { this.filters = filters; } - public SearchParams facetFilters(List facetFilters) { - this.facetFilters = facetFilters; return this; } @@ -722,25 +869,21 @@ public SearchParams addFacetFiltersItem(String facetFiltersItem) { return this; } - /** + /** * Filter hits by facet value. * @return facetFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") - public List getFacetFilters() { return facetFilters; } - public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } - public SearchParams optionalFilters(List optionalFilters) { - this.optionalFilters = optionalFilters; return this; } @@ -753,25 +896,23 @@ public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { return this; } - /** + /** * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. * @return optionalFilters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter.") - + @ApiModelProperty( + value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." + ) public List getOptionalFilters() { return optionalFilters; } - public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } - public SearchParams numericFilters(List numericFilters) { - this.numericFilters = numericFilters; return this; } @@ -784,25 +925,21 @@ public SearchParams addNumericFiltersItem(String numericFiltersItem) { return this; } - /** + /** * Filter on numeric attributes. * @return numericFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") - public List getNumericFilters() { return numericFilters; } - public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } - public SearchParams tagFilters(List tagFilters) { - this.tagFilters = tagFilters; return this; } @@ -815,48 +952,42 @@ public SearchParams addTagFiltersItem(String tagFiltersItem) { return this; } - /** + /** * Filter hits by tags. * @return tagFilters - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") - public List getTagFilters() { return tagFilters; } - public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } - public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { - this.sumOrFiltersScores = sumOrFiltersScores; return this; } - /** + /** * Determines how to calculate the total score for filtering. * @return sumOrFiltersScores - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Determines how to calculate the total score for filtering.") - + @ApiModelProperty( + value = "Determines how to calculate the total score for filtering." + ) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } - public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } - public SearchParams facets(List facets) { - this.facets = facets; return this; } @@ -869,286 +1000,256 @@ public SearchParams addFacetsItem(String facetsItem) { return this; } - /** + /** * Retrieve facets and their facet values. * @return facets - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") - public List getFacets() { return facets; } - public void setFacets(List facets) { this.facets = facets; } - public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { - this.maxValuesPerFacet = maxValuesPerFacet; return this; } - /** + /** * Maximum number of facet values to return for each facet during a regular search. * @return maxValuesPerFacet - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Maximum number of facet values to return for each facet during a regular search.") - + @ApiModelProperty( + value = "Maximum number of facet values to return for each facet during a regular search." + ) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } - public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } - public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { - this.facetingAfterDistinct = facetingAfterDistinct; return this; } - /** + /** * Force faceting to be applied after de-duplication (via the Distinct setting). * @return facetingAfterDistinct - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Force faceting to be applied after de-duplication (via the Distinct setting).") - + @ApiModelProperty( + value = "Force faceting to be applied after de-duplication (via the Distinct setting)." + ) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } - public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } - public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { - this.sortFacetValuesBy = sortFacetValuesBy; return this; } - /** + /** * Controls how facet values are fetched. * @return sortFacetValuesBy - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") - public String getSortFacetValuesBy() { return sortFacetValuesBy; } - public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } - public SearchParams page(Integer page) { - this.page = page; return this; } - /** + /** * Specify the page to retrieve. * @return page - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") - public Integer getPage() { return page; } - public void setPage(Integer page) { this.page = page; } - public SearchParams offset(Integer offset) { - this.offset = offset; return this; } - /** + /** * Specify the offset of the first hit to return. * @return offset - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") - public Integer getOffset() { return offset; } - public void setOffset(Integer offset) { this.offset = offset; } - public SearchParams length(Integer length) { - this.length = length; return this; } - /** + /** * Set the number of hits to retrieve (used only with offset). * minimum: 1 * maximum: 1000 * @return length - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Set the number of hits to retrieve (used only with offset).") - + @ApiModelProperty( + value = "Set the number of hits to retrieve (used only with offset)." + ) public Integer getLength() { return length; } - public void setLength(Integer length) { this.length = length; } - public SearchParams aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; return this; } - /** + /** * Search for entries around a central geolocation, enabling a geo search within a circular area. * @return aroundLatLng - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search for entries around a central geolocation, enabling a geo search within a circular area.") - + @ApiModelProperty( + value = "Search for entries around a central geolocation, enabling a geo search within a circular area." + ) public String getAroundLatLng() { return aroundLatLng; } - public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } - public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { - this.aroundLatLngViaIP = aroundLatLngViaIP; return this; } - /** + /** * Search for entries around a given location automatically computed from the requester’s IP address. * @return aroundLatLngViaIP - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search for entries around a given location automatically computed from the requester’s IP address.") - + @ApiModelProperty( + value = "Search for entries around a given location automatically computed from the requester’s IP address." + ) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } - public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } - - public SearchParams aroundRadius(Integer aroundRadius) { - + public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { this.aroundRadius = aroundRadius; return this; } - /** + /** * Define the maximum radius for a geo search (in meters). * @return aroundRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Define the maximum radius for a geo search (in meters).") - - public Integer getAroundRadius() { + @ApiModelProperty( + value = "Define the maximum radius for a geo search (in meters)." + ) + public OneOfintegerstring getAroundRadius() { return aroundRadius; } - - public void setAroundRadius(Integer aroundRadius) { + public void setAroundRadius(OneOfintegerstring aroundRadius) { this.aroundRadius = aroundRadius; } - public SearchParams aroundPrecision(Integer aroundPrecision) { - this.aroundPrecision = aroundPrecision; return this; } - /** + /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. * @return aroundPrecision - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula.") - + @ApiModelProperty( + value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." + ) public Integer getAroundPrecision() { return aroundPrecision; } - public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } - public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { - this.minimumAroundRadius = minimumAroundRadius; return this; } - /** + /** * Minimum radius (in meters) used for a geo search when aroundRadius is not set. * minimum: 1 * @return minimumAroundRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set.") - + @ApiModelProperty( + value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." + ) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } - public SearchParams insideBoundingBox(List insideBoundingBox) { - this.insideBoundingBox = insideBoundingBox; return this; } - public SearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { + public SearchParams addInsideBoundingBoxItem( + BigDecimal insideBoundingBoxItem + ) { if (this.insideBoundingBox == null) { this.insideBoundingBox = new ArrayList<>(); } @@ -1156,25 +1257,23 @@ public SearchParams addInsideBoundingBoxItem(BigDecimal insideBoundingBoxItem) { return this; } - /** + /** * Search inside a rectangular area (in geo coordinates). * @return insideBoundingBox - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Search inside a rectangular area (in geo coordinates).") - + @ApiModelProperty( + value = "Search inside a rectangular area (in geo coordinates)." + ) public List getInsideBoundingBox() { return insideBoundingBox; } - public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } - public SearchParams insidePolygon(List insidePolygon) { - this.insidePolygon = insidePolygon; return this; } @@ -1187,25 +1286,21 @@ public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { return this; } - /** + /** * Search inside a polygon (in geo coordinates). * @return insidePolygon - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") - public List getInsidePolygon() { return insidePolygon; } - public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } - public SearchParams naturalLanguages(List naturalLanguages) { - this.naturalLanguages = naturalLanguages; return this; } @@ -1218,25 +1313,23 @@ public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { return this; } - /** + /** * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. * @return naturalLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search.") - + @ApiModelProperty( + value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." + ) public List getNaturalLanguages() { return naturalLanguages; } - public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } - public SearchParams ruleContexts(List ruleContexts) { - this.ruleContexts = ruleContexts; return this; } @@ -1249,140 +1342,120 @@ public SearchParams addRuleContextsItem(String ruleContextsItem) { return this; } - /** + /** * Enables contextual rules. * @return ruleContexts - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") - public List getRuleContexts() { return ruleContexts; } - public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } - public SearchParams personalizationImpact(Integer personalizationImpact) { - this.personalizationImpact = personalizationImpact; return this; } - /** + /** * Define the impact of the Personalization feature. * @return personalizationImpact - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") - public Integer getPersonalizationImpact() { return personalizationImpact; } - public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } - public SearchParams userToken(String userToken) { - this.userToken = userToken; return this; } - /** + /** * Associates a certain user token with the current search. * @return userToken - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Associates a certain user token with the current search.") - + @ApiModelProperty( + value = "Associates a certain user token with the current search." + ) public String getUserToken() { return userToken; } - public void setUserToken(String userToken) { this.userToken = userToken; } - public SearchParams getRankingInfo(Boolean getRankingInfo) { - this.getRankingInfo = getRankingInfo; return this; } - /** + /** * Retrieve detailed ranking information. * @return getRankingInfo - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") - public Boolean getGetRankingInfo() { return getRankingInfo; } - public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } - public SearchParams clickAnalytics(Boolean clickAnalytics) { - this.clickAnalytics = clickAnalytics; return this; } - /** + /** * Enable the Click Analytics feature. * @return clickAnalytics - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") - public Boolean getClickAnalytics() { return clickAnalytics; } - public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } - public SearchParams analytics(Boolean analytics) { - this.analytics = analytics; return this; } - /** + /** * Whether the current query will be taken into account in the Analytics. * @return analytics - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the current query will be taken into account in the Analytics.") - + @ApiModelProperty( + value = "Whether the current query will be taken into account in the Analytics." + ) public Boolean getAnalytics() { return analytics; } - public void setAnalytics(Boolean analytics) { this.analytics = analytics; } - public SearchParams analyticsTags(List analyticsTags) { - this.analyticsTags = analyticsTags; return this; } @@ -1395,99 +1468,91 @@ public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { return this; } - /** + /** * List of tags to apply to the query for analytics purposes. * @return analyticsTags - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of tags to apply to the query for analytics purposes.") - + @ApiModelProperty( + value = "List of tags to apply to the query for analytics purposes." + ) public List getAnalyticsTags() { return analyticsTags; } - public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } - public SearchParams percentileComputation(Boolean percentileComputation) { - this.percentileComputation = percentileComputation; return this; } - /** + /** * Whether to include or exclude a query from the processing-time percentile computation. * @return percentileComputation - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to include or exclude a query from the processing-time percentile computation.") - + @ApiModelProperty( + value = "Whether to include or exclude a query from the processing-time percentile computation." + ) public Boolean getPercentileComputation() { return percentileComputation; } - public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } - public SearchParams enableABTest(Boolean enableABTest) { - this.enableABTest = enableABTest; return this; } - /** + /** * Whether this search should participate in running AB tests. * @return enableABTest - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether this search should participate in running AB tests.") - + @ApiModelProperty( + value = "Whether this search should participate in running AB tests." + ) public Boolean getEnableABTest() { return enableABTest; } - public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } - public SearchParams enableReRanking(Boolean enableReRanking) { - this.enableReRanking = enableReRanking; return this; } - /** + /** * Whether this search should use AI Re-Ranking. * @return enableReRanking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") - public Boolean getEnableReRanking() { return enableReRanking; } - public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } - public SearchParams searchableAttributes(List searchableAttributes) { - this.searchableAttributes = searchableAttributes; return this; } - public SearchParams addSearchableAttributesItem(String searchableAttributesItem) { + public SearchParams addSearchableAttributesItem( + String searchableAttributesItem + ) { if (this.searchableAttributes == null) { this.searchableAttributes = new ArrayList<>(); } @@ -1495,30 +1560,32 @@ public SearchParams addSearchableAttributesItem(String searchableAttributesItem) return this; } - /** + /** * The complete list of attributes used for searching. * @return searchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes used for searching.") - + @ApiModelProperty( + value = "The complete list of attributes used for searching." + ) public List getSearchableAttributes() { return searchableAttributes; } - public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } - - public SearchParams attributesForFaceting(List attributesForFaceting) { - + public SearchParams attributesForFaceting( + List attributesForFaceting + ) { this.attributesForFaceting = attributesForFaceting; return this; } - public SearchParams addAttributesForFacetingItem(String attributesForFacetingItem) { + public SearchParams addAttributesForFacetingItem( + String attributesForFacetingItem + ) { if (this.attributesForFaceting == null) { this.attributesForFaceting = new ArrayList<>(); } @@ -1526,30 +1593,32 @@ public SearchParams addAttributesForFacetingItem(String attributesForFacetingIte return this; } - /** + /** * The complete list of attributes that will be used for faceting. * @return attributesForFaceting - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The complete list of attributes that will be used for faceting.") - + @ApiModelProperty( + value = "The complete list of attributes that will be used for faceting." + ) public List getAttributesForFaceting() { return attributesForFaceting; } - public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } - - public SearchParams unretrievableAttributes(List unretrievableAttributes) { - + public SearchParams unretrievableAttributes( + List unretrievableAttributes + ) { this.unretrievableAttributes = unretrievableAttributes; return this; } - public SearchParams addUnretrievableAttributesItem(String unretrievableAttributesItem) { + public SearchParams addUnretrievableAttributesItem( + String unretrievableAttributesItem + ) { if (this.unretrievableAttributes == null) { this.unretrievableAttributes = new ArrayList<>(); } @@ -1557,30 +1626,30 @@ public SearchParams addUnretrievableAttributesItem(String unretrievableAttribute return this; } - /** + /** * List of attributes that can’t be retrieved at query time. * @return unretrievableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes that can’t be retrieved at query time.") - + @ApiModelProperty( + value = "List of attributes that can’t be retrieved at query time." + ) public List getUnretrievableAttributes() { return unretrievableAttributes; } - public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } - public SearchParams attributesToRetrieve(List attributesToRetrieve) { - this.attributesToRetrieve = attributesToRetrieve; return this; } - public SearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) { + public SearchParams addAttributesToRetrieveItem( + String attributesToRetrieveItem + ) { if (this.attributesToRetrieve == null) { this.attributesToRetrieve = new ArrayList<>(); } @@ -1588,30 +1657,32 @@ public SearchParams addAttributesToRetrieveItem(String attributesToRetrieveItem) return this; } - /** + /** * This parameter controls which attributes to retrieve and which not to retrieve. * @return attributesToRetrieve - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "This parameter controls which attributes to retrieve and which not to retrieve.") - + @ApiModelProperty( + value = "This parameter controls which attributes to retrieve and which not to retrieve." + ) public List getAttributesToRetrieve() { return attributesToRetrieve; } - public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } - - public SearchParams restrictSearchableAttributes(List restrictSearchableAttributes) { - + public SearchParams restrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; return this; } - public SearchParams addRestrictSearchableAttributesItem(String restrictSearchableAttributesItem) { + public SearchParams addRestrictSearchableAttributesItem( + String restrictSearchableAttributesItem + ) { if (this.restrictSearchableAttributes == null) { this.restrictSearchableAttributes = new ArrayList<>(); } @@ -1619,25 +1690,25 @@ public SearchParams addRestrictSearchableAttributesItem(String restrictSearchabl return this; } - /** + /** * Restricts a given query to look in only a subset of your searchable attributes. * @return restrictSearchableAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restricts a given query to look in only a subset of your searchable attributes.") - + @ApiModelProperty( + value = "Restricts a given query to look in only a subset of your searchable attributes." + ) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - - public void setRestrictSearchableAttributes(List restrictSearchableAttributes) { + public void setRestrictSearchableAttributes( + List restrictSearchableAttributes + ) { this.restrictSearchableAttributes = restrictSearchableAttributes; } - public SearchParams ranking(List ranking) { - this.ranking = ranking; return this; } @@ -1650,25 +1721,21 @@ public SearchParams addRankingItem(String rankingItem) { return this; } - /** + /** * Controls how Algolia should sort your results. * @return ranking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - public List getRanking() { return ranking; } - public void setRanking(List ranking) { this.ranking = ranking; } - public SearchParams customRanking(List customRanking) { - this.customRanking = customRanking; return this; } @@ -1681,53 +1748,51 @@ public SearchParams addCustomRankingItem(String customRankingItem) { return this; } - /** + /** * Specifies the custom ranking criterion. * @return customRanking - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - public List getCustomRanking() { return customRanking; } - public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } - public SearchParams relevancyStrictness(Integer relevancyStrictness) { - this.relevancyStrictness = relevancyStrictness; return this; } - /** + /** * Controls the relevancy threshold below which less relevant results aren’t included in the results. * @return relevancyStrictness - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls the relevancy threshold below which less relevant results aren’t included in the results.") - + @ApiModelProperty( + value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + ) public Integer getRelevancyStrictness() { return relevancyStrictness; } - public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } - - public SearchParams attributesToHighlight(List attributesToHighlight) { - + public SearchParams attributesToHighlight( + List attributesToHighlight + ) { this.attributesToHighlight = attributesToHighlight; return this; } - public SearchParams addAttributesToHighlightItem(String attributesToHighlightItem) { + public SearchParams addAttributesToHighlightItem( + String attributesToHighlightItem + ) { if (this.attributesToHighlight == null) { this.attributesToHighlight = new ArrayList<>(); } @@ -1735,30 +1800,28 @@ public SearchParams addAttributesToHighlightItem(String attributesToHighlightIte return this; } - /** + /** * List of attributes to highlight. * @return attributesToHighlight - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - public List getAttributesToHighlight() { return attributesToHighlight; } - public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } - public SearchParams attributesToSnippet(List attributesToSnippet) { - this.attributesToSnippet = attributesToSnippet; return this; } - public SearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { + public SearchParams addAttributesToSnippetItem( + String attributesToSnippetItem + ) { if (this.attributesToSnippet == null) { this.attributesToSnippet = new ArrayList<>(); } @@ -1766,355 +1829,337 @@ public SearchParams addAttributesToSnippetItem(String attributesToSnippetItem) { return this; } - /** + /** * List of attributes to snippet, with an optional maximum number of words to snippet. * @return attributesToSnippet - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes to snippet, with an optional maximum number of words to snippet.") - + @ApiModelProperty( + value = "List of attributes to snippet, with an optional maximum number of words to snippet." + ) public List getAttributesToSnippet() { return attributesToSnippet; } - public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } - public SearchParams highlightPreTag(String highlightPreTag) { - this.highlightPreTag = highlightPreTag; return this; } - /** + /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. * @return highlightPreTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert before the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + ) public String getHighlightPreTag() { return highlightPreTag; } - public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } - public SearchParams highlightPostTag(String highlightPostTag) { - this.highlightPostTag = highlightPostTag; return this; } - /** + /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. * @return highlightPostTag - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The HTML string to insert after the highlighted parts in all highlight and snippet results.") - + @ApiModelProperty( + value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + ) public String getHighlightPostTag() { return highlightPostTag; } - public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } - public SearchParams snippetEllipsisText(String snippetEllipsisText) { - this.snippetEllipsisText = snippetEllipsisText; return this; } - /** + /** * String used as an ellipsis indicator when a snippet is truncated. * @return snippetEllipsisText - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "String used as an ellipsis indicator when a snippet is truncated.") - + @ApiModelProperty( + value = "String used as an ellipsis indicator when a snippet is truncated." + ) public String getSnippetEllipsisText() { return snippetEllipsisText; } - public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } - - public SearchParams restrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { - + public SearchParams restrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; return this; } - /** + /** * Restrict highlighting and snippeting to items that matched the query. * @return restrictHighlightAndSnippetArrays - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Restrict highlighting and snippeting to items that matched the query.") - + @ApiModelProperty( + value = "Restrict highlighting and snippeting to items that matched the query." + ) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - - public void setRestrictHighlightAndSnippetArrays(Boolean restrictHighlightAndSnippetArrays) { + public void setRestrictHighlightAndSnippetArrays( + Boolean restrictHighlightAndSnippetArrays + ) { this.restrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; } - public SearchParams hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; return this; } - /** + /** * Set the number of hits per page. * @return hitsPerPage - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - public Integer getHitsPerPage() { return hitsPerPage; } - public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } - public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { - this.minWordSizefor1Typo = minWordSizefor1Typo; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. * @return minWordSizefor1Typo - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + ) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } - public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { - this.minWordSizefor2Typos = minWordSizefor2Typos; return this; } - /** + /** * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. * @return minWordSizefor2Typos - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos.") - + @ApiModelProperty( + value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + ) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } - public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { - this.typoTolerance = typoTolerance; return this; } - /** + /** * Controls whether typo tolerance is enabled and how it is applied. * @return typoTolerance - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls whether typo tolerance is enabled and how it is applied.") - + @ApiModelProperty( + value = "Controls whether typo tolerance is enabled and how it is applied." + ) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } - - public SearchParams allowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { - + public SearchParams allowTyposOnNumericTokens( + Boolean allowTyposOnNumericTokens + ) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; return this; } - /** + /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. * @return allowTyposOnNumericTokens - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to allow typos on numbers (“numeric tokens”) in the query string.") - + @ApiModelProperty( + value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." + ) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } - - public SearchParams disableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { - + public SearchParams disableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; return this; } - public SearchParams addDisableTypoToleranceOnAttributesItem(String disableTypoToleranceOnAttributesItem) { + public SearchParams addDisableTypoToleranceOnAttributesItem( + String disableTypoToleranceOnAttributesItem + ) { if (this.disableTypoToleranceOnAttributes == null) { this.disableTypoToleranceOnAttributes = new ArrayList<>(); } - this.disableTypoToleranceOnAttributes.add(disableTypoToleranceOnAttributesItem); + this.disableTypoToleranceOnAttributes.add( + disableTypoToleranceOnAttributesItem + ); return this; } - /** + /** * List of attributes on which you want to disable typo tolerance. * @return disableTypoToleranceOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable typo tolerance.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable typo tolerance." + ) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - - public void setDisableTypoToleranceOnAttributes(List disableTypoToleranceOnAttributes) { + public void setDisableTypoToleranceOnAttributes( + List disableTypoToleranceOnAttributes + ) { this.disableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; } - public SearchParams separatorsToIndex(String separatorsToIndex) { - this.separatorsToIndex = separatorsToIndex; return this; } - /** + /** * Control which separators are indexed. * @return separatorsToIndex - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - public String getSeparatorsToIndex() { return separatorsToIndex; } - public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } - public SearchParams ignorePlurals(String ignorePlurals) { - this.ignorePlurals = ignorePlurals; return this; } - /** + /** * Treats singular, plurals, and other forms of declensions as matching terms. * @return ignorePlurals - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Treats singular, plurals, and other forms of declensions as matching terms.") - + @ApiModelProperty( + value = "Treats singular, plurals, and other forms of declensions as matching terms." + ) public String getIgnorePlurals() { return ignorePlurals; } - public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } - public SearchParams removeStopWords(String removeStopWords) { - this.removeStopWords = removeStopWords; return this; } - /** + /** * Removes stop (common) words from the query before executing it. * @return removeStopWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Removes stop (common) words from the query before executing it.") - + @ApiModelProperty( + value = "Removes stop (common) words from the query before executing it." + ) public String getRemoveStopWords() { return removeStopWords; } - public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } - - public SearchParams keepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { - + public SearchParams keepDiacriticsOnCharacters( + String keepDiacriticsOnCharacters + ) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; return this; } - /** + /** * List of characters that the engine shouldn’t automatically normalize. * @return keepDiacriticsOnCharacters - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of characters that the engine shouldn’t automatically normalize.") - + @ApiModelProperty( + value = "List of characters that the engine shouldn’t automatically normalize." + ) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } - public SearchParams queryLanguages(List queryLanguages) { - this.queryLanguages = queryLanguages; return this; } @@ -2127,163 +2172,147 @@ public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { return this; } - /** + /** * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. * @return queryLanguages - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection.") - + @ApiModelProperty( + value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + ) public List getQueryLanguages() { return queryLanguages; } - public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } - public SearchParams decompoundQuery(Boolean decompoundQuery) { - this.decompoundQuery = decompoundQuery; return this; } - /** + /** * Splits compound words into their composing atoms in the query. * @return decompoundQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Splits compound words into their composing atoms in the query.") - + @ApiModelProperty( + value = "Splits compound words into their composing atoms in the query." + ) public Boolean getDecompoundQuery() { return decompoundQuery; } - public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } - public SearchParams enableRules(Boolean enableRules) { - this.enableRules = enableRules; return this; } - /** + /** * Whether Rules should be globally enabled. * @return enableRules - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - public Boolean getEnableRules() { return enableRules; } - public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } - public SearchParams enablePersonalization(Boolean enablePersonalization) { - this.enablePersonalization = enablePersonalization; return this; } - /** + /** * Enable the Personalization feature. * @return enablePersonalization - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - public Boolean getEnablePersonalization() { return enablePersonalization; } - public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } - public SearchParams queryType(QueryTypeEnum queryType) { - this.queryType = queryType; return this; } - /** + /** * Controls if and how query words are interpreted as prefixes. * @return queryType - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls if and how query words are interpreted as prefixes.") - + @ApiModelProperty( + value = "Controls if and how query words are interpreted as prefixes." + ) public QueryTypeEnum getQueryType() { return queryType; } - public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } - - public SearchParams removeWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { - + public SearchParams removeWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; return this; } - /** + /** * Selects a strategy to remove words from the query when it doesn’t match any hits. * @return removeWordsIfNoResults - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Selects a strategy to remove words from the query when it doesn’t match any hits.") - + @ApiModelProperty( + value = "Selects a strategy to remove words from the query when it doesn’t match any hits." + ) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - - public void setRemoveWordsIfNoResults(RemoveWordsIfNoResultsEnum removeWordsIfNoResults) { + public void setRemoveWordsIfNoResults( + RemoveWordsIfNoResultsEnum removeWordsIfNoResults + ) { this.removeWordsIfNoResults = removeWordsIfNoResults; } - public SearchParams advancedSyntax(Boolean advancedSyntax) { - this.advancedSyntax = advancedSyntax; return this; } - /** + /** * Enables the advanced query syntax. * @return advancedSyntax - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - public Boolean getAdvancedSyntax() { return advancedSyntax; } - public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } - public SearchParams optionalWords(List optionalWords) { - this.optionalWords = optionalWords; return this; } @@ -2296,30 +2325,32 @@ public SearchParams addOptionalWordsItem(String optionalWordsItem) { return this; } - /** + /** * A list of words that should be considered as optional when found in the query. * @return optionalWords - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A list of words that should be considered as optional when found in the query.") - + @ApiModelProperty( + value = "A list of words that should be considered as optional when found in the query." + ) public List getOptionalWords() { return optionalWords; } - public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } - - public SearchParams disableExactOnAttributes(List disableExactOnAttributes) { - + public SearchParams disableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; return this; } - public SearchParams addDisableExactOnAttributesItem(String disableExactOnAttributesItem) { + public SearchParams addDisableExactOnAttributesItem( + String disableExactOnAttributesItem + ) { if (this.disableExactOnAttributes == null) { this.disableExactOnAttributes = new ArrayList<>(); } @@ -2327,53 +2358,59 @@ public SearchParams addDisableExactOnAttributesItem(String disableExactOnAttribu return this; } - /** + /** * List of attributes on which you want to disable the exact ranking criterion. * @return disableExactOnAttributes - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of attributes on which you want to disable the exact ranking criterion.") - + @ApiModelProperty( + value = "List of attributes on which you want to disable the exact ranking criterion." + ) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - - public void setDisableExactOnAttributes(List disableExactOnAttributes) { + public void setDisableExactOnAttributes( + List disableExactOnAttributes + ) { this.disableExactOnAttributes = disableExactOnAttributes; } - - public SearchParams exactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { - + public SearchParams exactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; return this; } - /** + /** * Controls how the exact ranking criterion is computed when the query contains only one word. * @return exactOnSingleWordQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Controls how the exact ranking criterion is computed when the query contains only one word.") - + @ApiModelProperty( + value = "Controls how the exact ranking criterion is computed when the query contains only one word." + ) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - - public void setExactOnSingleWordQuery(ExactOnSingleWordQueryEnum exactOnSingleWordQuery) { + public void setExactOnSingleWordQuery( + ExactOnSingleWordQueryEnum exactOnSingleWordQuery + ) { this.exactOnSingleWordQuery = exactOnSingleWordQuery; } - - public SearchParams alternativesAsExact(List alternativesAsExact) { - + public SearchParams alternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; return this; } - public SearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternativesAsExactItem) { + public SearchParams addAlternativesAsExactItem( + AlternativesAsExactEnum alternativesAsExactItem + ) { if (this.alternativesAsExact == null) { this.alternativesAsExact = new ArrayList<>(); } @@ -2381,30 +2418,34 @@ public SearchParams addAlternativesAsExactItem(AlternativesAsExactEnum alternati return this; } - /** + /** * List of alternatives that should be considered an exact match by the exact ranking criterion. * @return alternativesAsExact - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "List of alternatives that should be considered an exact match by the exact ranking criterion.") - + @ApiModelProperty( + value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + ) public List getAlternativesAsExact() { return alternativesAsExact; } - - public void setAlternativesAsExact(List alternativesAsExact) { + public void setAlternativesAsExact( + List alternativesAsExact + ) { this.alternativesAsExact = alternativesAsExact; } - - public SearchParams advancedSyntaxFeatures(List advancedSyntaxFeatures) { - + public SearchParams advancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; return this; } - public SearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem) { + public SearchParams addAdvancedSyntaxFeaturesItem( + AdvancedSyntaxFeaturesEnum advancedSyntaxFeaturesItem + ) { if (this.advancedSyntaxFeatures == null) { this.advancedSyntaxFeatures = new ArrayList<>(); } @@ -2412,121 +2453,113 @@ public SearchParams addAdvancedSyntaxFeaturesItem(AdvancedSyntaxFeaturesEnum adv return this; } - /** + /** * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. * @return advancedSyntaxFeatures - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled.") - + @ApiModelProperty( + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + ) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - - public void setAdvancedSyntaxFeatures(List advancedSyntaxFeatures) { + public void setAdvancedSyntaxFeatures( + List advancedSyntaxFeatures + ) { this.advancedSyntaxFeatures = advancedSyntaxFeatures; } - public SearchParams distinct(Integer distinct) { - this.distinct = distinct; return this; } - /** + /** * Enables de-duplication or grouping of results. * minimum: 0 * maximum: 4 * @return distinct - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - public Integer getDistinct() { return distinct; } - public void setDistinct(Integer distinct) { this.distinct = distinct; } - public SearchParams synonyms(Boolean synonyms) { - this.synonyms = synonyms; return this; } - /** + /** * Whether to take into account an index’s synonyms for a particular search. * @return synonyms - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to take into account an index’s synonyms for a particular search.") - + @ApiModelProperty( + value = "Whether to take into account an index’s synonyms for a particular search." + ) public Boolean getSynonyms() { return synonyms; } - public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } - - public SearchParams replaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { - + public SearchParams replaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; return this; } - /** + /** * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. * @return replaceSynonymsInHighlight - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself.") - + @ApiModelProperty( + value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + ) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - - public void setReplaceSynonymsInHighlight(Boolean replaceSynonymsInHighlight) { + public void setReplaceSynonymsInHighlight( + Boolean replaceSynonymsInHighlight + ) { this.replaceSynonymsInHighlight = replaceSynonymsInHighlight; } - public SearchParams minProximity(Integer minProximity) { - this.minProximity = minProximity; return this; } - /** + /** * Precision of the proximity ranking criterion. * minimum: 1 * maximum: 7 * @return minProximity - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - public Integer getMinProximity() { return minProximity; } - public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } - public SearchParams responseFields(List responseFields) { - this.responseFields = responseFields; return this; } @@ -2539,92 +2572,91 @@ public SearchParams addResponseFieldsItem(String responseFieldsItem) { return this; } - /** + /** * Choose which fields to return in the API response. This parameters applies to search and browse queries. * @return responseFields - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Choose which fields to return in the API response. This parameters applies to search and browse queries.") - + @ApiModelProperty( + value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + ) public List getResponseFields() { return responseFields; } - public void setResponseFields(List responseFields) { this.responseFields = responseFields; } - public SearchParams maxFacetHits(Integer maxFacetHits) { - this.maxFacetHits = maxFacetHits; return this; } - /** + /** * Maximum number of facet hits to return during a search for facet values. * @return maxFacetHits - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Maximum number of facet hits to return during a search for facet values.") - + @ApiModelProperty( + value = "Maximum number of facet hits to return during a search for facet values." + ) public Integer getMaxFacetHits() { return maxFacetHits; } - public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } - - public SearchParams attributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public SearchParams attributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; return this; } - /** + /** * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. * @return attributeCriteriaComputedByMinProximity - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage.") - + @ApiModelProperty( + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + ) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - - public void setAttributeCriteriaComputedByMinProximity(Boolean attributeCriteriaComputedByMinProximity) { - this.attributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + public void setAttributeCriteriaComputedByMinProximity( + Boolean attributeCriteriaComputedByMinProximity + ) { + this.attributeCriteriaComputedByMinProximity = + attributeCriteriaComputedByMinProximity; } - public SearchParams renderingContent(Object renderingContent) { - this.renderingContent = renderingContent; return this; } - /** + /** * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. * @return renderingContent - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.") - + @ApiModelProperty( + value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + ) public Object getRenderingContent() { return renderingContent; } - public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } - @Override public boolean equals(Object o) { if (this == o) { @@ -2634,88 +2666,275 @@ public boolean equals(Object o) { return false; } SearchParams searchParams = (SearchParams) o; - return Objects.equals(this.query, searchParams.query) && - Objects.equals(this.similarQuery, searchParams.similarQuery) && - Objects.equals(this.filters, searchParams.filters) && - Objects.equals(this.facetFilters, searchParams.facetFilters) && - Objects.equals(this.optionalFilters, searchParams.optionalFilters) && - Objects.equals(this.numericFilters, searchParams.numericFilters) && - Objects.equals(this.tagFilters, searchParams.tagFilters) && - Objects.equals(this.sumOrFiltersScores, searchParams.sumOrFiltersScores) && - Objects.equals(this.facets, searchParams.facets) && - Objects.equals(this.maxValuesPerFacet, searchParams.maxValuesPerFacet) && - Objects.equals(this.facetingAfterDistinct, searchParams.facetingAfterDistinct) && - Objects.equals(this.sortFacetValuesBy, searchParams.sortFacetValuesBy) && - Objects.equals(this.page, searchParams.page) && - Objects.equals(this.offset, searchParams.offset) && - Objects.equals(this.length, searchParams.length) && - Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && - Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && - Objects.equals(this.aroundRadius, searchParams.aroundRadius) && - Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && - Objects.equals(this.minimumAroundRadius, searchParams.minimumAroundRadius) && - Objects.equals(this.insideBoundingBox, searchParams.insideBoundingBox) && - Objects.equals(this.insidePolygon, searchParams.insidePolygon) && - Objects.equals(this.naturalLanguages, searchParams.naturalLanguages) && - Objects.equals(this.ruleContexts, searchParams.ruleContexts) && - Objects.equals(this.personalizationImpact, searchParams.personalizationImpact) && - Objects.equals(this.userToken, searchParams.userToken) && - Objects.equals(this.getRankingInfo, searchParams.getRankingInfo) && - Objects.equals(this.clickAnalytics, searchParams.clickAnalytics) && - Objects.equals(this.analytics, searchParams.analytics) && - Objects.equals(this.analyticsTags, searchParams.analyticsTags) && - Objects.equals(this.percentileComputation, searchParams.percentileComputation) && - Objects.equals(this.enableABTest, searchParams.enableABTest) && - Objects.equals(this.enableReRanking, searchParams.enableReRanking) && - Objects.equals(this.searchableAttributes, searchParams.searchableAttributes) && - Objects.equals(this.attributesForFaceting, searchParams.attributesForFaceting) && - Objects.equals(this.unretrievableAttributes, searchParams.unretrievableAttributes) && - Objects.equals(this.attributesToRetrieve, searchParams.attributesToRetrieve) && - Objects.equals(this.restrictSearchableAttributes, searchParams.restrictSearchableAttributes) && - Objects.equals(this.ranking, searchParams.ranking) && - Objects.equals(this.customRanking, searchParams.customRanking) && - Objects.equals(this.relevancyStrictness, searchParams.relevancyStrictness) && - Objects.equals(this.attributesToHighlight, searchParams.attributesToHighlight) && - Objects.equals(this.attributesToSnippet, searchParams.attributesToSnippet) && - Objects.equals(this.highlightPreTag, searchParams.highlightPreTag) && - Objects.equals(this.highlightPostTag, searchParams.highlightPostTag) && - Objects.equals(this.snippetEllipsisText, searchParams.snippetEllipsisText) && - Objects.equals(this.restrictHighlightAndSnippetArrays, searchParams.restrictHighlightAndSnippetArrays) && - Objects.equals(this.hitsPerPage, searchParams.hitsPerPage) && - Objects.equals(this.minWordSizefor1Typo, searchParams.minWordSizefor1Typo) && - Objects.equals(this.minWordSizefor2Typos, searchParams.minWordSizefor2Typos) && - Objects.equals(this.typoTolerance, searchParams.typoTolerance) && - Objects.equals(this.allowTyposOnNumericTokens, searchParams.allowTyposOnNumericTokens) && - Objects.equals(this.disableTypoToleranceOnAttributes, searchParams.disableTypoToleranceOnAttributes) && - Objects.equals(this.separatorsToIndex, searchParams.separatorsToIndex) && - Objects.equals(this.ignorePlurals, searchParams.ignorePlurals) && - Objects.equals(this.removeStopWords, searchParams.removeStopWords) && - Objects.equals(this.keepDiacriticsOnCharacters, searchParams.keepDiacriticsOnCharacters) && - Objects.equals(this.queryLanguages, searchParams.queryLanguages) && - Objects.equals(this.decompoundQuery, searchParams.decompoundQuery) && - Objects.equals(this.enableRules, searchParams.enableRules) && - Objects.equals(this.enablePersonalization, searchParams.enablePersonalization) && - Objects.equals(this.queryType, searchParams.queryType) && - Objects.equals(this.removeWordsIfNoResults, searchParams.removeWordsIfNoResults) && - Objects.equals(this.advancedSyntax, searchParams.advancedSyntax) && - Objects.equals(this.optionalWords, searchParams.optionalWords) && - Objects.equals(this.disableExactOnAttributes, searchParams.disableExactOnAttributes) && - Objects.equals(this.exactOnSingleWordQuery, searchParams.exactOnSingleWordQuery) && - Objects.equals(this.alternativesAsExact, searchParams.alternativesAsExact) && - Objects.equals(this.advancedSyntaxFeatures, searchParams.advancedSyntaxFeatures) && - Objects.equals(this.distinct, searchParams.distinct) && - Objects.equals(this.synonyms, searchParams.synonyms) && - Objects.equals(this.replaceSynonymsInHighlight, searchParams.replaceSynonymsInHighlight) && - Objects.equals(this.minProximity, searchParams.minProximity) && - Objects.equals(this.responseFields, searchParams.responseFields) && - Objects.equals(this.maxFacetHits, searchParams.maxFacetHits) && - Objects.equals(this.attributeCriteriaComputedByMinProximity, searchParams.attributeCriteriaComputedByMinProximity) && - Objects.equals(this.renderingContent, searchParams.renderingContent); + return ( + Objects.equals(this.query, searchParams.query) && + Objects.equals(this.similarQuery, searchParams.similarQuery) && + Objects.equals(this.filters, searchParams.filters) && + Objects.equals(this.facetFilters, searchParams.facetFilters) && + Objects.equals(this.optionalFilters, searchParams.optionalFilters) && + Objects.equals(this.numericFilters, searchParams.numericFilters) && + Objects.equals(this.tagFilters, searchParams.tagFilters) && + Objects.equals( + this.sumOrFiltersScores, + searchParams.sumOrFiltersScores + ) && + Objects.equals(this.facets, searchParams.facets) && + Objects.equals(this.maxValuesPerFacet, searchParams.maxValuesPerFacet) && + Objects.equals( + this.facetingAfterDistinct, + searchParams.facetingAfterDistinct + ) && + Objects.equals(this.sortFacetValuesBy, searchParams.sortFacetValuesBy) && + Objects.equals(this.page, searchParams.page) && + Objects.equals(this.offset, searchParams.offset) && + Objects.equals(this.length, searchParams.length) && + Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && + Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && + Objects.equals(this.aroundRadius, searchParams.aroundRadius) && + Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && + Objects.equals( + this.minimumAroundRadius, + searchParams.minimumAroundRadius + ) && + Objects.equals(this.insideBoundingBox, searchParams.insideBoundingBox) && + Objects.equals(this.insidePolygon, searchParams.insidePolygon) && + Objects.equals(this.naturalLanguages, searchParams.naturalLanguages) && + Objects.equals(this.ruleContexts, searchParams.ruleContexts) && + Objects.equals( + this.personalizationImpact, + searchParams.personalizationImpact + ) && + Objects.equals(this.userToken, searchParams.userToken) && + Objects.equals(this.getRankingInfo, searchParams.getRankingInfo) && + Objects.equals(this.clickAnalytics, searchParams.clickAnalytics) && + Objects.equals(this.analytics, searchParams.analytics) && + Objects.equals(this.analyticsTags, searchParams.analyticsTags) && + Objects.equals( + this.percentileComputation, + searchParams.percentileComputation + ) && + Objects.equals(this.enableABTest, searchParams.enableABTest) && + Objects.equals(this.enableReRanking, searchParams.enableReRanking) && + Objects.equals( + this.searchableAttributes, + searchParams.searchableAttributes + ) && + Objects.equals( + this.attributesForFaceting, + searchParams.attributesForFaceting + ) && + Objects.equals( + this.unretrievableAttributes, + searchParams.unretrievableAttributes + ) && + Objects.equals( + this.attributesToRetrieve, + searchParams.attributesToRetrieve + ) && + Objects.equals( + this.restrictSearchableAttributes, + searchParams.restrictSearchableAttributes + ) && + Objects.equals(this.ranking, searchParams.ranking) && + Objects.equals(this.customRanking, searchParams.customRanking) && + Objects.equals( + this.relevancyStrictness, + searchParams.relevancyStrictness + ) && + Objects.equals( + this.attributesToHighlight, + searchParams.attributesToHighlight + ) && + Objects.equals( + this.attributesToSnippet, + searchParams.attributesToSnippet + ) && + Objects.equals(this.highlightPreTag, searchParams.highlightPreTag) && + Objects.equals(this.highlightPostTag, searchParams.highlightPostTag) && + Objects.equals( + this.snippetEllipsisText, + searchParams.snippetEllipsisText + ) && + Objects.equals( + this.restrictHighlightAndSnippetArrays, + searchParams.restrictHighlightAndSnippetArrays + ) && + Objects.equals(this.hitsPerPage, searchParams.hitsPerPage) && + Objects.equals( + this.minWordSizefor1Typo, + searchParams.minWordSizefor1Typo + ) && + Objects.equals( + this.minWordSizefor2Typos, + searchParams.minWordSizefor2Typos + ) && + Objects.equals(this.typoTolerance, searchParams.typoTolerance) && + Objects.equals( + this.allowTyposOnNumericTokens, + searchParams.allowTyposOnNumericTokens + ) && + Objects.equals( + this.disableTypoToleranceOnAttributes, + searchParams.disableTypoToleranceOnAttributes + ) && + Objects.equals(this.separatorsToIndex, searchParams.separatorsToIndex) && + Objects.equals(this.ignorePlurals, searchParams.ignorePlurals) && + Objects.equals(this.removeStopWords, searchParams.removeStopWords) && + Objects.equals( + this.keepDiacriticsOnCharacters, + searchParams.keepDiacriticsOnCharacters + ) && + Objects.equals(this.queryLanguages, searchParams.queryLanguages) && + Objects.equals(this.decompoundQuery, searchParams.decompoundQuery) && + Objects.equals(this.enableRules, searchParams.enableRules) && + Objects.equals( + this.enablePersonalization, + searchParams.enablePersonalization + ) && + Objects.equals(this.queryType, searchParams.queryType) && + Objects.equals( + this.removeWordsIfNoResults, + searchParams.removeWordsIfNoResults + ) && + Objects.equals(this.advancedSyntax, searchParams.advancedSyntax) && + Objects.equals(this.optionalWords, searchParams.optionalWords) && + Objects.equals( + this.disableExactOnAttributes, + searchParams.disableExactOnAttributes + ) && + Objects.equals( + this.exactOnSingleWordQuery, + searchParams.exactOnSingleWordQuery + ) && + Objects.equals( + this.alternativesAsExact, + searchParams.alternativesAsExact + ) && + Objects.equals( + this.advancedSyntaxFeatures, + searchParams.advancedSyntaxFeatures + ) && + Objects.equals(this.distinct, searchParams.distinct) && + Objects.equals(this.synonyms, searchParams.synonyms) && + Objects.equals( + this.replaceSynonymsInHighlight, + searchParams.replaceSynonymsInHighlight + ) && + Objects.equals(this.minProximity, searchParams.minProximity) && + Objects.equals(this.responseFields, searchParams.responseFields) && + Objects.equals(this.maxFacetHits, searchParams.maxFacetHits) && + Objects.equals( + this.attributeCriteriaComputedByMinProximity, + searchParams.attributeCriteriaComputedByMinProximity + ) && + Objects.equals(this.renderingContent, searchParams.renderingContent) + ); + } + + private static boolean equalsNullable( + JsonNullable a, + JsonNullable b + ) { + return ( + a == b || + ( + a != null && + b != null && + a.isPresent() && + b.isPresent() && + Objects.deepEquals(a.get(), b.get()) + ) + ); } @Override public int hashCode() { - return Objects.hash(query, similarQuery, filters, facetFilters, optionalFilters, numericFilters, tagFilters, sumOrFiltersScores, facets, maxValuesPerFacet, facetingAfterDistinct, sortFacetValuesBy, page, offset, length, aroundLatLng, aroundLatLngViaIP, aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, insidePolygon, naturalLanguages, ruleContexts, personalizationImpact, userToken, getRankingInfo, clickAnalytics, analytics, analyticsTags, percentileComputation, enableABTest, enableReRanking, searchableAttributes, attributesForFaceting, unretrievableAttributes, attributesToRetrieve, restrictSearchableAttributes, ranking, customRanking, relevancyStrictness, attributesToHighlight, attributesToSnippet, highlightPreTag, highlightPostTag, snippetEllipsisText, restrictHighlightAndSnippetArrays, hitsPerPage, minWordSizefor1Typo, minWordSizefor2Typos, typoTolerance, allowTyposOnNumericTokens, disableTypoToleranceOnAttributes, separatorsToIndex, ignorePlurals, removeStopWords, keepDiacriticsOnCharacters, queryLanguages, decompoundQuery, enableRules, enablePersonalization, queryType, removeWordsIfNoResults, advancedSyntax, optionalWords, disableExactOnAttributes, exactOnSingleWordQuery, alternativesAsExact, advancedSyntaxFeatures, distinct, synonyms, replaceSynonymsInHighlight, minProximity, responseFields, maxFacetHits, attributeCriteriaComputedByMinProximity, renderingContent); + return Objects.hash( + query, + similarQuery, + filters, + facetFilters, + optionalFilters, + numericFilters, + tagFilters, + sumOrFiltersScores, + facets, + maxValuesPerFacet, + facetingAfterDistinct, + sortFacetValuesBy, + page, + offset, + length, + aroundLatLng, + aroundLatLngViaIP, + aroundRadius, + aroundPrecision, + minimumAroundRadius, + insideBoundingBox, + insidePolygon, + naturalLanguages, + ruleContexts, + personalizationImpact, + userToken, + getRankingInfo, + clickAnalytics, + analytics, + analyticsTags, + percentileComputation, + enableABTest, + enableReRanking, + searchableAttributes, + attributesForFaceting, + unretrievableAttributes, + attributesToRetrieve, + restrictSearchableAttributes, + ranking, + customRanking, + relevancyStrictness, + attributesToHighlight, + attributesToSnippet, + highlightPreTag, + highlightPostTag, + snippetEllipsisText, + restrictHighlightAndSnippetArrays, + hitsPerPage, + minWordSizefor1Typo, + minWordSizefor2Typos, + typoTolerance, + allowTyposOnNumericTokens, + disableTypoToleranceOnAttributes, + separatorsToIndex, + ignorePlurals, + removeStopWords, + keepDiacriticsOnCharacters, + queryLanguages, + decompoundQuery, + enableRules, + enablePersonalization, + queryType, + removeWordsIfNoResults, + advancedSyntax, + optionalWords, + disableExactOnAttributes, + exactOnSingleWordQuery, + alternativesAsExact, + advancedSyntaxFeatures, + distinct, + synonyms, + replaceSynonymsInHighlight, + minProximity, + responseFields, + maxFacetHits, + attributeCriteriaComputedByMinProximity, + renderingContent + ); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31; } @Override @@ -2723,82 +2942,286 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchParams {\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" similarQuery: ").append(toIndentedString(similarQuery)).append("\n"); + sb + .append(" similarQuery: ") + .append(toIndentedString(similarQuery)) + .append("\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); - sb.append(" facetFilters: ").append(toIndentedString(facetFilters)).append("\n"); - sb.append(" optionalFilters: ").append(toIndentedString(optionalFilters)).append("\n"); - sb.append(" numericFilters: ").append(toIndentedString(numericFilters)).append("\n"); - sb.append(" tagFilters: ").append(toIndentedString(tagFilters)).append("\n"); - sb.append(" sumOrFiltersScores: ").append(toIndentedString(sumOrFiltersScores)).append("\n"); + sb + .append(" facetFilters: ") + .append(toIndentedString(facetFilters)) + .append("\n"); + sb + .append(" optionalFilters: ") + .append(toIndentedString(optionalFilters)) + .append("\n"); + sb + .append(" numericFilters: ") + .append(toIndentedString(numericFilters)) + .append("\n"); + sb + .append(" tagFilters: ") + .append(toIndentedString(tagFilters)) + .append("\n"); + sb + .append(" sumOrFiltersScores: ") + .append(toIndentedString(sumOrFiltersScores)) + .append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb.append(" maxValuesPerFacet: ").append(toIndentedString(maxValuesPerFacet)).append("\n"); - sb.append(" facetingAfterDistinct: ").append(toIndentedString(facetingAfterDistinct)).append("\n"); - sb.append(" sortFacetValuesBy: ").append(toIndentedString(sortFacetValuesBy)).append("\n"); + sb + .append(" maxValuesPerFacet: ") + .append(toIndentedString(maxValuesPerFacet)) + .append("\n"); + sb + .append(" facetingAfterDistinct: ") + .append(toIndentedString(facetingAfterDistinct)) + .append("\n"); + sb + .append(" sortFacetValuesBy: ") + .append(toIndentedString(sortFacetValuesBy)) + .append("\n"); sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); sb.append(" length: ").append(toIndentedString(length)).append("\n"); - sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); - sb.append(" aroundLatLngViaIP: ").append(toIndentedString(aroundLatLngViaIP)).append("\n"); - sb.append(" aroundRadius: ").append(toIndentedString(aroundRadius)).append("\n"); - sb.append(" aroundPrecision: ").append(toIndentedString(aroundPrecision)).append("\n"); - sb.append(" minimumAroundRadius: ").append(toIndentedString(minimumAroundRadius)).append("\n"); - sb.append(" insideBoundingBox: ").append(toIndentedString(insideBoundingBox)).append("\n"); - sb.append(" insidePolygon: ").append(toIndentedString(insidePolygon)).append("\n"); - sb.append(" naturalLanguages: ").append(toIndentedString(naturalLanguages)).append("\n"); - sb.append(" ruleContexts: ").append(toIndentedString(ruleContexts)).append("\n"); - sb.append(" personalizationImpact: ").append(toIndentedString(personalizationImpact)).append("\n"); - sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n"); - sb.append(" getRankingInfo: ").append(toIndentedString(getRankingInfo)).append("\n"); - sb.append(" clickAnalytics: ").append(toIndentedString(clickAnalytics)).append("\n"); - sb.append(" analytics: ").append(toIndentedString(analytics)).append("\n"); - sb.append(" analyticsTags: ").append(toIndentedString(analyticsTags)).append("\n"); - sb.append(" percentileComputation: ").append(toIndentedString(percentileComputation)).append("\n"); - sb.append(" enableABTest: ").append(toIndentedString(enableABTest)).append("\n"); - sb.append(" enableReRanking: ").append(toIndentedString(enableReRanking)).append("\n"); - sb.append(" searchableAttributes: ").append(toIndentedString(searchableAttributes)).append("\n"); - sb.append(" attributesForFaceting: ").append(toIndentedString(attributesForFaceting)).append("\n"); - sb.append(" unretrievableAttributes: ").append(toIndentedString(unretrievableAttributes)).append("\n"); - sb.append(" attributesToRetrieve: ").append(toIndentedString(attributesToRetrieve)).append("\n"); - sb.append(" restrictSearchableAttributes: ").append(toIndentedString(restrictSearchableAttributes)).append("\n"); + sb + .append(" aroundLatLng: ") + .append(toIndentedString(aroundLatLng)) + .append("\n"); + sb + .append(" aroundLatLngViaIP: ") + .append(toIndentedString(aroundLatLngViaIP)) + .append("\n"); + sb + .append(" aroundRadius: ") + .append(toIndentedString(aroundRadius)) + .append("\n"); + sb + .append(" aroundPrecision: ") + .append(toIndentedString(aroundPrecision)) + .append("\n"); + sb + .append(" minimumAroundRadius: ") + .append(toIndentedString(minimumAroundRadius)) + .append("\n"); + sb + .append(" insideBoundingBox: ") + .append(toIndentedString(insideBoundingBox)) + .append("\n"); + sb + .append(" insidePolygon: ") + .append(toIndentedString(insidePolygon)) + .append("\n"); + sb + .append(" naturalLanguages: ") + .append(toIndentedString(naturalLanguages)) + .append("\n"); + sb + .append(" ruleContexts: ") + .append(toIndentedString(ruleContexts)) + .append("\n"); + sb + .append(" personalizationImpact: ") + .append(toIndentedString(personalizationImpact)) + .append("\n"); + sb + .append(" userToken: ") + .append(toIndentedString(userToken)) + .append("\n"); + sb + .append(" getRankingInfo: ") + .append(toIndentedString(getRankingInfo)) + .append("\n"); + sb + .append(" clickAnalytics: ") + .append(toIndentedString(clickAnalytics)) + .append("\n"); + sb + .append(" analytics: ") + .append(toIndentedString(analytics)) + .append("\n"); + sb + .append(" analyticsTags: ") + .append(toIndentedString(analyticsTags)) + .append("\n"); + sb + .append(" percentileComputation: ") + .append(toIndentedString(percentileComputation)) + .append("\n"); + sb + .append(" enableABTest: ") + .append(toIndentedString(enableABTest)) + .append("\n"); + sb + .append(" enableReRanking: ") + .append(toIndentedString(enableReRanking)) + .append("\n"); + sb + .append(" searchableAttributes: ") + .append(toIndentedString(searchableAttributes)) + .append("\n"); + sb + .append(" attributesForFaceting: ") + .append(toIndentedString(attributesForFaceting)) + .append("\n"); + sb + .append(" unretrievableAttributes: ") + .append(toIndentedString(unretrievableAttributes)) + .append("\n"); + sb + .append(" attributesToRetrieve: ") + .append(toIndentedString(attributesToRetrieve)) + .append("\n"); + sb + .append(" restrictSearchableAttributes: ") + .append(toIndentedString(restrictSearchableAttributes)) + .append("\n"); sb.append(" ranking: ").append(toIndentedString(ranking)).append("\n"); - sb.append(" customRanking: ").append(toIndentedString(customRanking)).append("\n"); - sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); - sb.append(" attributesToHighlight: ").append(toIndentedString(attributesToHighlight)).append("\n"); - sb.append(" attributesToSnippet: ").append(toIndentedString(attributesToSnippet)).append("\n"); - sb.append(" highlightPreTag: ").append(toIndentedString(highlightPreTag)).append("\n"); - sb.append(" highlightPostTag: ").append(toIndentedString(highlightPostTag)).append("\n"); - sb.append(" snippetEllipsisText: ").append(toIndentedString(snippetEllipsisText)).append("\n"); - sb.append(" restrictHighlightAndSnippetArrays: ").append(toIndentedString(restrictHighlightAndSnippetArrays)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); - sb.append(" minWordSizefor1Typo: ").append(toIndentedString(minWordSizefor1Typo)).append("\n"); - sb.append(" minWordSizefor2Typos: ").append(toIndentedString(minWordSizefor2Typos)).append("\n"); - sb.append(" typoTolerance: ").append(toIndentedString(typoTolerance)).append("\n"); - sb.append(" allowTyposOnNumericTokens: ").append(toIndentedString(allowTyposOnNumericTokens)).append("\n"); - sb.append(" disableTypoToleranceOnAttributes: ").append(toIndentedString(disableTypoToleranceOnAttributes)).append("\n"); - sb.append(" separatorsToIndex: ").append(toIndentedString(separatorsToIndex)).append("\n"); - sb.append(" ignorePlurals: ").append(toIndentedString(ignorePlurals)).append("\n"); - sb.append(" removeStopWords: ").append(toIndentedString(removeStopWords)).append("\n"); - sb.append(" keepDiacriticsOnCharacters: ").append(toIndentedString(keepDiacriticsOnCharacters)).append("\n"); - sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); - sb.append(" decompoundQuery: ").append(toIndentedString(decompoundQuery)).append("\n"); - sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); - sb.append(" enablePersonalization: ").append(toIndentedString(enablePersonalization)).append("\n"); - sb.append(" queryType: ").append(toIndentedString(queryType)).append("\n"); - sb.append(" removeWordsIfNoResults: ").append(toIndentedString(removeWordsIfNoResults)).append("\n"); - sb.append(" advancedSyntax: ").append(toIndentedString(advancedSyntax)).append("\n"); - sb.append(" optionalWords: ").append(toIndentedString(optionalWords)).append("\n"); - sb.append(" disableExactOnAttributes: ").append(toIndentedString(disableExactOnAttributes)).append("\n"); - sb.append(" exactOnSingleWordQuery: ").append(toIndentedString(exactOnSingleWordQuery)).append("\n"); - sb.append(" alternativesAsExact: ").append(toIndentedString(alternativesAsExact)).append("\n"); - sb.append(" advancedSyntaxFeatures: ").append(toIndentedString(advancedSyntaxFeatures)).append("\n"); + sb + .append(" customRanking: ") + .append(toIndentedString(customRanking)) + .append("\n"); + sb + .append(" relevancyStrictness: ") + .append(toIndentedString(relevancyStrictness)) + .append("\n"); + sb + .append(" attributesToHighlight: ") + .append(toIndentedString(attributesToHighlight)) + .append("\n"); + sb + .append(" attributesToSnippet: ") + .append(toIndentedString(attributesToSnippet)) + .append("\n"); + sb + .append(" highlightPreTag: ") + .append(toIndentedString(highlightPreTag)) + .append("\n"); + sb + .append(" highlightPostTag: ") + .append(toIndentedString(highlightPostTag)) + .append("\n"); + sb + .append(" snippetEllipsisText: ") + .append(toIndentedString(snippetEllipsisText)) + .append("\n"); + sb + .append(" restrictHighlightAndSnippetArrays: ") + .append(toIndentedString(restrictHighlightAndSnippetArrays)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); + sb + .append(" minWordSizefor1Typo: ") + .append(toIndentedString(minWordSizefor1Typo)) + .append("\n"); + sb + .append(" minWordSizefor2Typos: ") + .append(toIndentedString(minWordSizefor2Typos)) + .append("\n"); + sb + .append(" typoTolerance: ") + .append(toIndentedString(typoTolerance)) + .append("\n"); + sb + .append(" allowTyposOnNumericTokens: ") + .append(toIndentedString(allowTyposOnNumericTokens)) + .append("\n"); + sb + .append(" disableTypoToleranceOnAttributes: ") + .append(toIndentedString(disableTypoToleranceOnAttributes)) + .append("\n"); + sb + .append(" separatorsToIndex: ") + .append(toIndentedString(separatorsToIndex)) + .append("\n"); + sb + .append(" ignorePlurals: ") + .append(toIndentedString(ignorePlurals)) + .append("\n"); + sb + .append(" removeStopWords: ") + .append(toIndentedString(removeStopWords)) + .append("\n"); + sb + .append(" keepDiacriticsOnCharacters: ") + .append(toIndentedString(keepDiacriticsOnCharacters)) + .append("\n"); + sb + .append(" queryLanguages: ") + .append(toIndentedString(queryLanguages)) + .append("\n"); + sb + .append(" decompoundQuery: ") + .append(toIndentedString(decompoundQuery)) + .append("\n"); + sb + .append(" enableRules: ") + .append(toIndentedString(enableRules)) + .append("\n"); + sb + .append(" enablePersonalization: ") + .append(toIndentedString(enablePersonalization)) + .append("\n"); + sb + .append(" queryType: ") + .append(toIndentedString(queryType)) + .append("\n"); + sb + .append(" removeWordsIfNoResults: ") + .append(toIndentedString(removeWordsIfNoResults)) + .append("\n"); + sb + .append(" advancedSyntax: ") + .append(toIndentedString(advancedSyntax)) + .append("\n"); + sb + .append(" optionalWords: ") + .append(toIndentedString(optionalWords)) + .append("\n"); + sb + .append(" disableExactOnAttributes: ") + .append(toIndentedString(disableExactOnAttributes)) + .append("\n"); + sb + .append(" exactOnSingleWordQuery: ") + .append(toIndentedString(exactOnSingleWordQuery)) + .append("\n"); + sb + .append(" alternativesAsExact: ") + .append(toIndentedString(alternativesAsExact)) + .append("\n"); + sb + .append(" advancedSyntaxFeatures: ") + .append(toIndentedString(advancedSyntaxFeatures)) + .append("\n"); sb.append(" distinct: ").append(toIndentedString(distinct)).append("\n"); sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); - sb.append(" replaceSynonymsInHighlight: ").append(toIndentedString(replaceSynonymsInHighlight)).append("\n"); - sb.append(" minProximity: ").append(toIndentedString(minProximity)).append("\n"); - sb.append(" responseFields: ").append(toIndentedString(responseFields)).append("\n"); - sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); - sb.append(" attributeCriteriaComputedByMinProximity: ").append(toIndentedString(attributeCriteriaComputedByMinProximity)).append("\n"); - sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb + .append(" replaceSynonymsInHighlight: ") + .append(toIndentedString(replaceSynonymsInHighlight)) + .append("\n"); + sb + .append(" minProximity: ") + .append(toIndentedString(minProximity)) + .append("\n"); + sb + .append(" responseFields: ") + .append(toIndentedString(responseFields)) + .append("\n"); + sb + .append(" maxFacetHits: ") + .append(toIndentedString(maxFacetHits)) + .append("\n"); + sb + .append(" attributeCriteriaComputedByMinProximity: ") + .append(toIndentedString(attributeCriteriaComputedByMinProximity)) + .append("\n"); + sb + .append(" renderingContent: ") + .append(toIndentedString(renderingContent)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -2813,6 +3236,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index 13e72e973b..ab4338b8be 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.algolia.model.BaseSearchResponse; import com.algolia.model.BaseSearchResponseFacetsStats; import com.algolia.model.Record; @@ -28,284 +25,305 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** * SearchResponse */ public class SearchResponse { + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) private Integer abTestID; - public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = + "abTestVariantID"; + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng; - public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = "automaticRadius"; + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = + "automaticRadius"; + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) private String automaticRadius; - public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = + "exhaustiveFacetsCount"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = + "exhaustiveNbHits"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) private Boolean exhaustiveTypo; public static final String SERIALIZED_NAME_FACETS = "facets"; + @SerializedName(SERIALIZED_NAME_FACETS) private Map> facets = null; public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + @SerializedName(SERIALIZED_NAME_FACETS_STATS) private Map facetsStats = null; public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; public static final String SERIALIZED_NAME_INDEX = "index"; + @SerializedName(SERIALIZED_NAME_INDEX) private String index; public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + @SerializedName(SERIALIZED_NAME_INDEX_USED) private String indexUsed; public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + @SerializedName(SERIALIZED_NAME_NB_HITS) private Integer nbHits; public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) private Integer nbSortedHits; public static final String SERIALIZED_NAME_PAGE = "page"; + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; public static final String SERIALIZED_NAME_PARAMS = "params"; + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) private String parsedQuery; - public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = + "processingTimeMS"; + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = + "queryAfterRemoval"; + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + @SerializedName(SERIALIZED_NAME_SERVER_USED) private String serverUsed; public static final String SERIALIZED_NAME_USER_DATA = "userData"; + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; public static final String SERIALIZED_NAME_HITS = "hits"; + @SerializedName(SERIALIZED_NAME_HITS) private List hits = new ArrayList<>(); - public SearchResponse abTestID(Integer abTestID) { - this.abTestID = abTestID; return this; } - /** + /** * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. * @return abTestID - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID.") - + @ApiModelProperty( + value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." + ) public Integer getAbTestID() { return abTestID; } - public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } - public SearchResponse abTestVariantID(Integer abTestVariantID) { - this.abTestVariantID = abTestVariantID; return this; } - /** + /** * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. * @return abTestVariantID - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used.") - + @ApiModelProperty( + value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." + ) public Integer getAbTestVariantID() { return abTestVariantID; } - public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } - public SearchResponse aroundLatLng(String aroundLatLng) { - this.aroundLatLng = aroundLatLng; return this; } - /** + /** * The computed geo location. * @return aroundLatLng - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") - public String getAroundLatLng() { return aroundLatLng; } - public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } - public SearchResponse automaticRadius(String automaticRadius) { - this.automaticRadius = automaticRadius; return this; } - /** + /** * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. * @return automaticRadius - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer.") - + @ApiModelProperty( + value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." + ) public String getAutomaticRadius() { return automaticRadius; } - public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } - public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { - this.exhaustiveFacetsCount = exhaustiveFacetsCount; return this; } - /** + /** * Whether the facet count is exhaustive or approximate. * @return exhaustiveFacetsCount - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Whether the facet count is exhaustive or approximate.") - + @ApiModelProperty( + value = "Whether the facet count is exhaustive or approximate." + ) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } - public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } - public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { - this.exhaustiveNbHits = exhaustiveNbHits; return this; } - /** + /** * Indicate if the nbHits count was exhaustive or approximate * @return exhaustiveNbHits - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Indicate if the nbHits count was exhaustive or approximate") - + @ApiModelProperty( + required = true, + value = "Indicate if the nbHits count was exhaustive or approximate" + ) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } - public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } - public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { - this.exhaustiveTypo = exhaustiveTypo; return this; } - /** + /** * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) * @return exhaustiveTypo - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)") - + @ApiModelProperty( + required = true, + value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" + ) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } - public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } - public SearchResponse facets(Map> facets) { - this.facets = facets; return this; } - public SearchResponse putFacetsItem(String key, Map facetsItem) { + public SearchResponse putFacetsItem( + String key, + Map facetsItem + ) { if (this.facets == null) { this.facets = new HashMap<>(); } @@ -313,30 +331,34 @@ public SearchResponse putFacetsItem(String key, Map facetsItem) return this; } - /** + /** * A mapping of each facet name to the corresponding facet counts. * @return facets - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts.") - + @ApiModelProperty( + example = "{\"category\":{\"food\":1,\"tech\":42}}", + value = "A mapping of each facet name to the corresponding facet counts." + ) public Map> getFacets() { return facets; } - public void setFacets(Map> facets) { this.facets = facets; } - - public SearchResponse facetsStats(Map facetsStats) { - + public SearchResponse facetsStats( + Map facetsStats + ) { this.facetsStats = facetsStats; return this; } - public SearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsStats facetsStatsItem) { + public SearchResponse putFacetsStatsItem( + String key, + BaseSearchResponseFacetsStats facetsStatsItem + ) { if (this.facetsStats == null) { this.facetsStats = new HashMap<>(); } @@ -344,347 +366,320 @@ public SearchResponse putFacetsStatsItem(String key, BaseSearchResponseFacetsSta return this; } - /** + /** * Statistics for numerical facets. * @return facetsStats - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") - public Map getFacetsStats() { return facetsStats; } - - public void setFacetsStats(Map facetsStats) { + public void setFacetsStats( + Map facetsStats + ) { this.facetsStats = facetsStats; } - public SearchResponse hitsPerPage(Integer hitsPerPage) { - this.hitsPerPage = hitsPerPage; return this; } - /** + /** * Set the number of hits per page. * @return hitsPerPage - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") - public Integer getHitsPerPage() { return hitsPerPage; } - public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } - public SearchResponse index(String index) { - this.index = index; return this; } - /** + /** * Index name used for the query. * @return index - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "indexName", value = "Index name used for the query.") - + @ApiModelProperty( + example = "indexName", + value = "Index name used for the query." + ) public String getIndex() { return index; } - public void setIndex(String index) { this.index = index; } - public SearchResponse indexUsed(String indexUsed) { - this.indexUsed = indexUsed; return this; } - /** + /** * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. * @return indexUsed - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query.") - + @ApiModelProperty( + example = "indexNameAlt", + value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." + ) public String getIndexUsed() { return indexUsed; } - public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } - public SearchResponse message(String message) { - this.message = message; return this; } - /** + /** * Used to return warnings about the query. * @return message - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - public SearchResponse nbHits(Integer nbHits) { - this.nbHits = nbHits; return this; } - /** + /** * Number of hits that the search query matched * @return nbHits - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "20", required = true, value = "Number of hits that the search query matched") - + @ApiModelProperty( + example = "20", + required = true, + value = "Number of hits that the search query matched" + ) public Integer getNbHits() { return nbHits; } - public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } - public SearchResponse nbPages(Integer nbPages) { - this.nbPages = nbPages; return this; } - /** + /** * Number of pages available for the current query * @return nbPages - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "1", required = true, value = "Number of pages available for the current query") - + @ApiModelProperty( + example = "1", + required = true, + value = "Number of pages available for the current query" + ) public Integer getNbPages() { return nbPages; } - public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } - public SearchResponse nbSortedHits(Integer nbSortedHits) { - this.nbSortedHits = nbSortedHits; return this; } - /** + /** * The number of hits selected and sorted by the relevant sort algorithm * @return nbSortedHits - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm") - + @ApiModelProperty( + example = "20", + value = "The number of hits selected and sorted by the relevant sort algorithm" + ) public Integer getNbSortedHits() { return nbSortedHits; } - public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } - public SearchResponse page(Integer page) { - this.page = page; return this; } - /** + /** * Specify the page to retrieve. * @return page - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") - public Integer getPage() { return page; } - public void setPage(Integer page) { this.page = page; } - public SearchResponse params(String params) { - this.params = params; return this; } - /** + /** * A url-encoded string of all search parameters. * @return params - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "query=a&hitsPerPage=20", required = true, value = "A url-encoded string of all search parameters.") - + @ApiModelProperty( + example = "query=a&hitsPerPage=20", + required = true, + value = "A url-encoded string of all search parameters." + ) public String getParams() { return params; } - public void setParams(String params) { this.params = params; } - public SearchResponse parsedQuery(String parsedQuery) { - this.parsedQuery = parsedQuery; return this; } - /** + /** * The query string that will be searched, after normalization. * @return parsedQuery - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The query string that will be searched, after normalization.") - + @ApiModelProperty( + value = "The query string that will be searched, after normalization." + ) public String getParsedQuery() { return parsedQuery; } - public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } - public SearchResponse processingTimeMS(Integer processingTimeMS) { - this.processingTimeMS = processingTimeMS; return this; } - /** + /** * Time the server took to process the request, in milliseconds. * @return processingTimeMS - **/ + **/ @javax.annotation.Nonnull - @ApiModelProperty(example = "20", required = true, value = "Time the server took to process the request, in milliseconds.") - + @ApiModelProperty( + example = "20", + required = true, + value = "Time the server took to process the request, in milliseconds." + ) public Integer getProcessingTimeMS() { return processingTimeMS; } - public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } - public SearchResponse query(String query) { - this.query = query; return this; } - /** + /** * The text to search in the index. * @return query - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - public String getQuery() { return query; } - public void setQuery(String query) { this.query = query; } - public SearchResponse queryAfterRemoval(String queryAfterRemoval) { - this.queryAfterRemoval = queryAfterRemoval; return this; } - /** + /** * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. * @return queryAfterRemoval - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set.") - + @ApiModelProperty( + value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." + ) public String getQueryAfterRemoval() { return queryAfterRemoval; } - public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } - public SearchResponse serverUsed(String serverUsed) { - this.serverUsed = serverUsed; return this; } - /** + /** * Actual host name of the server that processed the request. * @return serverUsed - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Actual host name of the server that processed the request.") - + @ApiModelProperty( + value = "Actual host name of the server that processed the request." + ) public String getServerUsed() { return serverUsed; } - public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } - public SearchResponse userData(Map userData) { - this.userData = userData; return this; } @@ -697,25 +692,21 @@ public SearchResponse putUserDataItem(String key, Object userDataItem) { return this; } - /** + /** * Lets you store custom data in your indices. * @return userData - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - public Map getUserData() { return userData; } - public void setUserData(Map userData) { this.userData = userData; } - public SearchResponse hits(List hits) { - this.hits = hits; return this; } @@ -725,23 +716,20 @@ public SearchResponse addHitsItem(Record hitsItem) { return this; } - /** + /** * Get hits * @return hits - **/ + **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - public List getHits() { return hits; } - public void setHits(List hits) { this.hits = hits; } - @Override public boolean equals(Object o) { if (this == o) { @@ -751,36 +739,70 @@ public boolean equals(Object o) { return false; } SearchResponse searchResponse = (SearchResponse) o; - return Objects.equals(this.abTestID, searchResponse.abTestID) && - Objects.equals(this.abTestVariantID, searchResponse.abTestVariantID) && - Objects.equals(this.aroundLatLng, searchResponse.aroundLatLng) && - Objects.equals(this.automaticRadius, searchResponse.automaticRadius) && - Objects.equals(this.exhaustiveFacetsCount, searchResponse.exhaustiveFacetsCount) && - Objects.equals(this.exhaustiveNbHits, searchResponse.exhaustiveNbHits) && - Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && - Objects.equals(this.facets, searchResponse.facets) && - Objects.equals(this.facetsStats, searchResponse.facetsStats) && - Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && - Objects.equals(this.index, searchResponse.index) && - Objects.equals(this.indexUsed, searchResponse.indexUsed) && - Objects.equals(this.message, searchResponse.message) && - Objects.equals(this.nbHits, searchResponse.nbHits) && - Objects.equals(this.nbPages, searchResponse.nbPages) && - Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && - Objects.equals(this.page, searchResponse.page) && - Objects.equals(this.params, searchResponse.params) && - Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && - Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && - Objects.equals(this.query, searchResponse.query) && - Objects.equals(this.queryAfterRemoval, searchResponse.queryAfterRemoval) && - Objects.equals(this.serverUsed, searchResponse.serverUsed) && - Objects.equals(this.userData, searchResponse.userData) && - Objects.equals(this.hits, searchResponse.hits); + return ( + Objects.equals(this.abTestID, searchResponse.abTestID) && + Objects.equals(this.abTestVariantID, searchResponse.abTestVariantID) && + Objects.equals(this.aroundLatLng, searchResponse.aroundLatLng) && + Objects.equals(this.automaticRadius, searchResponse.automaticRadius) && + Objects.equals( + this.exhaustiveFacetsCount, + searchResponse.exhaustiveFacetsCount + ) && + Objects.equals(this.exhaustiveNbHits, searchResponse.exhaustiveNbHits) && + Objects.equals(this.exhaustiveTypo, searchResponse.exhaustiveTypo) && + Objects.equals(this.facets, searchResponse.facets) && + Objects.equals(this.facetsStats, searchResponse.facetsStats) && + Objects.equals(this.hitsPerPage, searchResponse.hitsPerPage) && + Objects.equals(this.index, searchResponse.index) && + Objects.equals(this.indexUsed, searchResponse.indexUsed) && + Objects.equals(this.message, searchResponse.message) && + Objects.equals(this.nbHits, searchResponse.nbHits) && + Objects.equals(this.nbPages, searchResponse.nbPages) && + Objects.equals(this.nbSortedHits, searchResponse.nbSortedHits) && + Objects.equals(this.page, searchResponse.page) && + Objects.equals(this.params, searchResponse.params) && + Objects.equals(this.parsedQuery, searchResponse.parsedQuery) && + Objects.equals(this.processingTimeMS, searchResponse.processingTimeMS) && + Objects.equals(this.query, searchResponse.query) && + Objects.equals( + this.queryAfterRemoval, + searchResponse.queryAfterRemoval + ) && + Objects.equals(this.serverUsed, searchResponse.serverUsed) && + Objects.equals(this.userData, searchResponse.userData) && + Objects.equals(this.hits, searchResponse.hits) + ); } @Override public int hashCode() { - return Objects.hash(abTestID, abTestVariantID, aroundLatLng, automaticRadius, exhaustiveFacetsCount, exhaustiveNbHits, exhaustiveTypo, facets, facetsStats, hitsPerPage, index, indexUsed, message, nbHits, nbPages, nbSortedHits, page, params, parsedQuery, processingTimeMS, query, queryAfterRemoval, serverUsed, userData, hits); + return Objects.hash( + abTestID, + abTestVariantID, + aroundLatLng, + automaticRadius, + exhaustiveFacetsCount, + exhaustiveNbHits, + exhaustiveTypo, + facets, + facetsStats, + hitsPerPage, + index, + indexUsed, + message, + nbHits, + nbPages, + nbSortedHits, + page, + params, + parsedQuery, + processingTimeMS, + query, + queryAfterRemoval, + serverUsed, + userData, + hits + ); } @Override @@ -788,28 +810,70 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SearchResponse {\n"); sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); - sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); - sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); - sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); - sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); - sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); - sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); + sb + .append(" abTestVariantID: ") + .append(toIndentedString(abTestVariantID)) + .append("\n"); + sb + .append(" aroundLatLng: ") + .append(toIndentedString(aroundLatLng)) + .append("\n"); + sb + .append(" automaticRadius: ") + .append(toIndentedString(automaticRadius)) + .append("\n"); + sb + .append(" exhaustiveFacetsCount: ") + .append(toIndentedString(exhaustiveFacetsCount)) + .append("\n"); + sb + .append(" exhaustiveNbHits: ") + .append(toIndentedString(exhaustiveNbHits)) + .append("\n"); + sb + .append(" exhaustiveTypo: ") + .append(toIndentedString(exhaustiveTypo)) + .append("\n"); sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); - sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); - sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb + .append(" facetsStats: ") + .append(toIndentedString(facetsStats)) + .append("\n"); + sb + .append(" hitsPerPage: ") + .append(toIndentedString(hitsPerPage)) + .append("\n"); sb.append(" index: ").append(toIndentedString(index)).append("\n"); - sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); + sb + .append(" indexUsed: ") + .append(toIndentedString(indexUsed)) + .append("\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); - sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); + sb + .append(" nbSortedHits: ") + .append(toIndentedString(nbSortedHits)) + .append("\n"); sb.append(" page: ").append(toIndentedString(page)).append("\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); - sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); - sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb + .append(" parsedQuery: ") + .append(toIndentedString(parsedQuery)) + .append("\n"); + sb + .append(" processingTimeMS: ") + .append(toIndentedString(processingTimeMS)) + .append("\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); - sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); - sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); + sb + .append(" queryAfterRemoval: ") + .append(toIndentedString(queryAfterRemoval)) + .append("\n"); + sb + .append(" serverUsed: ") + .append(toIndentedString(serverUsed)) + .append("\n"); sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); sb.append("}"); @@ -826,6 +890,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 2b7b7cfa3f..8ad15e0b56 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -24,67 +21,63 @@ import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Objects; /** * SetSettingsResponse */ public class SetSettingsResponse { + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; - public SetSettingsResponse taskID(Integer taskID) { - this.taskID = taskID; return this; } - /** + /** * taskID of the indexing task to wait for. * @return taskID - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - public Integer getTaskID() { return taskID; } - public void setTaskID(Integer taskID) { this.taskID = taskID; } - public SetSettingsResponse updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; return this; } - /** + /** * Date of last update (ISO-8601 format). * @return updatedAt - **/ + **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - public OffsetDateTime getUpdatedAt() { return updatedAt; } - public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } - @Override public boolean equals(Object o) { if (this == o) { @@ -94,8 +87,10 @@ public boolean equals(Object o) { return false; } SetSettingsResponse setSettingsResponse = (SetSettingsResponse) o; - return Objects.equals(this.taskID, setSettingsResponse.taskID) && - Objects.equals(this.updatedAt, setSettingsResponse.updatedAt); + return ( + Objects.equals(this.taskID, setSettingsResponse.taskID) && + Objects.equals(this.updatedAt, setSettingsResponse.updatedAt) + ); } @Override @@ -108,7 +103,10 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SetSettingsResponse {\n"); sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -123,6 +121,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java index f7cebe6092..e704f86d0c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -3,18 +3,15 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.model; -import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -23,13 +20,17 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; /** * SnippetResult */ public class SnippetResult { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) private String value; @@ -39,9 +40,9 @@ public class SnippetResult { @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), - + PARTIAL("partial"), - + FULL("full"); private String value; @@ -69,70 +70,72 @@ public static MatchLevelEnum fromValue(String value) { } public static class Adapter extends TypeAdapter { + @Override - public void write(final JsonWriter jsonWriter, final MatchLevelEnum enumeration) throws IOException { + public void write( + final JsonWriter jsonWriter, + final MatchLevelEnum enumeration + ) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public MatchLevelEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); + public MatchLevelEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); return MatchLevelEnum.fromValue(value); } } } public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) private MatchLevelEnum matchLevel; - public SnippetResult value(String value) { - this.value = value; return this; } - /** + /** * Markup text with occurrences highlighted. * @return value - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(example = "George Clooney...", value = "Markup text with occurrences highlighted.") - + @ApiModelProperty( + example = "George Clooney...", + value = "Markup text with occurrences highlighted." + ) public String getValue() { return value; } - public void setValue(String value) { this.value = value; } - public SnippetResult matchLevel(MatchLevelEnum matchLevel) { - this.matchLevel = matchLevel; return this; } - /** + /** * Indicates how well the attribute matched the search query. * @return matchLevel - **/ + **/ @javax.annotation.Nullable - @ApiModelProperty(value = "Indicates how well the attribute matched the search query.") - + @ApiModelProperty( + value = "Indicates how well the attribute matched the search query." + ) public MatchLevelEnum getMatchLevel() { return matchLevel; } - public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } - @Override public boolean equals(Object o) { if (this == o) { @@ -142,8 +145,10 @@ public boolean equals(Object o) { return false; } SnippetResult snippetResult = (SnippetResult) o; - return Objects.equals(this.value, snippetResult.value) && - Objects.equals(this.matchLevel, snippetResult.matchLevel); + return ( + Objects.equals(this.value, snippetResult.value) && + Objects.equals(this.matchLevel, snippetResult.matchLevel) + ); } @Override @@ -156,7 +161,10 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SnippetResult {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).append("\n"); + sb + .append(" matchLevel: ") + .append(toIndentedString(matchLevel)) + .append("\n"); sb.append("}"); return sb.toString(); } @@ -171,6 +179,4 @@ private String toIndentedString(Object o) { } return o.toString().replace("\n", "\n "); } - } - diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 888b037706..8111a12c75 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -3,14 +3,13 @@ * API powering the Search feature of Algolia. * * The version of the OpenAPI document: 0.1.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 com.algolia.search; import com.algolia.ApiCallback; @@ -21,12 +20,6 @@ import com.algolia.Pair; import com.algolia.ProgressRequestBody; import com.algolia.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; import com.algolia.model.DeleteIndexResponse; @@ -41,7 +34,8 @@ import com.algolia.model.SearchParams; import com.algolia.model.SearchResponse; import com.algolia.model.SetSettingsResponse; - +import com.google.gson.reflect.TypeToken; +import java.io.IOException; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -49,25 +43,26 @@ import java.util.Map; public class SearchApi { - private ApiClient localVarApiClient; - public SearchApi() { - this(Configuration.getDefaultApiClient()); - } + private ApiClient localVarApiClient; - public SearchApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } + public SearchApi() { + this(Configuration.getDefaultApiClient()); + } - public ApiClient getApiClient() { - return localVarApiClient; - } + public SearchApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } + public ApiClient getApiClient() { + return localVarApiClient; + } - /** + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + /** * Build call for batch * @param indexName The index in which to perform the request. (required) * @param batchObject (required) @@ -84,57 +79,80 @@ public void setApiClient(ApiClient apiClient) { 404 Index not found. - */ - public okhttp3.Call batchCall(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = batchObject; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}/batch" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call batchCall( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = batchObject; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/batch".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call batchValidateBeforeCall(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling batch(Async)"); - } - - // verify the required parameter 'batchObject' is set - if (batchObject == null) { - throw new ApiException("Missing the required parameter 'batchObject' when calling batch(Async)"); - } - - - okhttp3.Call localVarCall = batchCall(indexName, batchObject, _callback); - return localVarCall; + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call batchValidateBeforeCall( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling batch(Async)" + ); + } + // verify the required parameter 'batchObject' is set + if (batchObject == null) { + throw new ApiException( + "Missing the required parameter 'batchObject' when calling batch(Async)" + ); } - /** + okhttp3.Call localVarCall = batchCall(indexName, batchObject, _callback); + return localVarCall; + } + + /** * * Performs multiple write operations in a single API call. * @param indexName The index in which to perform the request. (required) @@ -151,12 +169,16 @@ private okhttp3.Call batchValidateBeforeCall(String indexName, BatchObject batch 404 Index not found. - */ - public BatchResponse batch(String indexName, BatchObject batchObject) throws ApiException { - ApiResponse localVarResp = batchWithHttpInfo(indexName, batchObject); - return localVarResp.getData(); - } - - /** + public BatchResponse batch(String indexName, BatchObject batchObject) + throws ApiException { + ApiResponse localVarResp = batchWithHttpInfo( + indexName, + batchObject + ); + return localVarResp.getData(); + } + + /** * * Performs multiple write operations in a single API call. * @param indexName The index in which to perform the request. (required) @@ -173,13 +195,20 @@ public BatchResponse batch(String indexName, BatchObject batchObject) throws Api 404 Index not found. - */ - public ApiResponse batchWithHttpInfo(String indexName, BatchObject batchObject) throws ApiException { - okhttp3.Call localVarCall = batchValidateBeforeCall(indexName, batchObject, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse batchWithHttpInfo( + String indexName, + BatchObject batchObject + ) throws ApiException { + okhttp3.Call localVarCall = batchValidateBeforeCall( + indexName, + batchObject, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Performs multiple write operations in a single API call. * @param indexName The index in which to perform the request. (required) @@ -197,14 +226,22 @@ public ApiResponse batchWithHttpInfo(String indexName, BatchObjec 404 Index not found. - */ - public okhttp3.Call batchAsync(String indexName, BatchObject batchObject, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = batchValidateBeforeCall(indexName, batchObject, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call batchAsync( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = batchValidateBeforeCall( + indexName, + batchObject, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for deleteIndex * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress @@ -220,52 +257,71 @@ public okhttp3.Call batchAsync(String indexName, BatchObject batchObject, final 404 Index not found. - */ - public okhttp3.Call deleteIndexCall(String indexName, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call deleteIndexCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call deleteIndexValidateBeforeCall(String indexName, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling deleteIndex(Async)"); - } - - - okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); - return localVarCall; - + final String[] localVarContentTypes = {}; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteIndexValidateBeforeCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling deleteIndex(Async)" + ); } - /** + okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); + return localVarCall; + } + + /** * Delete index. * Delete an existing index. * @param indexName The index in which to perform the request. (required) @@ -281,12 +337,14 @@ private okhttp3.Call deleteIndexValidateBeforeCall(String indexName, final ApiCa 404 Index not found. - */ - public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { - ApiResponse localVarResp = deleteIndexWithHttpInfo(indexName); - return localVarResp.getData(); - } - - /** + public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { + ApiResponse localVarResp = deleteIndexWithHttpInfo( + indexName + ); + return localVarResp.getData(); + } + + /** * Delete index. * Delete an existing index. * @param indexName The index in which to perform the request. (required) @@ -302,13 +360,15 @@ public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { 404 Index not found. - */ - public ApiResponse deleteIndexWithHttpInfo(String indexName) throws ApiException { - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse deleteIndexWithHttpInfo( + String indexName + ) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * Delete index. (asynchronously) * Delete an existing index. * @param indexName The index in which to perform the request. (required) @@ -325,14 +385,20 @@ public ApiResponse deleteIndexWithHttpInfo(String indexName 404 Index not found. - */ - public okhttp3.Call deleteIndexAsync(String indexName, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call deleteIndexAsync( + String indexName, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall( + indexName, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for getSettings * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress @@ -348,52 +414,71 @@ public okhttp3.Call deleteIndexAsync(String indexName, final ApiCallback 404 Index not found. - */ - public okhttp3.Call getSettingsCall(String indexName, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}/settings" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call getSettingsCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/settings".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingsValidateBeforeCall(String indexName, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling getSettings(Async)"); - } - - - okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); - return localVarCall; - + final String[] localVarContentTypes = {}; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSettingsValidateBeforeCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling getSettings(Async)" + ); } - /** + okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); + return localVarCall; + } + + /** * * Retrieve settings of a given indexName. * @param indexName The index in which to perform the request. (required) @@ -409,12 +494,14 @@ private okhttp3.Call getSettingsValidateBeforeCall(String indexName, final ApiCa 404 Index not found. - */ - public IndexSettings getSettings(String indexName) throws ApiException { - ApiResponse localVarResp = getSettingsWithHttpInfo(indexName); - return localVarResp.getData(); - } - - /** + public IndexSettings getSettings(String indexName) throws ApiException { + ApiResponse localVarResp = getSettingsWithHttpInfo( + indexName + ); + return localVarResp.getData(); + } + + /** * * Retrieve settings of a given indexName. * @param indexName The index in which to perform the request. (required) @@ -430,13 +517,14 @@ public IndexSettings getSettings(String indexName) throws ApiException { 404 Index not found. - */ - public ApiResponse getSettingsWithHttpInfo(String indexName) throws ApiException { - okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse getSettingsWithHttpInfo(String indexName) + throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Retrieve settings of a given indexName. * @param indexName The index in which to perform the request. (required) @@ -453,14 +541,20 @@ public ApiResponse getSettingsWithHttpInfo(String indexName) thro 404 Index not found. - */ - public okhttp3.Call getSettingsAsync(String indexName, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call getSettingsAsync( + String indexName, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall( + indexName, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for listIndices * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) * @param _callback Callback for upload/download progress @@ -476,50 +570,66 @@ public okhttp3.Call getSettingsAsync(String indexName, final ApiCallback 404 Index not found. - */ - public okhttp3.Call listIndicesCall(Integer page, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/1/indexes"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (page != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("Page", page)); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call listIndicesCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("Page", page) + ); } - @SuppressWarnings("rawtypes") - private okhttp3.Call listIndicesValidateBeforeCall(Integer page, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = listIndicesCall(page, _callback); - return localVarCall; - + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - /** + final String[] localVarContentTypes = {}; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listIndicesValidateBeforeCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesCall(page, _callback); + return localVarCall; + } + + /** * List existing indexes. * List existing indexes from an application. * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) @@ -535,12 +645,14 @@ private okhttp3.Call listIndicesValidateBeforeCall(Integer page, final ApiCallba 404 Index not found. - */ - public ListIndicesResponse listIndices(Integer page) throws ApiException { - ApiResponse localVarResp = listIndicesWithHttpInfo(page); - return localVarResp.getData(); - } - - /** + public ListIndicesResponse listIndices(Integer page) throws ApiException { + ApiResponse localVarResp = listIndicesWithHttpInfo( + page + ); + return localVarResp.getData(); + } + + /** * List existing indexes. * List existing indexes from an application. * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) @@ -556,13 +668,14 @@ public ListIndicesResponse listIndices(Integer page) throws ApiException { 404 Index not found. - */ - public ApiResponse listIndicesWithHttpInfo(Integer page) throws ApiException { - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse listIndicesWithHttpInfo(Integer page) + throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * List existing indexes. (asynchronously) * List existing indexes from an application. * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) @@ -579,14 +692,17 @@ public ApiResponse listIndicesWithHttpInfo(Integer page) th 404 Index not found. - */ - public okhttp3.Call listIndicesAsync(Integer page, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call listIndicesAsync( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for multipleQueries * @param multipleQueriesObject (required) * @param _callback Callback for upload/download progress @@ -602,51 +718,70 @@ public okhttp3.Call listIndicesAsync(Integer page, final ApiCallback 404 Index not found. - */ - public okhttp3.Call multipleQueriesCall(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = multipleQueriesObject; - - // create path and map variables - String localVarPath = "/1/indexes/*/queries"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call multipleQueriesCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = multipleQueriesObject; + + // create path and map variables + String localVarPath = "/1/indexes/*/queries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call multipleQueriesValidateBeforeCall(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'multipleQueriesObject' is set - if (multipleQueriesObject == null) { - throw new ApiException("Missing the required parameter 'multipleQueriesObject' when calling multipleQueries(Async)"); - } - - - okhttp3.Call localVarCall = multipleQueriesCall(multipleQueriesObject, _callback); - return localVarCall; - + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call multipleQueriesValidateBeforeCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'multipleQueriesObject' is set + if (multipleQueriesObject == null) { + throw new ApiException( + "Missing the required parameter 'multipleQueriesObject' when calling multipleQueries(Async)" + ); } - /** + okhttp3.Call localVarCall = multipleQueriesCall( + multipleQueriesObject, + _callback + ); + return localVarCall; + } + + /** * * Get search results for the given requests. * @param multipleQueriesObject (required) @@ -662,12 +797,16 @@ private okhttp3.Call multipleQueriesValidateBeforeCall(MultipleQueriesObject mul 404 Index not found. - */ - public MultipleQueriesResponse multipleQueries(MultipleQueriesObject multipleQueriesObject) throws ApiException { - ApiResponse localVarResp = multipleQueriesWithHttpInfo(multipleQueriesObject); - return localVarResp.getData(); - } - - /** + public MultipleQueriesResponse multipleQueries( + MultipleQueriesObject multipleQueriesObject + ) throws ApiException { + ApiResponse localVarResp = multipleQueriesWithHttpInfo( + multipleQueriesObject + ); + return localVarResp.getData(); + } + + /** * * Get search results for the given requests. * @param multipleQueriesObject (required) @@ -683,13 +822,19 @@ public MultipleQueriesResponse multipleQueries(MultipleQueriesObject multipleQue 404 Index not found. - */ - public ApiResponse multipleQueriesWithHttpInfo(MultipleQueriesObject multipleQueriesObject) throws ApiException { - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse multipleQueriesWithHttpInfo( + MultipleQueriesObject multipleQueriesObject + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Get search results for the given requests. * @param multipleQueriesObject (required) @@ -706,14 +851,21 @@ public ApiResponse multipleQueriesWithHttpInfo(Multiple 404 Index not found. - */ - public okhttp3.Call multipleQueriesAsync(MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall(multipleQueriesObject, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call multipleQueriesAsync( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for operationIndex * @param indexName The index in which to perform the request. (required) * @param operationIndexObject (required) @@ -730,57 +882,84 @@ public okhttp3.Call multipleQueriesAsync(MultipleQueriesObject multipleQueriesOb 404 Index not found. - */ - public okhttp3.Call operationIndexCall(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = operationIndexObject; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}/operation" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call operationIndexCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = operationIndexObject; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/operation".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call operationIndexValidateBeforeCall(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling operationIndex(Async)"); - } - - // verify the required parameter 'operationIndexObject' is set - if (operationIndexObject == null) { - throw new ApiException("Missing the required parameter 'operationIndexObject' when calling operationIndex(Async)"); - } - - - okhttp3.Call localVarCall = operationIndexCall(indexName, operationIndexObject, _callback); - return localVarCall; + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call operationIndexValidateBeforeCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling operationIndex(Async)" + ); + } + // verify the required parameter 'operationIndexObject' is set + if (operationIndexObject == null) { + throw new ApiException( + "Missing the required parameter 'operationIndexObject' when calling operationIndex(Async)" + ); } - /** + okhttp3.Call localVarCall = operationIndexCall( + indexName, + operationIndexObject, + _callback + ); + return localVarCall; + } + + /** * Copy/move index. * Peforms a copy or a move operation on a index. * @param indexName The index in which to perform the request. (required) @@ -797,12 +976,18 @@ private okhttp3.Call operationIndexValidateBeforeCall(String indexName, Operatio 404 Index not found. - */ - public OperationIndexResponse operationIndex(String indexName, OperationIndexObject operationIndexObject) throws ApiException { - ApiResponse localVarResp = operationIndexWithHttpInfo(indexName, operationIndexObject); - return localVarResp.getData(); - } - - /** + public OperationIndexResponse operationIndex( + String indexName, + OperationIndexObject operationIndexObject + ) throws ApiException { + ApiResponse localVarResp = operationIndexWithHttpInfo( + indexName, + operationIndexObject + ); + return localVarResp.getData(); + } + + /** * Copy/move index. * Peforms a copy or a move operation on a index. * @param indexName The index in which to perform the request. (required) @@ -819,13 +1004,21 @@ public OperationIndexResponse operationIndex(String indexName, OperationIndexObj 404 Index not found. - */ - public ApiResponse operationIndexWithHttpInfo(String indexName, OperationIndexObject operationIndexObject) throws ApiException { - okhttp3.Call localVarCall = operationIndexValidateBeforeCall(indexName, operationIndexObject, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse operationIndexWithHttpInfo( + String indexName, + OperationIndexObject operationIndexObject + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * Copy/move index. (asynchronously) * Peforms a copy or a move operation on a index. * @param indexName The index in which to perform the request. (required) @@ -843,14 +1036,23 @@ public ApiResponse operationIndexWithHttpInfo(String ind 404 Index not found. - */ - public okhttp3.Call operationIndexAsync(String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = operationIndexValidateBeforeCall(indexName, operationIndexObject, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call operationIndexAsync( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for saveObject * @param indexName The index in which to perform the request. (required) * @param requestBody The Algolia object. (required) @@ -867,57 +1069,84 @@ public okhttp3.Call operationIndexAsync(String indexName, OperationIndexObject o 404 Index not found. - */ - public okhttp3.Call saveObjectCall(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = requestBody; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call saveObjectCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call saveObjectValidateBeforeCall(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling saveObject(Async)"); - } - - // verify the required parameter 'requestBody' is set - if (requestBody == null) { - throw new ApiException("Missing the required parameter 'requestBody' when calling saveObject(Async)"); - } - - - okhttp3.Call localVarCall = saveObjectCall(indexName, requestBody, _callback); - return localVarCall; + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call saveObjectValidateBeforeCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling saveObject(Async)" + ); + } + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException( + "Missing the required parameter 'requestBody' when calling saveObject(Async)" + ); } - /** + okhttp3.Call localVarCall = saveObjectCall( + indexName, + requestBody, + _callback + ); + return localVarCall; + } + + /** * * Add an object to the index, automatically assigning it an object ID. * @param indexName The index in which to perform the request. (required) @@ -934,12 +1163,18 @@ private okhttp3.Call saveObjectValidateBeforeCall(String indexName, Map 404 Index not found. - */ - public SaveObjectResponse saveObject(String indexName, Map requestBody) throws ApiException { - ApiResponse localVarResp = saveObjectWithHttpInfo(indexName, requestBody); - return localVarResp.getData(); - } - - /** + public SaveObjectResponse saveObject( + String indexName, + Map requestBody + ) throws ApiException { + ApiResponse localVarResp = saveObjectWithHttpInfo( + indexName, + requestBody + ); + return localVarResp.getData(); + } + + /** * * Add an object to the index, automatically assigning it an object ID. * @param indexName The index in which to perform the request. (required) @@ -956,13 +1191,20 @@ public SaveObjectResponse saveObject(String indexName, Map reque 404 Index not found. - */ - public ApiResponse saveObjectWithHttpInfo(String indexName, Map requestBody) throws ApiException { - okhttp3.Call localVarCall = saveObjectValidateBeforeCall(indexName, requestBody, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse saveObjectWithHttpInfo( + String indexName, + Map requestBody + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Add an object to the index, automatically assigning it an object ID. * @param indexName The index in which to perform the request. (required) @@ -980,14 +1222,22 @@ public ApiResponse saveObjectWithHttpInfo(String indexName, 404 Index not found. - */ - public okhttp3.Call saveObjectAsync(String indexName, Map requestBody, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = saveObjectValidateBeforeCall(indexName, requestBody, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call saveObjectAsync( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for search * @param indexName The index in which to perform the request. (required) * @param searchParams (required) @@ -1004,57 +1254,80 @@ public okhttp3.Call saveObjectAsync(String indexName, Map reques 404 Index not found. - */ - public okhttp3.Call searchCall(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = searchParams; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}/query" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call searchCall( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = searchParams; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/query".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call searchValidateBeforeCall(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling search(Async)"); - } - - // verify the required parameter 'searchParams' is set - if (searchParams == null) { - throw new ApiException("Missing the required parameter 'searchParams' when calling search(Async)"); - } - - - okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); - return localVarCall; + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchValidateBeforeCall( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling search(Async)" + ); + } + // verify the required parameter 'searchParams' is set + if (searchParams == null) { + throw new ApiException( + "Missing the required parameter 'searchParams' when calling search(Async)" + ); } - /** + okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); + return localVarCall; + } + + /** * * Get search results. * @param indexName The index in which to perform the request. (required) @@ -1071,12 +1344,16 @@ private okhttp3.Call searchValidateBeforeCall(String indexName, SearchParams sea 404 Index not found. - */ - public SearchResponse search(String indexName, SearchParams searchParams) throws ApiException { - ApiResponse localVarResp = searchWithHttpInfo(indexName, searchParams); - return localVarResp.getData(); - } - - /** + public SearchResponse search(String indexName, SearchParams searchParams) + throws ApiException { + ApiResponse localVarResp = searchWithHttpInfo( + indexName, + searchParams + ); + return localVarResp.getData(); + } + + /** * * Get search results. * @param indexName The index in which to perform the request. (required) @@ -1093,13 +1370,20 @@ public SearchResponse search(String indexName, SearchParams searchParams) throws 404 Index not found. - */ - public ApiResponse searchWithHttpInfo(String indexName, SearchParams searchParams) throws ApiException { - okhttp3.Call localVarCall = searchValidateBeforeCall(indexName, searchParams, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse searchWithHttpInfo( + String indexName, + SearchParams searchParams + ) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall( + indexName, + searchParams, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Get search results. * @param indexName The index in which to perform the request. (required) @@ -1117,14 +1401,22 @@ public ApiResponse searchWithHttpInfo(String indexName, SearchPa 404 Index not found. - */ - public okhttp3.Call searchAsync(String indexName, SearchParams searchParams, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = searchValidateBeforeCall(indexName, searchParams, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** + public okhttp3.Call searchAsync( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall( + indexName, + searchParams, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** * Build call for setSettings * @param indexName The index in which to perform the request. (required) * @param indexSettings (required) @@ -1142,61 +1434,96 @@ public okhttp3.Call searchAsync(String indexName, SearchParams searchParams, fin 404 Index not found. - */ - public okhttp3.Call setSettingsCall(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = indexSettings; - - // create path and map variables - String localVarPath = "/1/indexes/{indexName}/settings" - .replaceAll("\\{" + "indexName" + "\\}", localVarApiClient.escapeString(indexName.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (forwardToReplicas != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("forwardToReplicas", forwardToReplicas)); - } - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + public okhttp3.Call setSettingsCall( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = indexSettings; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/settings".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair( + "forwardToReplicas", + forwardToReplicas + ) + ); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } - @SuppressWarnings("rawtypes") - private okhttp3.Call setSettingsValidateBeforeCall(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException("Missing the required parameter 'indexName' when calling setSettings(Async)"); - } - - // verify the required parameter 'indexSettings' is set - if (indexSettings == null) { - throw new ApiException("Missing the required parameter 'indexSettings' when calling setSettings(Async)"); - } - - - okhttp3.Call localVarCall = setSettingsCall(indexName, indexSettings, forwardToReplicas, _callback); - return localVarCall; + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setSettingsValidateBeforeCall( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling setSettings(Async)" + ); + } + // verify the required parameter 'indexSettings' is set + if (indexSettings == null) { + throw new ApiException( + "Missing the required parameter 'indexSettings' when calling setSettings(Async)" + ); } - /** + okhttp3.Call localVarCall = setSettingsCall( + indexName, + indexSettings, + forwardToReplicas, + _callback + ); + return localVarCall; + } + + /** * * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * @param indexName The index in which to perform the request. (required) @@ -1214,12 +1541,20 @@ private okhttp3.Call setSettingsValidateBeforeCall(String indexName, IndexSettin 404 Index not found. - */ - public SetSettingsResponse setSettings(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas) throws ApiException { - ApiResponse localVarResp = setSettingsWithHttpInfo(indexName, indexSettings, forwardToReplicas); - return localVarResp.getData(); - } - - /** + public SetSettingsResponse setSettings( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas + ) throws ApiException { + ApiResponse localVarResp = setSettingsWithHttpInfo( + indexName, + indexSettings, + forwardToReplicas + ); + return localVarResp.getData(); + } + + /** * * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * @param indexName The index in which to perform the request. (required) @@ -1237,13 +1572,22 @@ public SetSettingsResponse setSettings(String indexName, IndexSettings indexSett 404 Index not found. - */ - public ApiResponse setSettingsWithHttpInfo(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas) throws ApiException { - okhttp3.Call localVarCall = setSettingsValidateBeforeCall(indexName, indexSettings, forwardToReplicas, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** + public ApiResponse setSettingsWithHttpInfo( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas + ) throws ApiException { + okhttp3.Call localVarCall = setSettingsValidateBeforeCall( + indexName, + indexSettings, + forwardToReplicas, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** * (asynchronously) * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * @param indexName The index in which to perform the request. (required) @@ -1262,11 +1606,20 @@ public ApiResponse setSettingsWithHttpInfo(String indexName 404 Index not found. - */ - public okhttp3.Call setSettingsAsync(String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = setSettingsValidateBeforeCall(indexName, indexSettings, forwardToReplicas, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } + public okhttp3.Call setSettingsAsync( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = setSettingsValidateBeforeCall( + indexName, + indexSettings, + forwardToReplicas, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/package.json b/package.json index 5d821aedcc..068c7751e8 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "lint:client:fix": "eslint --ext=ts ${CLIENT} --fix", "lint": "eslint --ext=ts .", "format:specs": "yarn prettier --write specs", - "generate:java:search": "yarn openapi-generator-cli generate --generator-key java-search && bash scripts/post-gen-java.sh clients/algoliasearch-client-java-2/", + "generate:java:search": "yarn openapi-generator-cli generate --generator-key java-search && bash scripts/post-gen-java.sh clients/algoliasearch-client-java-2", "generate:js:personalization": "yarn openapi-generator-cli generate --generator-key javascript-personalization && CLIENT=client-personalization yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-personalization/ yarn lint:client:fix", "generate:js:recommend": "yarn openapi-generator-cli generate --generator-key javascript-recommend && CLIENT=recommend yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/recommend/ yarn lint:client:fix", "generate:js:search": "yarn openapi-generator-cli generate --generator-key javascript-search && CLIENT=client-search yarn utils:import-js && CLIENT=clients/algoliasearch-client-javascript/client-search/ yarn lint:client:fix", @@ -58,6 +58,7 @@ "eslint-plugin-prettier": "4.0.0", "eslint-plugin-unused-imports": "2.0.0", "prettier": "2.5.0", + "prettier-plugin-java": "1.6.0", "swagger-cli": "4.0.4", "typescript": "4.5.2" }, diff --git a/scripts/post-gen-java.sh b/scripts/post-gen-java.sh index e473801f45..b74897b482 100644 --- a/scripts/post-gen-java.sh +++ b/scripts/post-gen-java.sh @@ -1,3 +1,7 @@ CLIENT_FOLDER=$1 find $CLIENT_FOLDER -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' + +echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT_FOLDER/algoliasearch-core/com/algolia/model/OneOfintegerstring.java + +prettier --write $CLIENT_FOLDER/**/*.java diff --git a/specs/search/common/schemas/SearchParams.yml b/specs/search/common/schemas/SearchParams.yml index 3c5da1ed24..4a0af449cf 100644 --- a/specs/search/common/schemas/SearchParams.yml +++ b/specs/search/common/schemas/SearchParams.yml @@ -90,7 +90,11 @@ baseSearchParams: default: false aroundRadius: description: Define the maximum radius for a geo search (in meters). - type: integer + oneOf: + - type: integer + minimum: 1 + - type: string + enum: [all] aroundPrecision: type: integer description: Precision of geo search (in meters), to add grouping by geo location to the ranking formula. diff --git a/yarn.lock b/yarn.lock index 218431d335..6bfec0c59f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,6 +23,7 @@ __metadata: eslint-plugin-prettier: 4.0.0 eslint-plugin-unused-imports: 2.0.0 prettier: 2.5.0 + prettier-plugin-java: 1.6.0 swagger-cli: 4.0.4 typescript: 4.5.2 languageName: unknown @@ -1801,6 +1802,15 @@ __metadata: languageName: node linkType: hard +"chevrotain@npm:6.5.0": + version: 6.5.0 + resolution: "chevrotain@npm:6.5.0" + dependencies: + regexp-to-ast: 0.4.0 + checksum: ce03cf3874ae1fd91bb57de753ea313442c7d1be04f59ab126c237062b51f5cb3204e9bdbb1b469973c96c1ce0850e83f909bee14a23bb88a0dbbd964e1c2a9e + languageName: node + linkType: hard + "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -3635,6 +3645,16 @@ fsevents@^2.3.2: languageName: node linkType: hard +"java-parser@npm:2.0.0": + version: 2.0.0 + resolution: "java-parser@npm:2.0.0" + dependencies: + chevrotain: 6.5.0 + lodash: 4.17.21 + checksum: ac2ccd448d0b5d9232927f514279edd1557cd898455d6528190ae2568303d73f53214c2977f6988d1c5c351719c69dd82c65850ba53d77d0cf0449e5b42cbe81 + languageName: node + linkType: hard + "javascript-playground@workspace:playground/javascript": version: 0.0.0-use.local resolution: "javascript-playground@workspace:playground/javascript" @@ -5031,6 +5051,26 @@ fsevents@^2.3.2: languageName: node linkType: hard +"prettier-plugin-java@npm:1.6.0": + version: 1.6.0 + resolution: "prettier-plugin-java@npm:1.6.0" + dependencies: + java-parser: 2.0.0 + lodash: 4.17.21 + prettier: 2.3.1 + checksum: 30fe055ba370cd9f05204ea5b5cabdb490521b84d7673ded0151aba16c0767b1f596600a4924b3541ac1a82819b67a5cd783094b53192612e9f48ae23edbaa3d + languageName: node + linkType: hard + +"prettier@npm:2.3.1": + version: 2.3.1 + resolution: "prettier@npm:2.3.1" + bin: + prettier: bin-prettier.js + checksum: 3b37731ff7150feecf19736c77c790e7e276b404ac9af81cbaf87cfecefc48ef9a864f34c2a5caf5955378b8f2525984b8611703a0d9c1f052b4cfa6eb35899f + languageName: node + linkType: hard + "prettier@npm:2.5.0": version: 2.5.0 resolution: "prettier@npm:2.5.0" @@ -5132,6 +5172,13 @@ fsevents@^2.3.2: languageName: node linkType: hard +"regexp-to-ast@npm:0.4.0": + version: 0.4.0 + resolution: "regexp-to-ast@npm:0.4.0" + checksum: 0f42d802b6259dcd442f79460d8764aa39165323098a6346aded67957816eb2d007ab09e6c674448425df8f721692258c87b51b1ce75c5df23b390dbb36056c0 + languageName: node + linkType: hard + "regexpp@npm:^3.2.0": version: 3.2.0 resolution: "regexpp@npm:3.2.0" From 0c2790466044f0e6f88a0b1d4d425f7c7bf6f909 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 17:08:55 +0100 Subject: [PATCH 10/19] generate js --- .../client-search/model/baseSearchParams.ts | 2 +- .../recommend/model/baseSearchParams.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts index e204ff0176..f23907fbe3 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/baseSearchParams.ts @@ -70,7 +70,7 @@ export type BaseSearchParams = { /** * Define the maximum radius for a geo search (in meters). */ - aroundRadius?: number; + aroundRadius?: number | string | null; /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. */ diff --git a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts index e204ff0176..f23907fbe3 100644 --- a/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts +++ b/clients/algoliasearch-client-javascript/recommend/model/baseSearchParams.ts @@ -70,7 +70,7 @@ export type BaseSearchParams = { /** * Define the maximum radius for a geo search (in meters). */ - aroundRadius?: number; + aroundRadius?: number | string | null; /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. */ From da90720b0f52a1c20354aab52efca4e681e60899 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Wed, 8 Dec 2021 17:16:18 +0100 Subject: [PATCH 11/19] fix spec --- clients/algoliasearch-client-java-2/README.md | 1 + .../algolia/model/SearchParamsAsString.java | 92 +++++++++++++++++++ .../com/algolia/search/SearchApi.java | 45 +++++---- .../client-search/model/models.ts | 1 + .../client-search/src/searchApi.ts | 14 ++- specs/search/paths/search/search.yml | 4 +- 6 files changed, 132 insertions(+), 25 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index c00de0fb3e..8af74abf1b 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -157,6 +157,7 @@ Class | Method | HTTP request | Description - [SaveObjectResponse](docs/SaveObjectResponse.md) - [SearchHits](docs/SearchHits.md) - [SearchParams](docs/SearchParams.md) + - [SearchParamsAsString](docs/SearchParamsAsString.md) - [SearchResponse](docs/SearchResponse.md) - [SetSettingsResponse](docs/SetSettingsResponse.md) - [SnippetResult](docs/SnippetResult.md) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java new file mode 100644 index 0000000000..f4243141c8 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java @@ -0,0 +1,92 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.Arrays; +import java.util.Objects; + +/** + * SearchParamsAsString + */ + +public class SearchParamsAsString { + + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) + private String params; + + public SearchParamsAsString params(String params) { + this.params = params; + return this; + } + + /** + * Get params + * @return params + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchParamsAsString searchParamsAsString = (SearchParamsAsString) o; + return Objects.equals(this.params, searchParamsAsString.params); + } + + @Override + public int hashCode() { + return Objects.hash(params); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchParamsAsString {\n"); + sb.append(" params: ").append(toIndentedString(params)).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-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 8111a12c75..af8ac2d62a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -28,12 +28,13 @@ import com.algolia.model.ListIndicesResponse; import com.algolia.model.MultipleQueriesObject; import com.algolia.model.MultipleQueriesResponse; +import com.algolia.model.OneOfsearchParamsAsStringsearchParams; import com.algolia.model.OperationIndexObject; import com.algolia.model.OperationIndexResponse; import com.algolia.model.SaveObjectResponse; -import com.algolia.model.SearchParams; import com.algolia.model.SearchResponse; import com.algolia.model.SetSettingsResponse; +import com.algolia.model.UNKNOWN_BASE_TYPE; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; @@ -1240,7 +1241,7 @@ public okhttp3.Call saveObjectAsync( /** * Build call for search * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param UNKNOWN_BASE_TYPE (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1256,10 +1257,10 @@ public okhttp3.Call saveObjectAsync( */ public okhttp3.Call searchCall( String indexName, - SearchParams searchParams, + UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ApiCallback _callback ) throws ApiException { - Object localVarPostBody = searchParams; + Object localVarPostBody = UNKNOWN_BASE_TYPE; // create path and map variables String localVarPath = @@ -1306,7 +1307,7 @@ public okhttp3.Call searchCall( @SuppressWarnings("rawtypes") private okhttp3.Call searchValidateBeforeCall( String indexName, - SearchParams searchParams, + UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set @@ -1316,14 +1317,18 @@ private okhttp3.Call searchValidateBeforeCall( ); } - // verify the required parameter 'searchParams' is set - if (searchParams == null) { + // verify the required parameter 'UNKNOWN_BASE_TYPE' is set + if (UNKNOWN_BASE_TYPE == null) { throw new ApiException( - "Missing the required parameter 'searchParams' when calling search(Async)" + "Missing the required parameter 'UNKNOWN_BASE_TYPE' when calling search(Async)" ); } - okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); + okhttp3.Call localVarCall = searchCall( + indexName, + UNKNOWN_BASE_TYPE, + _callback + ); return localVarCall; } @@ -1331,7 +1336,7 @@ private okhttp3.Call searchValidateBeforeCall( * * Get search results. * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param UNKNOWN_BASE_TYPE (required) * @return SearchResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1344,11 +1349,13 @@ private okhttp3.Call searchValidateBeforeCall( 404 Index not found. - */ - public SearchResponse search(String indexName, SearchParams searchParams) - throws ApiException { + public SearchResponse search( + String indexName, + UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE + ) throws ApiException { ApiResponse localVarResp = searchWithHttpInfo( indexName, - searchParams + UNKNOWN_BASE_TYPE ); return localVarResp.getData(); } @@ -1357,7 +1364,7 @@ public SearchResponse search(String indexName, SearchParams searchParams) * * Get search results. * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param UNKNOWN_BASE_TYPE (required) * @return ApiResponse<SearchResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1372,11 +1379,11 @@ public SearchResponse search(String indexName, SearchParams searchParams) */ public ApiResponse searchWithHttpInfo( String indexName, - SearchParams searchParams + UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE ) throws ApiException { okhttp3.Call localVarCall = searchValidateBeforeCall( indexName, - searchParams, + UNKNOWN_BASE_TYPE, null ); Type localVarReturnType = new TypeToken() {}.getType(); @@ -1387,7 +1394,7 @@ public ApiResponse searchWithHttpInfo( * (asynchronously) * Get search results. * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param UNKNOWN_BASE_TYPE (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1403,12 +1410,12 @@ public ApiResponse searchWithHttpInfo( */ public okhttp3.Call searchAsync( String indexName, - SearchParams searchParams, + UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ApiCallback _callback ) throws ApiException { okhttp3.Call localVarCall = searchValidateBeforeCall( indexName, - searchParams, + UNKNOWN_BASE_TYPE, _callback ); Type localVarReturnType = new TypeToken() {}.getType(); diff --git a/clients/algoliasearch-client-javascript/client-search/model/models.ts b/clients/algoliasearch-client-javascript/client-search/model/models.ts index 9598fc4df3..2fb37bde75 100644 --- a/clients/algoliasearch-client-javascript/client-search/model/models.ts +++ b/clients/algoliasearch-client-javascript/client-search/model/models.ts @@ -26,6 +26,7 @@ export * from './record'; export * from './saveObjectResponse'; export * from './searchHits'; export * from './searchParams'; +export * from './searchParamsAsString'; export * from './searchResponse'; export * from './setSettingsResponse'; export * from './snippetResult'; diff --git a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts index d9e31c25d3..9484c7b09e 100644 --- a/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts +++ b/clients/algoliasearch-client-javascript/client-search/src/searchApi.ts @@ -10,6 +10,7 @@ import type { OperationIndexObject } from '../model/operationIndexObject'; import type { OperationIndexResponse } from '../model/operationIndexResponse'; import type { SaveObjectResponse } from '../model/saveObjectResponse'; import type { SearchParams } from '../model/searchParams'; +import type { SearchParamsAsString } from '../model/searchParamsAsString'; import type { SearchResponse } from '../model/searchResponse'; import type { SetSettingsResponse } from '../model/setSettingsResponse'; import { Transporter } from '../utils/Transporter'; @@ -356,11 +357,11 @@ export class SearchApi { * Get search results. * * @param indexName - The index in which to perform the request. - * @param searchParams - The searchParams. + * @param searchParamsAsStringSearchParams - The searchParamsAsStringSearchParams. */ search( indexName: string, - searchParams: SearchParams + searchParamsAsStringSearchParams: SearchParams | SearchParamsAsString ): Promise { const path = '/1/indexes/{indexName}/query'.replace( '{indexName}', @@ -375,16 +376,19 @@ export class SearchApi { ); } - if (searchParams === null || searchParams === undefined) { + if ( + searchParamsAsStringSearchParams === null || + searchParamsAsStringSearchParams === undefined + ) { throw new Error( - 'Required parameter searchParams was null or undefined when calling search.' + 'Required parameter searchParamsAsStringSearchParams was null or undefined when calling search.' ); } const request: Request = { method: 'POST', path, - data: searchParams, + data: searchParamsAsStringSearchParams, }; const requestOptions: RequestOptions = { diff --git a/specs/search/paths/search/search.yml b/specs/search/paths/search/search.yml index e8c31b1d78..ac73618d83 100644 --- a/specs/search/paths/search/search.yml +++ b/specs/search/paths/search/search.yml @@ -10,7 +10,9 @@ post: content: application/json: schema: - $ref: '../../common/schemas/SearchParams.yml#/searchParams' + oneOf: + - $ref: '../../common/schemas/SearchParams.yml#/searchParamsAsString' + - $ref: '../../common/schemas/SearchParams.yml#/searchParams' responses: '200': description: OK From d5daef386f2e0aaa6b0060ef759e2d855148e2f3 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Thu, 9 Dec 2021 15:30:09 +0100 Subject: [PATCH 12/19] use feign library --- .../.openapi-generator-ignore | 1 - clients/algoliasearch-client-java-2/README.md | 180 +- .../com/algolia/ApiCallback.java | 68 - .../com/algolia/ApiClient.java | 1555 ++----------- .../com/algolia/ApiException.java | 115 - .../com/algolia/ApiResponseDecoder.java | 38 + .../com/algolia/Configuration.java | 38 - .../com/algolia/EncodingUtils.java | 90 + .../com/algolia/GzipRequestInterceptor.java | 92 - .../algoliasearch-core/com/algolia/JSON.java | 413 ---- .../algoliasearch-core/com/algolia/Pair.java | 60 - .../com/algolia/ParamExpander.java | 21 + .../com/algolia/ProgressRequestBody.java | 73 - .../com/algolia/ProgressResponseBody.java | 71 - .../com/algolia/RFC3339DateFormat.java | 59 + .../com/algolia/auth/ApiKeyAuth.java | 49 +- .../com/algolia/auth/Authentication.java | 32 - .../com/algolia/auth/DefaultApi20Impl.java | 53 + .../com/algolia/auth/HttpBasicAuth.java | 44 + .../com/algolia/auth/HttpBearerAuth.java | 47 + .../com/algolia/{ => model}/ApiResponse.java | 19 +- .../com/algolia/model/BaseIndexSettings.java | 139 +- .../com/algolia/model/BaseSearchParams.java | 343 ++- .../com/algolia/model/BaseSearchResponse.java | 242 ++- .../model/BaseSearchResponseFacetsStats.java | 55 +- .../com/algolia/model/BatchObject.java | 23 +- .../com/algolia/model/BatchResponse.java | 37 +- .../algolia/model/DeleteIndexResponse.java | 37 +- .../com/algolia/model/ErrorBase.java | 23 +- .../com/algolia/model/HighlightResult.java | 76 +- .../com/algolia/model/Index.java | 119 +- .../com/algolia/model/IndexSettings.java | 664 +++--- .../model/IndexSettingsAsSearchParams.java | 545 ++--- .../algolia/model/ListIndicesResponse.java | 37 +- .../com/algolia/model/MultipleQueries.java | 84 +- .../algolia/model/MultipleQueriesObject.java | 57 +- .../model/MultipleQueriesResponse.java | 24 +- .../com/algolia/model/Operation.java | 60 +- .../algolia/model/OperationIndexObject.java | 87 +- .../algolia/model/OperationIndexResponse.java | 37 +- .../com/algolia/model/RankingInfo.java | 118 +- .../model/RankingInfoMatchedGeoLocation.java | 46 +- .../com/algolia/model/Record.java | 64 +- .../com/algolia/model/SaveObjectResponse.java | 46 +- .../com/algolia/model/SearchHits.java | 24 +- .../com/algolia/model/SearchParams.java | 869 ++++---- .../algolia/model/SearchParamsAsString.java | 24 +- .../com/algolia/model/SearchResponse.java | 251 ++- .../algolia/model/SetSettingsResponse.java | 37 +- .../com/algolia/model/SnippetResult.java | 55 +- .../com/algolia/search/SearchApi.java | 1936 +++-------------- clients/algoliasearch-client-java-2/pom.xml | 164 +- openapitools.json | 2 +- playground/java/pom.xml | 5 + .../java/src/main/java/com/test/App.java | 36 +- templates/java/Configuration.mustache | 27 - templates/java/auth/ApiKeyAuth.mustache | 65 - templates/java/auth/Authentication.mustache | 19 - .../java/libraries/feign/ApiClient.mustache | 354 +++ .../feign/ApiResponseDecoder.mustache | 38 + .../libraries/feign/EncodingUtils.mustache | 86 + .../libraries/feign/ParamExpander.mustache | 22 + .../java/libraries/feign/README.mustache | 77 + templates/java/libraries/feign/api.mustache | 190 ++ .../java/libraries/feign/api_test.mustache | 70 + .../feign/auth/ApiErrorDecoder.mustache | 25 + .../libraries/feign/auth/ApiKeyAuth.mustache | 43 + .../feign/auth/DefaultApi20Impl.mustache | 47 + .../feign/auth/HttpBasicAuth.mustache | 41 + .../feign/auth/HttpBearerAuth.mustache | 43 + .../java/libraries/feign/auth/OAuth.mustache | 92 + .../auth/OauthClientCredentialsGrant.mustache | 39 + .../feign/auth/OauthPasswordGrant.mustache | 48 + .../libraries/feign/build.gradle.mustache | 152 ++ .../java/libraries/feign/build.sbt.mustache | 34 + .../model}/ApiResponse.mustache | 31 +- .../java/libraries/feign/model_test.mustache | 48 + .../{okhttp-gson => feign}/pom.mustache | 203 +- .../okhttp-gson/ApiCallback.mustache | 51 - .../libraries/okhttp-gson/ApiClient.mustache | 1345 ------------ .../GzipRequestInterceptor.mustache | 74 - .../okhttp-gson/ProgressRequestBody.mustache | 62 - .../okhttp-gson/ProgressResponseBody.mustache | 59 - .../libraries/okhttp-gson/README.mustache | 172 -- .../java/libraries/okhttp-gson/api.mustache | 467 ---- .../okhttp-gson/apiException.mustache | 95 - 86 files changed, 5146 insertions(+), 8457 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/{ => model}/ApiResponse.java (69%) delete mode 100644 templates/java/Configuration.mustache delete mode 100644 templates/java/auth/ApiKeyAuth.mustache delete mode 100644 templates/java/auth/Authentication.mustache create mode 100644 templates/java/libraries/feign/ApiClient.mustache create mode 100644 templates/java/libraries/feign/ApiResponseDecoder.mustache create mode 100644 templates/java/libraries/feign/EncodingUtils.mustache create mode 100644 templates/java/libraries/feign/ParamExpander.mustache create mode 100644 templates/java/libraries/feign/README.mustache create mode 100644 templates/java/libraries/feign/api.mustache create mode 100644 templates/java/libraries/feign/api_test.mustache create mode 100644 templates/java/libraries/feign/auth/ApiErrorDecoder.mustache create mode 100644 templates/java/libraries/feign/auth/ApiKeyAuth.mustache create mode 100644 templates/java/libraries/feign/auth/DefaultApi20Impl.mustache create mode 100644 templates/java/libraries/feign/auth/HttpBasicAuth.mustache create mode 100644 templates/java/libraries/feign/auth/HttpBearerAuth.mustache create mode 100644 templates/java/libraries/feign/auth/OAuth.mustache create mode 100644 templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache create mode 100644 templates/java/libraries/feign/auth/OauthPasswordGrant.mustache create mode 100644 templates/java/libraries/feign/build.gradle.mustache create mode 100644 templates/java/libraries/feign/build.sbt.mustache rename templates/java/libraries/{okhttp-gson => feign/model}/ApiResponse.mustache (52%) create mode 100644 templates/java/libraries/feign/model_test.mustache rename templates/java/libraries/{okhttp-gson => feign}/pom.mustache (58%) delete mode 100644 templates/java/libraries/okhttp-gson/ApiCallback.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ApiClient.mustache delete mode 100644 templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache delete mode 100644 templates/java/libraries/okhttp-gson/README.mustache delete mode 100644 templates/java/libraries/okhttp-gson/api.mustache delete mode 100644 templates/java/libraries/okhttp-gson/apiException.mustache diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore index 7c56273a29..f92cf6021b 100644 --- a/clients/algoliasearch-client-java-2/.openapi-generator-ignore +++ b/clients/algoliasearch-client-java-2/.openapi-generator-ignore @@ -4,7 +4,6 @@ # Use this file to prevent files from being overwritten by the generator. # The patterns follow closely to .gitignore or .dockerignore. -algoliasearch-core/com/algolia/auth/Http* api/** docs/** gradle/** diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 8af74abf1b..70574a571a 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -1,184 +1,72 @@ # algoliasearch-client-java-2 -Search API -- API version: 0.1.0 - -API powering the Search feature of Algolia. - - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - ## Requirements -Building the API client library requires: -1. Java 1.8+ -2. Maven/Gradle +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. -## Installation +## Installation & Usage To install the API client library to your local Maven repository, simply execute: ```shell -mvn clean install +mvn install ``` To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: ```shell -mvn clean deploy +mvn deploy ``` -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. -### Maven users - -Add this dependency to your project's POM: +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: ```xml - com.algolia - algoliasearch-client-java-2 - 0.1.0 - compile + com.algolia + algoliasearch-client-java-2 + 0.1.0 + compile -``` - -### Gradle users - -Add this dependency to your project's build file: -```groovy -compile "com.algolia:algoliasearch-client-java-2:0.1.0" ``` -### Others +And to use the api you can follow the examples bellow: -At first generate the JAR by executing: +```java -```shell -mvn clean package -``` + //Set bearer token manually + ApiClient apiClient = new ApiClient("petstore_auth_client"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setAccessToken("TOKEN", 10000); -Then manually install the following JARs: + //Use api key + ApiClient apiClient = new ApiClient("api_key", "API KEY"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); -* `target/algoliasearch-client-java-2-0.1.0.jar` -* `target/lib/*.jar` + //Use http basic authentication + ApiClient apiClient = new ApiClient("basicAuth"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setCredentials("username", "password"); -## Getting Started + //Oauth password + ApiClient apiClient = new ApiClient("oauth_password"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); -Please follow the [installation](#installation) instruction and execute the following Java code: + //Oauth client credentials flow + ApiClient apiClient = new ApiClient("oauth_client_credentials"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setClientCredentials("client_id", "client_secret"); -```java + PetApi petApi = apiClient.buildClient(PetApi.class); + Pet petById = petApi.getPetById(12345L); -// Import classes: -import com.algolia.ApiClient; -import com.algolia.ApiException; -import com.algolia.Configuration; -import com.algolia.auth.*; -import com.algolia.models.*; -import com.algolia.search.SearchApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://localhost"); - - // Configure API key authorization: apiKey - ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); - apiKey.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //apiKey.setApiKeyPrefix("Token"); - - // Configure API key authorization: appId - ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); - appId.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //appId.setApiKeyPrefix("Token"); - - SearchApi apiInstance = new SearchApi(defaultClient); - String indexName = "myIndexName"; // String | The index in which to perform the request. - BatchObject batchObject = new BatchObject(); // BatchObject | - try { - BatchResponse result = apiInstance.batch(indexName, batchObject); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling SearchApi#batch"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } + System.out.println(petById); } -} - ``` -## Documentation for API Endpoints - -All URIs are relative to *http://localhost* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*SearchApi* | [**batch**](docs/SearchApi.md#batch) | **POST** /1/indexes/{indexName}/batch | -*SearchApi* | [**deleteIndex**](docs/SearchApi.md#deleteIndex) | **DELETE** /1/indexes/{indexName} | Delete index. -*SearchApi* | [**getSettings**](docs/SearchApi.md#getSettings) | **GET** /1/indexes/{indexName}/settings | -*SearchApi* | [**listIndices**](docs/SearchApi.md#listIndices) | **GET** /1/indexes | List existing indexes. -*SearchApi* | [**multipleQueries**](docs/SearchApi.md#multipleQueries) | **POST** /1/indexes/*/queries | -*SearchApi* | [**operationIndex**](docs/SearchApi.md#operationIndex) | **POST** /1/indexes/{indexName}/operation | Copy/move index. -*SearchApi* | [**saveObject**](docs/SearchApi.md#saveObject) | **POST** /1/indexes/{indexName} | -*SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /1/indexes/{indexName}/query | -*SearchApi* | [**setSettings**](docs/SearchApi.md#setSettings) | **PUT** /1/indexes/{indexName}/settings | - - -## Documentation for Models - - - [BaseIndexSettings](docs/BaseIndexSettings.md) - - [BaseSearchParams](docs/BaseSearchParams.md) - - [BaseSearchResponse](docs/BaseSearchResponse.md) - - [BaseSearchResponseFacetsStats](docs/BaseSearchResponseFacetsStats.md) - - [BatchObject](docs/BatchObject.md) - - [BatchResponse](docs/BatchResponse.md) - - [DeleteIndexResponse](docs/DeleteIndexResponse.md) - - [ErrorBase](docs/ErrorBase.md) - - [HighlightResult](docs/HighlightResult.md) - - [Index](docs/Index.md) - - [IndexSettings](docs/IndexSettings.md) - - [IndexSettingsAsSearchParams](docs/IndexSettingsAsSearchParams.md) - - [ListIndicesResponse](docs/ListIndicesResponse.md) - - [MultipleQueries](docs/MultipleQueries.md) - - [MultipleQueriesObject](docs/MultipleQueriesObject.md) - - [MultipleQueriesResponse](docs/MultipleQueriesResponse.md) - - [Operation](docs/Operation.md) - - [OperationIndexObject](docs/OperationIndexObject.md) - - [OperationIndexResponse](docs/OperationIndexResponse.md) - - [RankingInfo](docs/RankingInfo.md) - - [RankingInfoMatchedGeoLocation](docs/RankingInfoMatchedGeoLocation.md) - - [Record](docs/Record.md) - - [SaveObjectResponse](docs/SaveObjectResponse.md) - - [SearchHits](docs/SearchHits.md) - - [SearchParams](docs/SearchParams.md) - - [SearchParamsAsString](docs/SearchParamsAsString.md) - - [SearchResponse](docs/SearchResponse.md) - - [SetSettingsResponse](docs/SetSettingsResponse.md) - - [SnippetResult](docs/SnippetResult.md) - - -## Documentation for Authorization - -Authentication schemes defined for the API: -### apiKey - -- **Type**: API key -- **API key parameter name**: X-Algolia-API-Key -- **Location**: HTTP header - -### appId - -- **Type**: API key -- **API key parameter name**: X-Algolia-Application-Id -- **Location**: HTTP header - - ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java deleted file mode 100644 index 856ee70a4a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure( - ApiException e, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess( - T result, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index b393a793d5..ac960d406d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -1,689 +1,153 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; +import com.algolia.ApiResponseDecoder; import com.algolia.auth.ApiKeyAuth; -import com.algolia.auth.Authentication; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URI; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.text.DateFormat; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.net.ssl.*; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.BufferedSink; -import okio.Okio; - +import com.algolia.auth.HttpBasicAuth; +import com.algolia.auth.HttpBearerAuth; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import feign.Feign; +import feign.RequestInterceptor; +import feign.form.FormEncoder; +import feign.jackson.JacksonDecoder; +import feign.jackson.JacksonEncoder; +import feign.okhttp.OkHttpClient; +import feign.slf4j.Slf4jLogger; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.openapitools.jackson.nullable.JsonNullableModule; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" +) public class ApiClient { - private String basePath = "http://localhost"; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; + public interface Api {} - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; + protected ObjectMapper objectMapper; + private String basePath = "http://localhost"; + private Map apiAuthorizations; + private Feign.Builder feignBuilder; - /* - * Basic constructor for ApiClient - */ public ApiClient() { - init(); - initHttpClient(); - - // Setup authentications (key: authentication name, value: authentication). - authentications.put( - "apiKey", - new ApiKeyAuth("header", "X-Algolia-API-Key") - ); - authentications.put( - "appId", - new ApiKeyAuth("header", "X-Algolia-Application-Id") - ); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /* - * Basic constructor with custom OkHttpClient - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication). - authentications.put( - "apiKey", - new ApiKeyAuth("header", "X-Algolia-API-Key") - ); - authentications.put( - "appId", - new ApiKeyAuth("header", "X-Algolia-Application-Id") - ); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor : interceptors) { - builder.addInterceptor(interceptor); - } - - httpClient = builder.build(); - } - - private void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("OpenAPI-Generator/0.1.0/java"); - - authentications = new HashMap(); - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g http://localhost - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client, which must never be null. - * - * @param newHttpClient An instance of OkHttpClient - * @return Api Client - * @throws NullPointerException when newHttpClient is null - */ - public ApiClient setHttpClient(OkHttpClient newHttpClient) { - this.httpClient = - Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); - return this; - } - - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); - return this; - } - - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); - return this; - } - - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = - httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + objectMapper = createObjectMapper(); + apiAuthorizations = new LinkedHashMap(); + feignBuilder = + Feign + .builder() + .client(new OkHttpClient()) + .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) + .decoder(new ApiResponseDecoder(objectMapper)) + .logger(new Slf4jLogger()); + } + + public ApiClient(String[] authNames) { + this(); + for (String authName : authNames) { + log.log(Level.FINE, "Creating authentication {0}", authName); + RequestInterceptor auth; + if ("apiKey".equals(authName)) { + auth = new ApiKeyAuth("header", "X-Algolia-API-Key"); + } else if ("appId".equals(authName)) { + auth = new ApiKeyAuth("header", "X-Algolia-Application-Id"); } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; + throw new RuntimeException( + "auth name \"" + authName + "\" not found in available auth names" + ); } + addAuthorization(authName, auth); } - this.debugging = debugging; - return this; } /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path + * Basic constructor for single auth name + * @param authName */ - public String getTempFolderPath() { - return tempFolderPath; + public ApiClient(String authName) { + this(new String[] { authName }); } /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient + * Helper constructor for single api key + * @param authName + * @param apiKey */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; + public ApiClient(String authName, String apiKey) { + this(authName); + this.setApiKey(apiKey); } - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); + public String getBasePath() { + return basePath; } - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; return this; } - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); + public Map getApiAuthorizations() { + return apiAuthorizations; } - /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = - httpClient - .newBuilder() - .readTimeout(readTimeout, TimeUnit.MILLISECONDS) - .build(); - return this; + public void setApiAuthorizations( + Map apiAuthorizations + ) { + this.apiAuthorizations = apiAuthorizations; } - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); + public Feign.Builder getFeignBuilder() { + return feignBuilder; } - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = - httpClient - .newBuilder() - .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) - .build(); + public ApiClient setFeignBuilder(Feign.Builder feignBuilder) { + this.feignBuilder = feignBuilder; return this; } - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if ( - param instanceof Date || - param instanceof OffsetDateTime || - param instanceof LocalDate - ) { - //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if ( - name == null || - name.isEmpty() || - value == null || - value instanceof Collection - ) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; + private ObjectMapper createObjectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.setDateFormat(new RFC3339DateFormat()); + objectMapper.registerModule(new JavaTimeModule()); + JsonNullableModule jnm = new JsonNullableModule(); + objectMapper.registerModule(jnm); + return objectMapper; } - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs( - String collectionFormat, - String name, - Collection value - ) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; + public ObjectMapper getObjectMapper() { + return objectMapper; } - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString( - String collectionFormat, - Collection value - ) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; } /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif + * Creates a feign client for given API interface. * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. + * Usage: + * ApiClient apiClient = new ApiClient(); + * apiClient.setBasePath("http://localhost:8080"); + * XYZApi api = apiClient.buildClient(XYZApi.class); + * XYZResponse response = api.someMethod(...); + * @param Type + * @param clientClass Client class + * @return The Client */ - public boolean isJsonMime(String mime) { - String jsonMime = - "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + public T buildClient(Class clientClass) { + return feignBuilder.target(clientClass, basePath); } /** @@ -696,14 +160,10 @@ public boolean isJsonMime(String mime) { * null will be returned (not to set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } + if (accepts.length == 0) return null; + if ( + StringUtil.containsIgnoreCase(accepts, "application/json") + ) return "application/json"; return StringUtil.join(accepts, ","); } @@ -714,784 +174,81 @@ public String selectHeaderAccept(String[] accepts) { * * @param contentTypes The Content-Type array to select from * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. + * JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } + if (contentTypes.length == 0) return "application/json"; + if ( + StringUtil.containsIgnoreCase(contentTypes, "application/json") + ) return "application/json"; return contentTypes[0]; } /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string + * Helper method to configure the bearer token. + * @param bearerToken the bearer token. */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } + public void setBearerToken(String bearerToken) { + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(bearerToken); } /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) - throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) respBody = - response.body().string(); else respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + - contentType + - "\" is not supported for type: " + - returnType, - response.code(), - response.headers().toMultimap(), - respBody - ); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) - throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported" - ); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) prefix = "download-"; - } - - if (tempFolderPath == null) return Files - .createTempFile(prefix, suffix) - .toFile(); else return Files - .createTempFile(Paths.get(tempFolderPath), prefix, suffix) - .toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * Helper method to configure the first api key found + * @param apiKey API key */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); + public void setApiKey(String apiKey) { + ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); + apiAuthorization.setApiKey(apiKey); } /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call + * Helper method to configure the username/password for basic auth + * @param username Username + * @param password Password */ - public ApiResponse execute(Call call, Type returnType) - throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse( - response.code(), - response.headers().toMultimap(), - data - ); - } catch (IOException e) { - throw new ApiException(e); - } + public void setCredentials(String username, String password) { + HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); + apiAuthorization.setCredentials(username, password); } /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> + * Gets request interceptor based on authentication name + * @param authName Authentication name + * @return Request Interceptor */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); + public RequestInterceptor getAuthorization(String authName) { + return apiAuthorizations.get(authName); } /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Request interceptor */ - @SuppressWarnings("unchecked") - public void executeAsync( - Call call, - final Type returnType, - final ApiCallback callback + public void addAuthorization( + String authName, + RequestInterceptor authorization ) { - call.enqueue( - new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) - throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure( - e, - response.code(), - response.headers().toMultimap() - ); - return; - } catch (Exception e) { - callback.onFailure( - new ApiException(e), - response.code(), - response.headers().toMultimap() - ); - return; - } - callback.onSuccess( - result, - response.code(), - response.headers().toMultimap() - ); - } - } - ); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) - throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap() - ); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap() - ); - } - } - throw new ApiException( - response.message(), - response.code(), - response.headers().toMultimap(), - respBody + if (apiAuthorizations.containsKey(authName)) { + throw new RuntimeException( + "auth name \"" + authName + "\" already in api authorizations" ); } + apiAuthorizations.put(authName, authorization); + feignBuilder.requestInterceptor(authorization); } - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall( - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback - ) throws ApiException { - Request request = buildRequest( - path, - method, - queryParams, - collectionQueryParams, - body, - headerParams, - cookieParams, - formParams, - authNames, - callback - ); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws ApiException If fail to serialize the request body object - */ - public Request buildRequest( - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback - ) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - - final String url = buildUrl(path, queryParams, collectionQueryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody( - reqBody, - callback + private T getAuthorization(Class type) { + return (T) apiAuthorizations + .values() + .stream() + .filter(requestInterceptor -> + type.isAssignableFrom(requestInterceptor.getClass()) + ) + .findFirst() + .orElseThrow(() -> + new RuntimeException("No Oauth authentication or OAuth configured!") ); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl( - String path, - List queryParams, - List collectionQueryParams - ) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url - .append(escapeString(param.getName())) - .append("=") - .append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams( - Map headerParams, - Request.Builder reqBuilder - ) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header( - header.getKey(), - parameterToString(header.getValue()) - ); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams( - Map cookieParams, - Request.Builder reqBuilder - ) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader( - "Cookie", - String.format("%s=%s", param.getKey(), param.getValue()) - ); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader( - "Cookie", - String.format("%s=%s", param.getKey(), param.getValue()) - ); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - public void updateParamsForAuth( - String[] authNames, - List queryParams, - Map headerParams, - Map cookieParams - ) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding( - Map formParams - ) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder() - .setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"" + - param.getKey() + - "\"; filename=\"" + - file.getName() + - "\"" - ); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } else { - Headers partHeaders = Headers.of( - "Content-Disposition", - "form-data; name=\"" + param.getKey() + "\"" - ); - mpBuilder.addPart( - partHeaders, - RequestBody.create(parameterToString(param.getValue()), null) - ); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse - .newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = - new TrustManager[] { - new X509TrustManager() { - @Override - public void checkClientTrusted( - java.security.cert.X509Certificate[] chain, - String authType - ) throws CertificateException {} - - @Override - public void checkServerTrusted( - java.security.cert.X509Certificate[] chain, - String authType - ) throws CertificateException {} - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; - } - }, - }; - hostnameVerifier = - new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( - TrustManagerFactory.getDefaultAlgorithm() - ); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance( - "X.509" - ); - Collection certificates = certificateFactory.generateCertificates( - sslCaCert - ); - if (certificates.isEmpty()) { - throw new IllegalArgumentException( - "expected non-empty set of trusted certificates" - ); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = - httpClient - .newBuilder() - .sslSocketFactory( - sslContext.getSocketFactory(), - (X509TrustManager) trustManagers[0] - ) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) - throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java deleted file mode 100644 index 243e8c54e5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import java.util.List; -import java.util.Map; - -public class ApiException extends Exception { - - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders, - String responseBody - ) { - super(message, throwable); - this.code = code; - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - public ApiException( - String message, - int code, - Map> responseHeaders, - String responseBody - ) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders - ) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException( - int code, - Map> responseHeaders, - String responseBody - ) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException( - int code, - String message, - Map> responseHeaders, - String responseBody - ) { - this(code, message); - this.responseHeaders = responseHeaders; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java new file mode 100644 index 0000000000..309895aa71 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java @@ -0,0 +1,38 @@ +package com.algolia; + +import com.algolia.model.ApiResponse; +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +public class ApiResponseDecoder extends JacksonDecoder { + + public ApiResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap( + response.headers() + ); + //Detects if the type is an instance of the parameterized class ApiResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new ApiResponse(response.status(), responseHeaders, body); + } else { + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java deleted file mode 100644 index d91ae1cff3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -public class Configuration { - - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java new file mode 100644 index 0000000000..bb9eff7305 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java @@ -0,0 +1,90 @@ +package com.algolia; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Utilities to support Swagger encoding formats in Feign. + */ +public final class EncodingUtils { + + /** + * Private constructor. Do not construct this class. + */ + private EncodingUtils() {} + + /** + *

Encodes a collection of query parameters according to the Swagger + * collection format.

+ * + *

Of the various collection formats defined by Swagger ("csv", "tsv", + * etc), Feign only natively supports "multi". This utility generates the + * other format types so it will be properly processed by Feign.

+ * + *

Note, as part of reformatting, it URL encodes the parameters as + * well.

+ * @param parameters The collection object to be formatted. This object will + * not be changed. + * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", + * "pipes"). See the + * + * OpenAPI Spec for more details. + * @return An object that will be correctly formatted by Feign. + */ + public static Object encodeCollection( + Collection parameters, + String collectionFormat + ) { + if (parameters == null) { + return parameters; + } + List stringValues = new ArrayList<>(parameters.size()); + for (Object parameter : parameters) { + // ignore null values (same behavior as Feign) + if (parameter != null) { + stringValues.add(encode(parameter)); + } + } + // Feign natively handles single-element lists and the "multi" format. + if (stringValues.size() < 2 || "multi".equals(collectionFormat)) { + return stringValues; + } + // Otherwise return a formatted String + String[] stringArray = stringValues.toArray(new String[0]); + switch (collectionFormat) { + case "csv": + default: + return StringUtil.join(stringArray, ","); + case "ssv": + return StringUtil.join(stringArray, " "); + case "tsv": + return StringUtil.join(stringArray, "\t"); + case "pipes": + return StringUtil.join(stringArray, "|"); + } + } + + /** + * URL encode a single query parameter. + * @param parameter The query parameter to encode. This object will not be + * changed. + * @return The URL encoded string representation of the parameter. If the + * parameter is null, returns null. + */ + public static String encode(Object parameter) { + if (parameter == null) { + return null; + } + try { + return URLEncoder + .encode(parameter.toString(), "UTF-8") + .replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java deleted file mode 100644 index 1453bef5a0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import java.io.IOException; -import okhttp3.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -/** - * Encodes request bodies using gzip. - * - * Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if ( - originalRequest.body() == null || - originalRequest.header("Content-Encoding") != null - ) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = originalRequest - .newBuilder() - .header("Content-Encoding", "gzip") - .method( - originalRequest.method(), - forceContentLength(gzip(originalRequest.body())) - ) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) - throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } - - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java deleted file mode 100644 index 5da4757deb..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java +++ /dev/null @@ -1,413 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import com.algolia.model.*; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.gsonfire.GsonFireBuilder; -import io.gsonfire.TypeSelector; -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.Type; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import okio.ByteString; - -public class JSON { - - private Gson gson; - private boolean isLenientOnJson = false; - private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - - @SuppressWarnings("unchecked") - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder(); - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; - } - - private static String getDiscriminatorValue( - JsonElement readElement, - String discriminatorField - ) { - JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if (null == element) { - throw new IllegalArgumentException( - "missing discriminator field: <" + discriminatorField + ">" - ); - } - return element.getAsString(); - } - - /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. - * - * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. - * @return The Java class that implements the OpenAPI schema - */ - private static Class getClassByDiscriminator( - Map classByDiscriminatorValue, - String discriminatorValue - ) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); - if (null == clazz) { - throw new IllegalArgumentException( - "cannot determine model class of name: <" + discriminatorValue + ">" - ); - } - return clazz; - } - - public JSON() { - gson = - createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - .registerTypeAdapter(byte[].class, byteArrayAdapter) - .create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - * @return JSON - */ - public JSON setGson(Gson gson) { - this.gson = gson; - return this; - } - - public JSON setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - return this; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } - } - - /** - * Gson TypeAdapter for Byte Array type - */ - public class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } - } - - /** - * Gson TypeAdapter for JSR310 OffsetDateTime type - */ - public static class OffsetDateTimeTypeAdapter - extends TypeAdapter { - - private DateTimeFormatter formatter; - - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } - - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length() - 5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } - } - } - - /** - * Gson TypeAdapter for JSR310 LocalDate type - */ - public class LocalDateTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } - - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } - - public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - return this; - } - - public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - return this; - } - - /** - * Gson TypeAdapter for java.sql.Date type - * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used - * (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } - } - - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date( - ISO8601Utils.parse(date, new ParsePosition(0)).getTime() - ); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } - } - - /** - * Gson TypeAdapter for java.util.Date type - * If the dateFormat is null, ISO8601Utils will be used. - */ - public static class DateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public DateTypeAdapter() {} - - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } - } - - @Override - public Date read(JsonReader in) throws IOException { - try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); - } - } - } - - public JSON setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - return this; - } - - public JSON setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - return this; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java deleted file mode 100644 index 752fe67775..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -public class Pair { - - private String name = ""; - private String value = ""; - - public Pair(String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java new file mode 100644 index 0000000000..a057c9e50b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java @@ -0,0 +1,21 @@ +package com.algolia; + +import feign.Param; +import java.text.DateFormat; +import java.util.Date; + +/** + * Param Expander to convert {@link Date} to RFC3339 + */ +public class ParamExpander implements Param.Expander { + + private static final DateFormat dateformat = new RFC3339DateFormat(); + + @Override + public String expand(Object value) { + if (value instanceof Date) { + return dateformat.format(value); + } + return value.toString(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java deleted file mode 100644 index 1b84b55603..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress( - bytesWritten, - contentLength, - bytesWritten == contentLength - ); - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java deleted file mode 100644 index f85f459d87..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress( - totalBytesRead, - responseBody.contentLength(), - bytesRead == -1 - ); - return bytesRead; - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java new file mode 100644 index 0000000000..1a271ed189 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java @@ -0,0 +1,59 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import com.fasterxml.jackson.databind.util.StdDateFormat; +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +public class RFC3339DateFormat extends DateFormat { + + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format( + Date date, + StringBuffer toAppendTo, + FieldPosition fieldPosition + ) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return this; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java index 1fd1cbd75c..00495e4edf 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java @@ -1,28 +1,14 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; -import com.algolia.Pair; -import java.util.List; -import java.util.Map; +import feign.RequestInterceptor; +import feign.RequestTemplate; -public class ApiKeyAuth implements Authentication { +public class ApiKeyAuth implements RequestInterceptor { private final String location; private final String paramName; private String apiKey; - private String apiKeyPrefix; public ApiKeyAuth(String location, String paramName) { this.location = location; @@ -45,35 +31,14 @@ public void setApiKey(String apiKey) { this.apiKey = apiKey; } - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } + public void apply(RequestTemplate template) { if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); + template.query(paramName, apiKey); } else if ("header".equals(location)) { - headerParams.put(paramName, value); + template.header(paramName, apiKey); } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); + template.header("Cookie", String.format("%s=%s", paramName, apiKey)); } } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java deleted file mode 100644 index 8a2b1bcd3d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; - -import com.algolia.Pair; -import java.util.List; -import java.util.Map; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java new file mode 100644 index 0000000000..f3c0bb0907 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java @@ -0,0 +1,53 @@ +package com.algolia.auth; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" +) +public class DefaultApi20Impl extends DefaultApi20 { + + private final String accessTokenEndpoint; + private final String authorizationBaseUrl; + + protected DefaultApi20Impl( + String authorizationBaseUrl, + String accessTokenEndpoint + ) { + this.authorizationBaseUrl = authorizationBaseUrl; + this.accessTokenEndpoint = accessTokenEndpoint; + } + + @Override + public String getAccessTokenEndpoint() { + return accessTokenEndpoint; + } + + @Override + protected String getAuthorizationBaseUrl() { + return authorizationBaseUrl; + } + + @Override + public BearerSignature getBearerSignature() { + return BearerSignatureURIQueryParameter.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return OAuth2AccessTokenJsonExtractor.instance(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java new file mode 100644 index 0000000000..1b6da4925a --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java @@ -0,0 +1,44 @@ +package com.algolia.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.auth.BasicAuthRequestInterceptor; + +/** + * An interceptor that adds the request header needed to use HTTP basic authentication. + */ +public class HttpBasicAuth implements RequestInterceptor { + + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void setCredentials(String username, String password) { + this.username = username; + this.password = password; + } + + @Override + public void apply(RequestTemplate template) { + RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor( + username, + password + ); + requestInterceptor.apply(template); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java new file mode 100644 index 0000000000..e9d0c7cf1a --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java @@ -0,0 +1,47 @@ +package com.algolia.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; + +/** + * An interceptor that adds the request header needed to use HTTP bearer authentication. + */ +public class HttpBearerAuth implements RequestInterceptor { + + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void apply(RequestTemplate template) { + if (bearerToken == null) { + return; + } + + template.header( + "Authorization", + (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken + ); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java similarity index 69% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java index 2e0cf698d2..b6f28307d0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java @@ -1,25 +1,8 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; +package com.algolia.model; import java.util.List; import java.util.Map; -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ public class ApiResponse { private final int statusCode; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index 4348835904..524a296d1b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -30,75 +31,67 @@ /** * BaseIndexSettings */ - +@JsonPropertyOrder( + { + BaseIndexSettings.JSON_PROPERTY_REPLICAS, + BaseIndexSettings.JSON_PROPERTY_PAGINATION_LIMITED_TO, + BaseIndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS, + BaseIndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE, + BaseIndexSettings.JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES, + BaseIndexSettings.JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES, + BaseIndexSettings.JSON_PROPERTY_INDEX_LANGUAGES, + BaseIndexSettings.JSON_PROPERTY_FILTER_PROMOTES, + BaseIndexSettings.JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES, + BaseIndexSettings.JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY, + BaseIndexSettings.JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING, + BaseIndexSettings.JSON_PROPERTY_USER_DATA, + } +) +@JsonTypeName("baseIndexSettings") public class BaseIndexSettings { - public static final String SERIALIZED_NAME_REPLICAS = "replicas"; - - @SerializedName(SERIALIZED_NAME_REPLICAS) + public static final String JSON_PROPERTY_REPLICAS = "replicas"; private List replicas = null; - public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = + public static final String JSON_PROPERTY_PAGINATION_LIMITED_TO = "paginationLimitedTo"; - - @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = + public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; - - @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = + public static final String JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; - - @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = + public static final String JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; - - @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; - public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; - - @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) + public static final String JSON_PROPERTY_INDEX_LANGUAGES = "indexLanguages"; private List indexLanguages = null; - public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; - - @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) + public static final String JSON_PROPERTY_FILTER_PROMOTES = "filterPromotes"; private Boolean filterPromotes = false; - public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + public static final String JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; - - @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = + public static final String JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; - - @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; - public static final String SERIALIZED_NAME_USER_DATA = "userData"; - - @SerializedName(SERIALIZED_NAME_USER_DATA) + public static final String JSON_PROPERTY_USER_DATA = "userData"; private Map userData = null; public BaseIndexSettings replicas(List replicas) { @@ -120,10 +113,14 @@ public BaseIndexSettings addReplicasItem(String replicasItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } @@ -141,10 +138,14 @@ public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." ) + @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } + @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } @@ -174,10 +175,14 @@ public BaseIndexSettings addDisableTypoToleranceOnWordsItem( @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." ) + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnWords( List disableTypoToleranceOnWords ) { @@ -209,10 +214,14 @@ public BaseIndexSettings addAttributesToTransliterateItem( @ApiModelProperty( value = "Specify on which attributes to apply transliteration." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToTransliterate() { return attributesToTransliterate; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToTransliterate( List attributesToTransliterate ) { @@ -244,10 +253,14 @@ public BaseIndexSettings addCamelCaseAttributesItem( @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." ) + @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCamelCaseAttributes() { return camelCaseAttributes; } + @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } @@ -278,10 +291,20 @@ public BaseIndexSettings putDecompoundedAttributesItem( @ApiModelProperty( value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." ) + @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } + @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setDecompoundedAttributes( Map decompoundedAttributes ) { @@ -309,10 +332,14 @@ public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { @ApiModelProperty( value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." ) + @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getIndexLanguages() { return indexLanguages; } + @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } @@ -330,10 +357,14 @@ public BaseIndexSettings filterPromotes(Boolean filterPromotes) { @ApiModelProperty( value = "Whether promoted results should match the filters of the current search, except for geographic filters." ) + @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFilterPromotes() { return filterPromotes; } + @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } @@ -363,10 +394,14 @@ public BaseIndexSettings addDisablePrefixOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." ) + @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisablePrefixOnAttributes( List disablePrefixOnAttributes ) { @@ -386,10 +421,14 @@ public BaseIndexSettings allowCompressionOfIntegerArray( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") + @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } + @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowCompressionOfIntegerArray( Boolean allowCompressionOfIntegerArray ) { @@ -421,10 +460,14 @@ public BaseIndexSettings addNumericAttributesForFilteringItem( @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." ) + @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } + @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericAttributesForFiltering( List numericAttributesForFiltering ) { @@ -450,10 +493,20 @@ public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getUserData() { return userData; } + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setUserData(Map userData) { this.userData = userData; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index 782d59a76c..a06baebf5c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -13,204 +13,176 @@ package com.algolia.model; import com.algolia.model.OneOfintegerstring; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.NoSuchElementException; import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.jackson.nullable.JsonNullable; /** * BaseSearchParams */ - +@JsonPropertyOrder( + { + BaseSearchParams.JSON_PROPERTY_QUERY, + BaseSearchParams.JSON_PROPERTY_SIMILAR_QUERY, + BaseSearchParams.JSON_PROPERTY_FILTERS, + BaseSearchParams.JSON_PROPERTY_FACET_FILTERS, + BaseSearchParams.JSON_PROPERTY_OPTIONAL_FILTERS, + BaseSearchParams.JSON_PROPERTY_NUMERIC_FILTERS, + BaseSearchParams.JSON_PROPERTY_TAG_FILTERS, + BaseSearchParams.JSON_PROPERTY_SUM_OR_FILTERS_SCORES, + BaseSearchParams.JSON_PROPERTY_FACETS, + BaseSearchParams.JSON_PROPERTY_MAX_VALUES_PER_FACET, + BaseSearchParams.JSON_PROPERTY_FACETING_AFTER_DISTINCT, + BaseSearchParams.JSON_PROPERTY_SORT_FACET_VALUES_BY, + BaseSearchParams.JSON_PROPERTY_PAGE, + BaseSearchParams.JSON_PROPERTY_OFFSET, + BaseSearchParams.JSON_PROPERTY_LENGTH, + BaseSearchParams.JSON_PROPERTY_AROUND_LAT_LNG, + BaseSearchParams.JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P, + BaseSearchParams.JSON_PROPERTY_AROUND_RADIUS, + BaseSearchParams.JSON_PROPERTY_AROUND_PRECISION, + BaseSearchParams.JSON_PROPERTY_MINIMUM_AROUND_RADIUS, + BaseSearchParams.JSON_PROPERTY_INSIDE_BOUNDING_BOX, + BaseSearchParams.JSON_PROPERTY_INSIDE_POLYGON, + BaseSearchParams.JSON_PROPERTY_NATURAL_LANGUAGES, + BaseSearchParams.JSON_PROPERTY_RULE_CONTEXTS, + BaseSearchParams.JSON_PROPERTY_PERSONALIZATION_IMPACT, + BaseSearchParams.JSON_PROPERTY_USER_TOKEN, + BaseSearchParams.JSON_PROPERTY_GET_RANKING_INFO, + BaseSearchParams.JSON_PROPERTY_CLICK_ANALYTICS, + BaseSearchParams.JSON_PROPERTY_ANALYTICS, + BaseSearchParams.JSON_PROPERTY_ANALYTICS_TAGS, + BaseSearchParams.JSON_PROPERTY_PERCENTILE_COMPUTATION, + BaseSearchParams.JSON_PROPERTY_ENABLE_A_B_TEST, + BaseSearchParams.JSON_PROPERTY_ENABLE_RE_RANKING, + } +) +@JsonTypeName("baseSearchParams") public class BaseSearchParams { - public static final String SERIALIZED_NAME_QUERY = "query"; - - @SerializedName(SERIALIZED_NAME_QUERY) + public static final String JSON_PROPERTY_QUERY = "query"; private String query = ""; - public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; - - @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) + public static final String JSON_PROPERTY_SIMILAR_QUERY = "similarQuery"; private String similarQuery = ""; - public static final String SERIALIZED_NAME_FILTERS = "filters"; - - @SerializedName(SERIALIZED_NAME_FILTERS) + public static final String JSON_PROPERTY_FILTERS = "filters"; private String filters = ""; - public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; - - @SerializedName(SERIALIZED_NAME_FACET_FILTERS) + public static final String JSON_PROPERTY_FACET_FILTERS = "facetFilters"; private List facetFilters = null; - public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = - "optionalFilters"; - - @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) + public static final String JSON_PROPERTY_OPTIONAL_FILTERS = "optionalFilters"; private List optionalFilters = null; - public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; - - @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) + public static final String JSON_PROPERTY_NUMERIC_FILTERS = "numericFilters"; private List numericFilters = null; - public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; - - @SerializedName(SERIALIZED_NAME_TAG_FILTERS) + public static final String JSON_PROPERTY_TAG_FILTERS = "tagFilters"; private List tagFilters = null; - public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = + public static final String JSON_PROPERTY_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; - - @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; - public static final String SERIALIZED_NAME_FACETS = "facets"; - - @SerializedName(SERIALIZED_NAME_FACETS) + public static final String JSON_PROPERTY_FACETS = "facets"; private List facets = null; - public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = + public static final String JSON_PROPERTY_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; - - @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = + public static final String JSON_PROPERTY_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; - - @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = + public static final String JSON_PROPERTY_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; - - @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; - public static final String SERIALIZED_NAME_PAGE = "page"; - - @SerializedName(SERIALIZED_NAME_PAGE) + public static final String JSON_PROPERTY_PAGE = "page"; private Integer page = 0; - public static final String SERIALIZED_NAME_OFFSET = "offset"; - - @SerializedName(SERIALIZED_NAME_OFFSET) + public static final String JSON_PROPERTY_OFFSET = "offset"; private Integer offset; - public static final String SERIALIZED_NAME_LENGTH = "length"; - - @SerializedName(SERIALIZED_NAME_LENGTH) + public static final String JSON_PROPERTY_LENGTH = "length"; private Integer length; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; private String aroundLatLng = ""; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = + public static final String JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; - public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; - - @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) - private OneOfintegerstring aroundRadius; + public static final String JSON_PROPERTY_AROUND_RADIUS = "aroundRadius"; + private JsonNullable aroundRadius = JsonNullable.undefined(); - public static final String SERIALIZED_NAME_AROUND_PRECISION = - "aroundPrecision"; - - @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) + public static final String JSON_PROPERTY_AROUND_PRECISION = "aroundPrecision"; private Integer aroundPrecision = 10; - public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = + public static final String JSON_PROPERTY_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; - - @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = + public static final String JSON_PROPERTY_INSIDE_BOUNDING_BOX = "insideBoundingBox"; - - @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; - public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; - - @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) + public static final String JSON_PROPERTY_INSIDE_POLYGON = "insidePolygon"; private List insidePolygon = null; - public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = + public static final String JSON_PROPERTY_NATURAL_LANGUAGES = "naturalLanguages"; - - @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; - public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; - - @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) + public static final String JSON_PROPERTY_RULE_CONTEXTS = "ruleContexts"; private List ruleContexts = null; - public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = + public static final String JSON_PROPERTY_PERSONALIZATION_IMPACT = "personalizationImpact"; - - @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; - public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; - - @SerializedName(SERIALIZED_NAME_USER_TOKEN) + public static final String JSON_PROPERTY_USER_TOKEN = "userToken"; private String userToken; - public static final String SERIALIZED_NAME_GET_RANKING_INFO = - "getRankingInfo"; - - @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) + public static final String JSON_PROPERTY_GET_RANKING_INFO = "getRankingInfo"; private Boolean getRankingInfo = false; - public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; - - @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) + public static final String JSON_PROPERTY_CLICK_ANALYTICS = "clickAnalytics"; private Boolean clickAnalytics = false; - public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; - - @SerializedName(SERIALIZED_NAME_ANALYTICS) + public static final String JSON_PROPERTY_ANALYTICS = "analytics"; private Boolean analytics = true; - public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; - - @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) + public static final String JSON_PROPERTY_ANALYTICS_TAGS = "analyticsTags"; private List analyticsTags = null; - public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = + public static final String JSON_PROPERTY_PERCENTILE_COMPUTATION = "percentileComputation"; - - @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; - public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; - - @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) + public static final String JSON_PROPERTY_ENABLE_A_B_TEST = "enableABTest"; private Boolean enableABTest = true; - public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = + public static final String JSON_PROPERTY_ENABLE_RE_RANKING = "enableReRanking"; - - @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; public BaseSearchParams query(String query) { @@ -224,10 +196,14 @@ public BaseSearchParams query(String query) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -245,10 +221,14 @@ public BaseSearchParams similarQuery(String similarQuery) { @ApiModelProperty( value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." ) + @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSimilarQuery() { return similarQuery; } + @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } @@ -266,10 +246,14 @@ public BaseSearchParams filters(String filters) { @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." ) + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFilters() { return filters; } + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(String filters) { this.filters = filters; } @@ -293,10 +277,14 @@ public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") + @JsonProperty(JSON_PROPERTY_FACET_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacetFilters() { return facetFilters; } + @JsonProperty(JSON_PROPERTY_FACET_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } @@ -322,10 +310,14 @@ public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { @ApiModelProperty( value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." ) + @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalFilters() { return optionalFilters; } + @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } @@ -349,10 +341,14 @@ public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") + @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericFilters() { return numericFilters; } + @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } @@ -376,10 +372,14 @@ public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getTagFilters() { return tagFilters; } + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } @@ -397,10 +397,14 @@ public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { @ApiModelProperty( value = "Determines how to calculate the total score for filtering." ) + @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } + @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } @@ -424,10 +428,14 @@ public BaseSearchParams addFacetsItem(String facetsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacets() { return facets; } + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(List facets) { this.facets = facets; } @@ -445,10 +453,14 @@ public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." ) + @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } + @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } @@ -466,10 +478,14 @@ public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." ) + @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } + @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } @@ -485,10 +501,14 @@ public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") + @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSortFacetValuesBy() { return sortFacetValuesBy; } + @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } @@ -504,10 +524,14 @@ public BaseSearchParams page(Integer page) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPage() { return page; } + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPage(Integer page) { this.page = page; } @@ -523,10 +547,14 @@ public BaseSearchParams offset(Integer offset) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getOffset() { return offset; } + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOffset(Integer offset) { this.offset = offset; } @@ -546,10 +574,14 @@ public BaseSearchParams length(Integer length) { @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." ) + @JsonProperty(JSON_PROPERTY_LENGTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getLength() { return length; } + @JsonProperty(JSON_PROPERTY_LENGTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLength(Integer length) { this.length = length; } @@ -567,10 +599,14 @@ public BaseSearchParams aroundLatLng(String aroundLatLng) { @ApiModelProperty( value = "Search for entries around a central geolocation, enabling a geo search within a circular area." ) + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -588,16 +624,21 @@ public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { @ApiModelProperty( value = "Search for entries around a given location automatically computed from the requester’s IP address." ) + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; + this.aroundRadius = JsonNullable.of(aroundRadius); + return this; } @@ -609,14 +650,28 @@ public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." ) + @JsonIgnore public OneOfintegerstring getAroundRadius() { + return aroundRadius.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAroundRadius_JsonNullable() { return aroundRadius; } - public void setAroundRadius(OneOfintegerstring aroundRadius) { + @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) + public void setAroundRadius_JsonNullable( + JsonNullable aroundRadius + ) { this.aroundRadius = aroundRadius; } + public void setAroundRadius(OneOfintegerstring aroundRadius) { + this.aroundRadius = JsonNullable.of(aroundRadius); + } + public BaseSearchParams aroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; return this; @@ -630,10 +685,14 @@ public BaseSearchParams aroundPrecision(Integer aroundPrecision) { @ApiModelProperty( value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." ) + @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAroundPrecision() { return aroundPrecision; } + @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } @@ -652,10 +711,14 @@ public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." ) + @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } + @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } @@ -685,10 +748,14 @@ public BaseSearchParams addInsideBoundingBoxItem( @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." ) + @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsideBoundingBox() { return insideBoundingBox; } + @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } @@ -712,10 +779,14 @@ public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") + @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsidePolygon() { return insidePolygon; } + @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } @@ -741,10 +812,14 @@ public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { @ApiModelProperty( value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." ) + @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNaturalLanguages() { return naturalLanguages; } + @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } @@ -768,10 +843,14 @@ public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") + @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRuleContexts() { return ruleContexts; } + @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } @@ -787,10 +866,14 @@ public BaseSearchParams personalizationImpact(Integer personalizationImpact) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") + @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPersonalizationImpact() { return personalizationImpact; } + @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } @@ -808,10 +891,14 @@ public BaseSearchParams userToken(String userToken) { @ApiModelProperty( value = "Associates a certain user token with the current search." ) + @JsonProperty(JSON_PROPERTY_USER_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUserToken() { return userToken; } + @JsonProperty(JSON_PROPERTY_USER_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserToken(String userToken) { this.userToken = userToken; } @@ -827,10 +914,14 @@ public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") + @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getGetRankingInfo() { return getRankingInfo; } + @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } @@ -846,10 +937,14 @@ public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") + @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getClickAnalytics() { return clickAnalytics; } + @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } @@ -867,10 +962,14 @@ public BaseSearchParams analytics(Boolean analytics) { @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." ) + @JsonProperty(JSON_PROPERTY_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAnalytics() { return analytics; } + @JsonProperty(JSON_PROPERTY_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalytics(Boolean analytics) { this.analytics = analytics; } @@ -896,10 +995,14 @@ public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." ) + @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAnalyticsTags() { return analyticsTags; } + @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } @@ -917,10 +1020,14 @@ public BaseSearchParams percentileComputation(Boolean percentileComputation) { @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." ) + @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPercentileComputation() { return percentileComputation; } + @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } @@ -938,10 +1045,14 @@ public BaseSearchParams enableABTest(Boolean enableABTest) { @ApiModelProperty( value = "Whether this search should participate in running AB tests." ) + @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableABTest() { return enableABTest; } + @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } @@ -957,10 +1068,14 @@ public BaseSearchParams enableReRanking(Boolean enableReRanking) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") + @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableReRanking() { return enableReRanking; } + @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } @@ -1007,7 +1122,7 @@ public boolean equals(Object o) { this.aroundLatLngViaIP, baseSearchParams.aroundLatLngViaIP ) && - Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && + equalsNullable(this.aroundRadius, baseSearchParams.aroundRadius) && Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && Objects.equals( this.minimumAroundRadius, @@ -1077,7 +1192,7 @@ public int hashCode() { length, aroundLatLng, aroundLatLngViaIP, - aroundRadius, + hashCodeNullable(aroundRadius), aroundPrecision, minimumAroundRadius, insideBoundingBox, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index 47c13c8bd5..88db72a337 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.BaseSearchResponseFacetsStats; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -30,133 +31,112 @@ /** * BaseSearchResponse */ - +@JsonPropertyOrder( + { + BaseSearchResponse.JSON_PROPERTY_AB_TEST_I_D, + BaseSearchResponse.JSON_PROPERTY_AB_TEST_VARIANT_I_D, + BaseSearchResponse.JSON_PROPERTY_AROUND_LAT_LNG, + BaseSearchResponse.JSON_PROPERTY_AUTOMATIC_RADIUS, + BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT, + BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_NB_HITS, + BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_TYPO, + BaseSearchResponse.JSON_PROPERTY_FACETS, + BaseSearchResponse.JSON_PROPERTY_FACETS_STATS, + BaseSearchResponse.JSON_PROPERTY_HITS_PER_PAGE, + BaseSearchResponse.JSON_PROPERTY_INDEX, + BaseSearchResponse.JSON_PROPERTY_INDEX_USED, + BaseSearchResponse.JSON_PROPERTY_MESSAGE, + BaseSearchResponse.JSON_PROPERTY_NB_HITS, + BaseSearchResponse.JSON_PROPERTY_NB_PAGES, + BaseSearchResponse.JSON_PROPERTY_NB_SORTED_HITS, + BaseSearchResponse.JSON_PROPERTY_PAGE, + BaseSearchResponse.JSON_PROPERTY_PARAMS, + BaseSearchResponse.JSON_PROPERTY_PARSED_QUERY, + BaseSearchResponse.JSON_PROPERTY_PROCESSING_TIME_M_S, + BaseSearchResponse.JSON_PROPERTY_QUERY, + BaseSearchResponse.JSON_PROPERTY_QUERY_AFTER_REMOVAL, + BaseSearchResponse.JSON_PROPERTY_SERVER_USED, + BaseSearchResponse.JSON_PROPERTY_USER_DATA, + } +) +@JsonTypeName("baseSearchResponse") public class BaseSearchResponse { - public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; - - @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) + public static final String JSON_PROPERTY_AB_TEST_I_D = "abTestID"; private Integer abTestID; - public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = + public static final String JSON_PROPERTY_AB_TEST_VARIANT_I_D = "abTestVariantID"; - - @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; private String aroundLatLng; - public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = - "automaticRadius"; - - @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) + public static final String JSON_PROPERTY_AUTOMATIC_RADIUS = "automaticRadius"; private String automaticRadius; - public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = + public static final String JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = + public static final String JSON_PROPERTY_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; - public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) + public static final String JSON_PROPERTY_EXHAUSTIVE_TYPO = "exhaustiveTypo"; private Boolean exhaustiveTypo; - public static final String SERIALIZED_NAME_FACETS = "facets"; - - @SerializedName(SERIALIZED_NAME_FACETS) + public static final String JSON_PROPERTY_FACETS = "facets"; private Map> facets = null; - public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; - - @SerializedName(SERIALIZED_NAME_FACETS_STATS) + public static final String JSON_PROPERTY_FACETS_STATS = "facets_stats"; private Map facetsStats = null; - public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; - - @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_INDEX = "index"; - - @SerializedName(SERIALIZED_NAME_INDEX) + public static final String JSON_PROPERTY_INDEX = "index"; private String index; - public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; - - @SerializedName(SERIALIZED_NAME_INDEX_USED) + public static final String JSON_PROPERTY_INDEX_USED = "indexUsed"; private String indexUsed; - public static final String SERIALIZED_NAME_MESSAGE = "message"; - - @SerializedName(SERIALIZED_NAME_MESSAGE) + public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; - public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; - - @SerializedName(SERIALIZED_NAME_NB_HITS) + public static final String JSON_PROPERTY_NB_HITS = "nbHits"; private Integer nbHits; - public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; - - @SerializedName(SERIALIZED_NAME_NB_PAGES) + public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; private Integer nbPages; - public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; - - @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) + public static final String JSON_PROPERTY_NB_SORTED_HITS = "nbSortedHits"; private Integer nbSortedHits; - public static final String SERIALIZED_NAME_PAGE = "page"; - - @SerializedName(SERIALIZED_NAME_PAGE) + public static final String JSON_PROPERTY_PAGE = "page"; private Integer page = 0; - public static final String SERIALIZED_NAME_PARAMS = "params"; - - @SerializedName(SERIALIZED_NAME_PARAMS) + public static final String JSON_PROPERTY_PARAMS = "params"; private String params; - public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; - - @SerializedName(SERIALIZED_NAME_PARSED_QUERY) + public static final String JSON_PROPERTY_PARSED_QUERY = "parsedQuery"; private String parsedQuery; - public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = + public static final String JSON_PROPERTY_PROCESSING_TIME_M_S = "processingTimeMS"; - - @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; - public static final String SERIALIZED_NAME_QUERY = "query"; - - @SerializedName(SERIALIZED_NAME_QUERY) + public static final String JSON_PROPERTY_QUERY = "query"; private String query = ""; - public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = + public static final String JSON_PROPERTY_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; - - @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; - public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; - - @SerializedName(SERIALIZED_NAME_SERVER_USED) + public static final String JSON_PROPERTY_SERVER_USED = "serverUsed"; private String serverUsed; - public static final String SERIALIZED_NAME_USER_DATA = "userData"; - - @SerializedName(SERIALIZED_NAME_USER_DATA) + public static final String JSON_PROPERTY_USER_DATA = "userData"; private Map userData = null; public BaseSearchResponse abTestID(Integer abTestID) { @@ -172,10 +152,14 @@ public BaseSearchResponse abTestID(Integer abTestID) { @ApiModelProperty( value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." ) + @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestID() { return abTestID; } + @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } @@ -193,10 +177,14 @@ public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { @ApiModelProperty( value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." ) + @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestVariantID() { return abTestVariantID; } + @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } @@ -212,10 +200,14 @@ public BaseSearchResponse aroundLatLng(String aroundLatLng) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -233,10 +225,14 @@ public BaseSearchResponse automaticRadius(String automaticRadius) { @ApiModelProperty( value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." ) + @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAutomaticRadius() { return automaticRadius; } + @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } @@ -256,10 +252,14 @@ public BaseSearchResponse exhaustiveFacetsCount( @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } @@ -278,10 +278,14 @@ public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { required = true, value = "Indicate if the nbHits count was exhaustive or approximate" ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } @@ -300,10 +304,14 @@ public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } @@ -333,10 +341,14 @@ public BaseSearchResponse putFacetsItem( example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts." ) + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getFacets() { return facets; } + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(Map> facets) { this.facets = facets; } @@ -365,10 +377,14 @@ public BaseSearchResponse putFacetsStatsItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") + @JsonProperty(JSON_PROPERTY_FACETS_STATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getFacetsStats() { return facetsStats; } + @JsonProperty(JSON_PROPERTY_FACETS_STATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetsStats( Map facetsStats ) { @@ -386,10 +402,14 @@ public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getHitsPerPage() { return hitsPerPage; } + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -408,10 +428,14 @@ public BaseSearchResponse index(String index) { example = "indexName", value = "Index name used for the query." ) + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndex() { return index; } + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndex(String index) { this.index = index; } @@ -430,10 +454,14 @@ public BaseSearchResponse indexUsed(String indexUsed) { example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." ) + @JsonProperty(JSON_PROPERTY_INDEX_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndexUsed() { return indexUsed; } + @JsonProperty(JSON_PROPERTY_INDEX_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } @@ -449,10 +477,14 @@ public BaseSearchResponse message(String message) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } @@ -472,10 +504,14 @@ public BaseSearchResponse nbHits(Integer nbHits) { required = true, value = "Number of hits that the search query matched" ) + @JsonProperty(JSON_PROPERTY_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbHits() { return nbHits; } + @JsonProperty(JSON_PROPERTY_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } @@ -495,10 +531,14 @@ public BaseSearchResponse nbPages(Integer nbPages) { required = true, value = "Number of pages available for the current query" ) + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbPages() { return nbPages; } + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } @@ -517,10 +557,14 @@ public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm" ) + @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbSortedHits() { return nbSortedHits; } + @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } @@ -536,10 +580,14 @@ public BaseSearchResponse page(Integer page) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getPage() { return page; } + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPage(Integer page) { this.page = page; } @@ -559,10 +607,14 @@ public BaseSearchResponse params(String params) { required = true, value = "A url-encoded string of all search parameters." ) + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getParams() { return params; } + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setParams(String params) { this.params = params; } @@ -580,10 +632,14 @@ public BaseSearchResponse parsedQuery(String parsedQuery) { @ApiModelProperty( value = "The query string that will be searched, after normalization." ) + @JsonProperty(JSON_PROPERTY_PARSED_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParsedQuery() { return parsedQuery; } + @JsonProperty(JSON_PROPERTY_PARSED_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } @@ -603,10 +659,14 @@ public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { required = true, value = "Time the server took to process the request, in milliseconds." ) + @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getProcessingTimeMS() { return processingTimeMS; } + @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } @@ -622,10 +682,14 @@ public BaseSearchResponse query(String query) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -643,10 +707,14 @@ public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { @ApiModelProperty( value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." ) + @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQueryAfterRemoval() { return queryAfterRemoval; } + @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } @@ -664,10 +732,14 @@ public BaseSearchResponse serverUsed(String serverUsed) { @ApiModelProperty( value = "Actual host name of the server that processed the request." ) + @JsonProperty(JSON_PROPERTY_SERVER_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getServerUsed() { return serverUsed; } + @JsonProperty(JSON_PROPERTY_SERVER_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } @@ -691,10 +763,20 @@ public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getUserData() { return userData; } + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setUserData(Map userData) { this.userData = userData; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java index 8dc09c94d6..4fad206779 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -12,41 +12,42 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * BaseSearchResponseFacetsStats */ - +@JsonPropertyOrder( + { + BaseSearchResponseFacetsStats.JSON_PROPERTY_MIN, + BaseSearchResponseFacetsStats.JSON_PROPERTY_MAX, + BaseSearchResponseFacetsStats.JSON_PROPERTY_AVG, + BaseSearchResponseFacetsStats.JSON_PROPERTY_SUM, + } +) +@JsonTypeName("baseSearchResponse_facets_stats") public class BaseSearchResponseFacetsStats { - public static final String SERIALIZED_NAME_MIN = "min"; - - @SerializedName(SERIALIZED_NAME_MIN) + public static final String JSON_PROPERTY_MIN = "min"; private Integer min; - public static final String SERIALIZED_NAME_MAX = "max"; - - @SerializedName(SERIALIZED_NAME_MAX) + public static final String JSON_PROPERTY_MAX = "max"; private Integer max; - public static final String SERIALIZED_NAME_AVG = "avg"; - - @SerializedName(SERIALIZED_NAME_AVG) + public static final String JSON_PROPERTY_AVG = "avg"; private Integer avg; - public static final String SERIALIZED_NAME_SUM = "sum"; - - @SerializedName(SERIALIZED_NAME_SUM) + public static final String JSON_PROPERTY_SUM = "sum"; private Integer sum; public BaseSearchResponseFacetsStats min(Integer min) { @@ -60,10 +61,14 @@ public BaseSearchResponseFacetsStats min(Integer min) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The minimum value in the result set.") + @JsonProperty(JSON_PROPERTY_MIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMin() { return min; } + @JsonProperty(JSON_PROPERTY_MIN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMin(Integer min) { this.min = min; } @@ -79,10 +84,14 @@ public BaseSearchResponseFacetsStats max(Integer max) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The maximum value in the result set.") + @JsonProperty(JSON_PROPERTY_MAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMax() { return max; } + @JsonProperty(JSON_PROPERTY_MAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMax(Integer max) { this.max = max; } @@ -98,10 +107,14 @@ public BaseSearchResponseFacetsStats avg(Integer avg) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The average facet value in the result set.") + @JsonProperty(JSON_PROPERTY_AVG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAvg() { return avg; } + @JsonProperty(JSON_PROPERTY_AVG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAvg(Integer avg) { this.avg = avg; } @@ -117,10 +130,14 @@ public BaseSearchResponseFacetsStats sum(Integer sum) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The sum of all values in the result set.") + @JsonProperty(JSON_PROPERTY_SUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getSum() { return sum; } + @JsonProperty(JSON_PROPERTY_SUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSum(Integer sum) { this.sum = sum; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 64947bc44d..468758488b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.Operation; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -30,11 +31,11 @@ * The `batch` requests. */ @ApiModel(description = "The `batch` requests.") +@JsonPropertyOrder({ BatchObject.JSON_PROPERTY_REQUESTS }) +@JsonTypeName("batchObject") public class BatchObject { - public static final String SERIALIZED_NAME_REQUESTS = "requests"; - - @SerializedName(SERIALIZED_NAME_REQUESTS) + public static final String JSON_PROPERTY_REQUESTS = "requests"; private List requests = null; public BatchObject requests(List requests) { @@ -56,10 +57,14 @@ public BatchObject addRequestsItem(Operation requestsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_REQUESTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRequests() { return requests; } + @JsonProperty(JSON_PROPERTY_REQUESTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRequests(List requests) { this.requests = requests; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index d342ddb303..404af3a895 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -28,17 +29,19 @@ /** * BatchResponse */ - +@JsonPropertyOrder( + { + BatchResponse.JSON_PROPERTY_TASK_I_D, + BatchResponse.JSON_PROPERTY_OBJECT_I_DS, + } +) +@JsonTypeName("batchResponse") public class BatchResponse { - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) + public static final String JSON_PROPERTY_TASK_I_D = "taskID"; private Integer taskID; - public static final String SERIALIZED_NAME_OBJECT_I_DS = "objectIDs"; - - @SerializedName(SERIALIZED_NAME_OBJECT_I_DS) + public static final String JSON_PROPERTY_OBJECT_I_DS = "objectIDs"; private List objectIDs = null; public BatchResponse taskID(Integer taskID) { @@ -52,10 +55,14 @@ public BatchResponse taskID(Integer taskID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -79,10 +86,14 @@ public BatchResponse addObjectIDsItem(String objectIDsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of objectID.") + @JsonProperty(JSON_PROPERTY_OBJECT_I_DS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getObjectIDs() { return objectIDs; } + @JsonProperty(JSON_PROPERTY_OBJECT_I_DS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setObjectIDs(List objectIDs) { this.objectIDs = objectIDs; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index a135d459c3..d5379c06b3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Objects; @@ -27,17 +28,19 @@ /** * DeleteIndexResponse */ - +@JsonPropertyOrder( + { + DeleteIndexResponse.JSON_PROPERTY_TASK_I_D, + DeleteIndexResponse.JSON_PROPERTY_DELETE_AT, + } +) +@JsonTypeName("deleteIndexResponse") public class DeleteIndexResponse { - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) + public static final String JSON_PROPERTY_TASK_I_D = "taskID"; private Integer taskID; - public static final String SERIALIZED_NAME_DELETE_AT = "deleteAt"; - - @SerializedName(SERIALIZED_NAME_DELETE_AT) + public static final String JSON_PROPERTY_DELETE_AT = "deleteAt"; private OffsetDateTime deleteAt; public DeleteIndexResponse taskID(Integer taskID) { @@ -51,10 +54,14 @@ public DeleteIndexResponse taskID(Integer taskID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -70,10 +77,14 @@ public DeleteIndexResponse deleteAt(OffsetDateTime deleteAt) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") + @JsonProperty(JSON_PROPERTY_DELETE_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getDeleteAt() { return deleteAt; } + @JsonProperty(JSON_PROPERTY_DELETE_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDeleteAt(OffsetDateTime deleteAt) { this.deleteAt = deleteAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java index f0b6978dcb..bc50487b5e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -29,11 +30,11 @@ * Error. */ @ApiModel(description = "Error.") +@JsonPropertyOrder({ ErrorBase.JSON_PROPERTY_MESSAGE }) +@JsonTypeName("ErrorBase") public class ErrorBase extends HashMap { - public static final String SERIALIZED_NAME_MESSAGE = "message"; - - @SerializedName(SERIALIZED_NAME_MESSAGE) + public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; public ErrorBase message(String message) { @@ -47,10 +48,14 @@ public ErrorBase message(String message) { **/ @javax.annotation.Nullable @ApiModelProperty(example = "Invalid Application-Id or API-Key", value = "") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index 96992f50fa..1256ec3fec 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -28,18 +29,23 @@ /** * HighlightResult */ - +@JsonPropertyOrder( + { + HighlightResult.JSON_PROPERTY_VALUE, + HighlightResult.JSON_PROPERTY_MATCH_LEVEL, + HighlightResult.JSON_PROPERTY_MATCHED_WORDS, + HighlightResult.JSON_PROPERTY_FULLY_HIGHLIGHTED, + } +) +@JsonTypeName("highlightResult") public class HighlightResult { - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) + public static final String JSON_PROPERTY_VALUE = "value"; private String value; /** * Indicates how well the attribute matched the search query. */ - @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), @@ -53,6 +59,7 @@ public enum MatchLevelEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -62,6 +69,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static MatchLevelEnum fromValue(String value) { for (MatchLevelEnum b : MatchLevelEnum.values()) { if (b.value.equals(value)) { @@ -70,40 +78,16 @@ public static MatchLevelEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MatchLevelEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MatchLevelEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MatchLevelEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; - - @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) + public static final String JSON_PROPERTY_MATCH_LEVEL = "matchLevel"; private MatchLevelEnum matchLevel; - public static final String SERIALIZED_NAME_MATCHED_WORDS = "matchedWords"; - - @SerializedName(SERIALIZED_NAME_MATCHED_WORDS) + public static final String JSON_PROPERTY_MATCHED_WORDS = "matchedWords"; private List matchedWords = null; - public static final String SERIALIZED_NAME_FULLY_HIGHLIGHTED = + public static final String JSON_PROPERTY_FULLY_HIGHLIGHTED = "fullyHighlighted"; - - @SerializedName(SERIALIZED_NAME_FULLY_HIGHLIGHTED) private Boolean fullyHighlighted; public HighlightResult value(String value) { @@ -120,10 +104,14 @@ public HighlightResult value(String value) { example = "George Clooney", value = "Markup text with occurrences highlighted." ) + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getValue() { return value; } + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValue(String value) { this.value = value; } @@ -141,10 +129,14 @@ public HighlightResult matchLevel(MatchLevelEnum matchLevel) { @ApiModelProperty( value = "Indicates how well the attribute matched the search query." ) + @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public MatchLevelEnum getMatchLevel() { return matchLevel; } + @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } @@ -170,10 +162,14 @@ public HighlightResult addMatchedWordsItem(String matchedWordsItem) { @ApiModelProperty( value = "List of words from the query that matched the object." ) + @JsonProperty(JSON_PROPERTY_MATCHED_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getMatchedWords() { return matchedWords; } + @JsonProperty(JSON_PROPERTY_MATCHED_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchedWords(List matchedWords) { this.matchedWords = matchedWords; } @@ -191,10 +187,14 @@ public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { @ApiModelProperty( value = "Whether the entire attribute value is highlighted." ) + @JsonProperty(JSON_PROPERTY_FULLY_HIGHLIGHTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFullyHighlighted() { return fullyHighlighted; } + @JsonProperty(JSON_PROPERTY_FULLY_HIGHLIGHTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFullyHighlighted(Boolean fullyHighlighted) { this.fullyHighlighted = fullyHighlighted; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index d5e1885d5b..01b2318b17 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; @@ -29,64 +30,56 @@ /** * Index */ - +@JsonPropertyOrder( + { + Index.JSON_PROPERTY_NAME, + Index.JSON_PROPERTY_CREATED_AT, + Index.JSON_PROPERTY_UPDATED_AT, + Index.JSON_PROPERTY_ENTRIES, + Index.JSON_PROPERTY_DATA_SIZE, + Index.JSON_PROPERTY_FILE_SIZE, + Index.JSON_PROPERTY_LAST_BUILD_TIME_S, + Index.JSON_PROPERTY_NUMBER_OF_PENDING_TASK, + Index.JSON_PROPERTY_PENDING_TASK, + Index.JSON_PROPERTY_PRIMARY, + Index.JSON_PROPERTY_REPLICAS, + } +) +@JsonTypeName("index") public class Index { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) + public static final String JSON_PROPERTY_NAME = "name"; private String name; - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; private OffsetDateTime createdAt; - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; private OffsetDateTime updatedAt; - public static final String SERIALIZED_NAME_ENTRIES = "entries"; - - @SerializedName(SERIALIZED_NAME_ENTRIES) + public static final String JSON_PROPERTY_ENTRIES = "entries"; private Integer entries; - public static final String SERIALIZED_NAME_DATA_SIZE = "dataSize"; - - @SerializedName(SERIALIZED_NAME_DATA_SIZE) + public static final String JSON_PROPERTY_DATA_SIZE = "dataSize"; private Integer dataSize; - public static final String SERIALIZED_NAME_FILE_SIZE = "fileSize"; - - @SerializedName(SERIALIZED_NAME_FILE_SIZE) + public static final String JSON_PROPERTY_FILE_SIZE = "fileSize"; private Integer fileSize; - public static final String SERIALIZED_NAME_LAST_BUILD_TIME_S = - "lastBuildTimeS"; - - @SerializedName(SERIALIZED_NAME_LAST_BUILD_TIME_S) + public static final String JSON_PROPERTY_LAST_BUILD_TIME_S = "lastBuildTimeS"; private Integer lastBuildTimeS; - public static final String SERIALIZED_NAME_NUMBER_OF_PENDING_TASK = + public static final String JSON_PROPERTY_NUMBER_OF_PENDING_TASK = "numberOfPendingTask"; - - @SerializedName(SERIALIZED_NAME_NUMBER_OF_PENDING_TASK) private Integer numberOfPendingTask; - public static final String SERIALIZED_NAME_PENDING_TASK = "pendingTask"; - - @SerializedName(SERIALIZED_NAME_PENDING_TASK) + public static final String JSON_PROPERTY_PENDING_TASK = "pendingTask"; private Boolean pendingTask; - public static final String SERIALIZED_NAME_PRIMARY = "primary"; - - @SerializedName(SERIALIZED_NAME_PRIMARY) + public static final String JSON_PROPERTY_PRIMARY = "primary"; private String primary; - public static final String SERIALIZED_NAME_REPLICAS = "replicas"; - - @SerializedName(SERIALIZED_NAME_REPLICAS) + public static final String JSON_PROPERTY_REPLICAS = "replicas"; private List replicas = null; public Index name(String name) { @@ -100,10 +93,14 @@ public Index name(String name) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Index name.") + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; } + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setName(String name) { this.name = name; } @@ -122,10 +119,14 @@ public Index createdAt(OffsetDateTime createdAt) { required = true, value = "Index creation date. An empty string means that the index has no records." ) + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getCreatedAt() { return createdAt; } + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; } @@ -144,10 +145,14 @@ public Index updatedAt(OffsetDateTime updatedAt) { required = true, value = "Date of last update (ISO-8601 format)." ) + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } @@ -166,10 +171,14 @@ public Index entries(Integer entries) { required = true, value = "Number of records contained in the index." ) + @JsonProperty(JSON_PROPERTY_ENTRIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getEntries() { return entries; } + @JsonProperty(JSON_PROPERTY_ENTRIES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setEntries(Integer entries) { this.entries = entries; } @@ -188,10 +197,14 @@ public Index dataSize(Integer dataSize) { required = true, value = "Number of bytes of the index in minified format." ) + @JsonProperty(JSON_PROPERTY_DATA_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getDataSize() { return dataSize; } + @JsonProperty(JSON_PROPERTY_DATA_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setDataSize(Integer dataSize) { this.dataSize = dataSize; } @@ -210,10 +223,14 @@ public Index fileSize(Integer fileSize) { required = true, value = "Number of bytes of the index binary file." ) + @JsonProperty(JSON_PROPERTY_FILE_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getFileSize() { return fileSize; } + @JsonProperty(JSON_PROPERTY_FILE_SIZE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setFileSize(Integer fileSize) { this.fileSize = fileSize; } @@ -229,10 +246,14 @@ public Index lastBuildTimeS(Integer lastBuildTimeS) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Last build time") + @JsonProperty(JSON_PROPERTY_LAST_BUILD_TIME_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getLastBuildTimeS() { return lastBuildTimeS; } + @JsonProperty(JSON_PROPERTY_LAST_BUILD_TIME_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setLastBuildTimeS(Integer lastBuildTimeS) { this.lastBuildTimeS = lastBuildTimeS; } @@ -250,10 +271,14 @@ public Index numberOfPendingTask(Integer numberOfPendingTask) { @ApiModelProperty( value = "Number of pending indexing operations. This value is deprecated and should not be used." ) + @JsonProperty(JSON_PROPERTY_NUMBER_OF_PENDING_TASK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNumberOfPendingTask() { return numberOfPendingTask; } + @JsonProperty(JSON_PROPERTY_NUMBER_OF_PENDING_TASK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumberOfPendingTask(Integer numberOfPendingTask) { this.numberOfPendingTask = numberOfPendingTask; } @@ -272,10 +297,14 @@ public Index pendingTask(Boolean pendingTask) { required = true, value = "A boolean which says whether the index has pending tasks. This value is deprecated and should not be used." ) + @JsonProperty(JSON_PROPERTY_PENDING_TASK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getPendingTask() { return pendingTask; } + @JsonProperty(JSON_PROPERTY_PENDING_TASK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPendingTask(Boolean pendingTask) { this.pendingTask = pendingTask; } @@ -293,10 +322,14 @@ public Index primary(String primary) { @ApiModelProperty( value = "Only present if the index is a replica. Contains the name of the related primary index." ) + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPrimary() { return primary; } + @JsonProperty(JSON_PROPERTY_PRIMARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPrimary(String primary) { this.primary = primary; } @@ -322,10 +355,14 @@ public Index addReplicasItem(String replicasItem) { @ApiModelProperty( value = "Only present if the index is a primary index with replicas. Contains the names of all linked replicas." ) + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index b0fb71edc7..7ced42c5f3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -14,14 +14,15 @@ import com.algolia.model.BaseIndexSettings; import com.algolia.model.IndexSettingsAsSearchParams; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -33,179 +34,181 @@ * The Algolia index settings. */ @ApiModel(description = "The Algolia index settings.") +@JsonPropertyOrder( + { + IndexSettings.JSON_PROPERTY_REPLICAS, + IndexSettings.JSON_PROPERTY_PAGINATION_LIMITED_TO, + IndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS, + IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE, + IndexSettings.JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_INDEX_LANGUAGES, + IndexSettings.JSON_PROPERTY_FILTER_PROMOTES, + IndexSettings.JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY, + IndexSettings.JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING, + IndexSettings.JSON_PROPERTY_USER_DATA, + IndexSettings.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, + IndexSettings.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, + IndexSettings.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_RANKING, + IndexSettings.JSON_PROPERTY_CUSTOM_RANKING, + IndexSettings.JSON_PROPERTY_RELEVANCY_STRICTNESS, + IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, + IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, + IndexSettings.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, + IndexSettings.JSON_PROPERTY_HIGHLIGHT_POST_TAG, + IndexSettings.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, + IndexSettings.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, + IndexSettings.JSON_PROPERTY_HITS_PER_PAGE, + IndexSettings.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, + IndexSettings.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, + IndexSettings.JSON_PROPERTY_TYPO_TOLERANCE, + IndexSettings.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, + IndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_SEPARATORS_TO_INDEX, + IndexSettings.JSON_PROPERTY_IGNORE_PLURALS, + IndexSettings.JSON_PROPERTY_REMOVE_STOP_WORDS, + IndexSettings.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, + IndexSettings.JSON_PROPERTY_QUERY_LANGUAGES, + IndexSettings.JSON_PROPERTY_DECOMPOUND_QUERY, + IndexSettings.JSON_PROPERTY_ENABLE_RULES, + IndexSettings.JSON_PROPERTY_ENABLE_PERSONALIZATION, + IndexSettings.JSON_PROPERTY_QUERY_TYPE, + IndexSettings.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, + IndexSettings.JSON_PROPERTY_ADVANCED_SYNTAX, + IndexSettings.JSON_PROPERTY_OPTIONAL_WORDS, + IndexSettings.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, + IndexSettings.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, + IndexSettings.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, + IndexSettings.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, + IndexSettings.JSON_PROPERTY_DISTINCT, + IndexSettings.JSON_PROPERTY_SYNONYMS, + IndexSettings.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, + IndexSettings.JSON_PROPERTY_MIN_PROXIMITY, + IndexSettings.JSON_PROPERTY_RESPONSE_FIELDS, + IndexSettings.JSON_PROPERTY_MAX_FACET_HITS, + IndexSettings.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, + IndexSettings.JSON_PROPERTY_RENDERING_CONTENT, + } +) +@JsonTypeName("indexSettings") public class IndexSettings { - public static final String SERIALIZED_NAME_REPLICAS = "replicas"; - - @SerializedName(SERIALIZED_NAME_REPLICAS) + public static final String JSON_PROPERTY_REPLICAS = "replicas"; private List replicas = null; - public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = + public static final String JSON_PROPERTY_PAGINATION_LIMITED_TO = "paginationLimitedTo"; - - @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = + public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; - - @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = + public static final String JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; - - @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = + public static final String JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; - - @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; - public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; - - @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) + public static final String JSON_PROPERTY_INDEX_LANGUAGES = "indexLanguages"; private List indexLanguages = null; - public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; - - @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) + public static final String JSON_PROPERTY_FILTER_PROMOTES = "filterPromotes"; private Boolean filterPromotes = false; - public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + public static final String JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; - - @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = + public static final String JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; - - @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; - public static final String SERIALIZED_NAME_USER_DATA = "userData"; - - @SerializedName(SERIALIZED_NAME_USER_DATA) + public static final String JSON_PROPERTY_USER_DATA = "userData"; private Map userData = null; - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; - - @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; - - @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String SERIALIZED_NAME_RANKING = "ranking"; - - @SerializedName(SERIALIZED_NAME_RANKING) + public static final String JSON_PROPERTY_RANKING = "ranking"; private List ranking = null; - public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; - - @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = "relevancyStrictness"; - - @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = "highlightPreTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = "highlightPostTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; - - @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; - - @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** * Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -221,6 +224,7 @@ public enum TypoToleranceEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -230,6 +234,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -238,92 +243,50 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; - - @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; - - @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = "separatorsToIndex"; - - @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; - - @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = "removeStopWords"; - - @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; - - @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; - - @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = - "decompoundQuery"; - - @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; private Boolean decompoundQuery = true; - public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; - - @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = "enablePersonalization"; - - @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** * Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -337,6 +300,7 @@ public enum QueryTypeEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -346,6 +310,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -354,35 +319,14 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; - - @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** * Selects a strategy to remove words from the query when it doesn’t match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -398,6 +342,7 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -407,6 +352,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -415,54 +361,26 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; - - @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; private Boolean advancedSyntax = false; - public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; - - @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** * Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -476,6 +394,7 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -485,6 +404,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -493,38 +413,16 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; - - @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -538,6 +436,7 @@ public enum AlternativesAsExactEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -547,6 +446,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -555,36 +455,15 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; - - @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** * Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -596,6 +475,7 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -605,6 +485,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -613,74 +494,37 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String SERIALIZED_NAME_DISTINCT = "distinct"; - - @SerializedName(SERIALIZED_NAME_DISTINCT) + public static final String JSON_PROPERTY_DISTINCT = "distinct"; private Integer distinct = 0; - public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; - - @SerializedName(SERIALIZED_NAME_SYNONYMS) + public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; - - @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; - - @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; private Integer minProximity = 1; - public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; - - @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; private List responseFields = null; - public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; - - @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = + public static final String JSON_PROPERTY_RENDERING_CONTENT = "renderingContent"; - - @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public IndexSettings replicas(List replicas) { @@ -702,10 +546,14 @@ public IndexSettings addReplicasItem(String replicasItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } + @JsonProperty(JSON_PROPERTY_REPLICAS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } @@ -723,10 +571,14 @@ public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." ) + @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } + @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } @@ -756,10 +608,14 @@ public IndexSettings addDisableTypoToleranceOnWordsItem( @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." ) + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnWords( List disableTypoToleranceOnWords ) { @@ -791,10 +647,14 @@ public IndexSettings addAttributesToTransliterateItem( @ApiModelProperty( value = "Specify on which attributes to apply transliteration." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToTransliterate() { return attributesToTransliterate; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToTransliterate( List attributesToTransliterate ) { @@ -824,10 +684,14 @@ public IndexSettings addCamelCaseAttributesItem( @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." ) + @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCamelCaseAttributes() { return camelCaseAttributes; } + @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } @@ -858,10 +722,20 @@ public IndexSettings putDecompoundedAttributesItem( @ApiModelProperty( value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." ) + @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } + @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setDecompoundedAttributes( Map decompoundedAttributes ) { @@ -889,10 +763,14 @@ public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { @ApiModelProperty( value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." ) + @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getIndexLanguages() { return indexLanguages; } + @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } @@ -910,10 +788,14 @@ public IndexSettings filterPromotes(Boolean filterPromotes) { @ApiModelProperty( value = "Whether promoted results should match the filters of the current search, except for geographic filters." ) + @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFilterPromotes() { return filterPromotes; } + @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } @@ -943,10 +825,14 @@ public IndexSettings addDisablePrefixOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." ) + @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisablePrefixOnAttributes( List disablePrefixOnAttributes ) { @@ -966,10 +852,14 @@ public IndexSettings allowCompressionOfIntegerArray( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") + @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } + @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowCompressionOfIntegerArray( Boolean allowCompressionOfIntegerArray ) { @@ -1001,10 +891,14 @@ public IndexSettings addNumericAttributesForFilteringItem( @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." ) + @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } + @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericAttributesForFiltering( List numericAttributesForFiltering ) { @@ -1030,10 +924,20 @@ public IndexSettings putUserDataItem(String key, Object userDataItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getUserData() { return userData; } + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setUserData(Map userData) { this.userData = userData; } @@ -1061,10 +965,14 @@ public IndexSettings addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -1094,10 +1002,14 @@ public IndexSettings addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -1127,10 +1039,14 @@ public IndexSettings addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -1158,10 +1074,14 @@ public IndexSettings addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -1191,10 +1111,14 @@ public IndexSettings addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -1220,10 +1144,14 @@ public IndexSettings addRankingItem(String rankingItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -1247,10 +1175,14 @@ public IndexSettings addCustomRankingItem(String customRankingItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -1268,10 +1200,14 @@ public IndexSettings relevancyStrictness(Integer relevancyStrictness) { @ApiModelProperty( value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." ) + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -1299,10 +1235,14 @@ public IndexSettings addAttributesToHighlightItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -1330,10 +1270,14 @@ public IndexSettings addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -1351,10 +1295,14 @@ public IndexSettings highlightPreTag(String highlightPreTag) { @ApiModelProperty( value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -1372,10 +1320,14 @@ public IndexSettings highlightPostTag(String highlightPostTag) { @ApiModelProperty( value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -1393,10 +1345,14 @@ public IndexSettings snippetEllipsisText(String snippetEllipsisText) { @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -1416,10 +1372,14 @@ public IndexSettings restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -1437,10 +1397,14 @@ public IndexSettings hitsPerPage(Integer hitsPerPage) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -1458,10 +1422,14 @@ public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -1479,10 +1447,14 @@ public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -1500,10 +1472,14 @@ public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -1523,10 +1499,14 @@ public IndexSettings allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -1558,10 +1538,14 @@ public IndexSettings addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -1579,10 +1563,14 @@ public IndexSettings separatorsToIndex(String separatorsToIndex) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -1600,10 +1588,14 @@ public IndexSettings ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -1621,10 +1613,14 @@ public IndexSettings removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -1644,10 +1640,14 @@ public IndexSettings keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -1673,10 +1673,14 @@ public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { @ApiModelProperty( value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." ) + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -1694,10 +1698,14 @@ public IndexSettings decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -1713,10 +1721,14 @@ public IndexSettings enableRules(Boolean enableRules) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -1732,10 +1744,14 @@ public IndexSettings enablePersonalization(Boolean enablePersonalization) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -1753,10 +1769,14 @@ public IndexSettings queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -1776,10 +1796,14 @@ public IndexSettings removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -1797,10 +1821,14 @@ public IndexSettings advancedSyntax(Boolean advancedSyntax) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -1826,10 +1854,14 @@ public IndexSettings addOptionalWordsItem(String optionalWordsItem) { @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -1859,10 +1891,14 @@ public IndexSettings addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -1884,10 +1920,14 @@ public IndexSettings exactOnSingleWordQuery( @ApiModelProperty( value = "Controls how the exact ranking criterion is computed when the query contains only one word." ) + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -1919,10 +1959,14 @@ public IndexSettings addAlternativesAsExactItem( @ApiModelProperty( value = "List of alternatives that should be considered an exact match by the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -1954,10 +1998,14 @@ public IndexSettings addAdvancedSyntaxFeaturesItem( @ApiModelProperty( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." ) + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -1977,10 +2025,14 @@ public IndexSettings distinct(Integer distinct) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -1998,10 +2050,14 @@ public IndexSettings synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -2021,10 +2077,14 @@ public IndexSettings replaceSynonymsInHighlight( @ApiModelProperty( value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." ) + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -2044,10 +2104,14 @@ public IndexSettings minProximity(Integer minProximity) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -2073,10 +2137,14 @@ public IndexSettings addResponseFieldsItem(String responseFieldsItem) { @ApiModelProperty( value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." ) + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -2094,10 +2162,14 @@ public IndexSettings maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -2118,10 +2190,14 @@ public IndexSettings attributeCriteriaComputedByMinProximity( @ApiModelProperty( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -2142,10 +2218,14 @@ public IndexSettings renderingContent(Object renderingContent) { @ApiModelProperty( value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." ) + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index bb1c6a3d7b..363093b239 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -28,112 +29,125 @@ /** * IndexSettingsAsSearchParams */ - +@JsonPropertyOrder( + { + IndexSettingsAsSearchParams.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, + IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, + IndexSettingsAsSearchParams.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, + IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, + IndexSettingsAsSearchParams.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, + IndexSettingsAsSearchParams.JSON_PROPERTY_RANKING, + IndexSettingsAsSearchParams.JSON_PROPERTY_CUSTOM_RANKING, + IndexSettingsAsSearchParams.JSON_PROPERTY_RELEVANCY_STRICTNESS, + IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, + IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, + IndexSettingsAsSearchParams.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, + IndexSettingsAsSearchParams.JSON_PROPERTY_HIGHLIGHT_POST_TAG, + IndexSettingsAsSearchParams.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, + IndexSettingsAsSearchParams.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, + IndexSettingsAsSearchParams.JSON_PROPERTY_HITS_PER_PAGE, + IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, + IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, + IndexSettingsAsSearchParams.JSON_PROPERTY_TYPO_TOLERANCE, + IndexSettingsAsSearchParams.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, + IndexSettingsAsSearchParams.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, + IndexSettingsAsSearchParams.JSON_PROPERTY_SEPARATORS_TO_INDEX, + IndexSettingsAsSearchParams.JSON_PROPERTY_IGNORE_PLURALS, + IndexSettingsAsSearchParams.JSON_PROPERTY_REMOVE_STOP_WORDS, + IndexSettingsAsSearchParams.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, + IndexSettingsAsSearchParams.JSON_PROPERTY_QUERY_LANGUAGES, + IndexSettingsAsSearchParams.JSON_PROPERTY_DECOMPOUND_QUERY, + IndexSettingsAsSearchParams.JSON_PROPERTY_ENABLE_RULES, + IndexSettingsAsSearchParams.JSON_PROPERTY_ENABLE_PERSONALIZATION, + IndexSettingsAsSearchParams.JSON_PROPERTY_QUERY_TYPE, + IndexSettingsAsSearchParams.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, + IndexSettingsAsSearchParams.JSON_PROPERTY_ADVANCED_SYNTAX, + IndexSettingsAsSearchParams.JSON_PROPERTY_OPTIONAL_WORDS, + IndexSettingsAsSearchParams.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, + IndexSettingsAsSearchParams.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, + IndexSettingsAsSearchParams.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, + IndexSettingsAsSearchParams.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, + IndexSettingsAsSearchParams.JSON_PROPERTY_DISTINCT, + IndexSettingsAsSearchParams.JSON_PROPERTY_SYNONYMS, + IndexSettingsAsSearchParams.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, + IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_PROXIMITY, + IndexSettingsAsSearchParams.JSON_PROPERTY_RESPONSE_FIELDS, + IndexSettingsAsSearchParams.JSON_PROPERTY_MAX_FACET_HITS, + IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, + IndexSettingsAsSearchParams.JSON_PROPERTY_RENDERING_CONTENT, + } +) +@JsonTypeName("indexSettingsAsSearchParams") public class IndexSettingsAsSearchParams { - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; - - @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; - - @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String SERIALIZED_NAME_RANKING = "ranking"; - - @SerializedName(SERIALIZED_NAME_RANKING) + public static final String JSON_PROPERTY_RANKING = "ranking"; private List ranking = null; - public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; - - @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = "relevancyStrictness"; - - @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = "highlightPreTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = "highlightPostTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; - - @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; - - @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** * Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -149,6 +163,7 @@ public enum TypoToleranceEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -158,6 +173,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -166,92 +182,50 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; - - @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; - - @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = "separatorsToIndex"; - - @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; - - @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = "removeStopWords"; - - @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; - - @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; - - @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = - "decompoundQuery"; - - @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; private Boolean decompoundQuery = true; - public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; - - @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = "enablePersonalization"; - - @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** * Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -265,6 +239,7 @@ public enum QueryTypeEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -274,6 +249,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -282,35 +258,14 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; - - @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** * Selects a strategy to remove words from the query when it doesn’t match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -326,6 +281,7 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -335,6 +291,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -343,54 +300,26 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; - - @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; private Boolean advancedSyntax = false; - public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; - - @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** * Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -404,6 +333,7 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -413,6 +343,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -421,38 +352,16 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; - - @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -466,6 +375,7 @@ public enum AlternativesAsExactEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -475,6 +385,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -483,36 +394,15 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; - - @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** * Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -524,6 +414,7 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -533,6 +424,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -541,74 +433,37 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String SERIALIZED_NAME_DISTINCT = "distinct"; - - @SerializedName(SERIALIZED_NAME_DISTINCT) + public static final String JSON_PROPERTY_DISTINCT = "distinct"; private Integer distinct = 0; - public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; - - @SerializedName(SERIALIZED_NAME_SYNONYMS) + public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; - - @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; - - @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; private Integer minProximity = 1; - public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; - - @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; private List responseFields = null; - public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; - - @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = + public static final String JSON_PROPERTY_RENDERING_CONTENT = "renderingContent"; - - @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public IndexSettingsAsSearchParams searchableAttributes( @@ -636,10 +491,14 @@ public IndexSettingsAsSearchParams addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -669,10 +528,14 @@ public IndexSettingsAsSearchParams addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -702,10 +565,14 @@ public IndexSettingsAsSearchParams addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -735,10 +602,14 @@ public IndexSettingsAsSearchParams addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -768,10 +639,14 @@ public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -797,10 +672,14 @@ public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -826,10 +705,14 @@ public IndexSettingsAsSearchParams addCustomRankingItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -849,10 +732,14 @@ public IndexSettingsAsSearchParams relevancyStrictness( @ApiModelProperty( value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." ) + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -880,10 +767,14 @@ public IndexSettingsAsSearchParams addAttributesToHighlightItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -913,10 +804,14 @@ public IndexSettingsAsSearchParams addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -934,10 +829,14 @@ public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { @ApiModelProperty( value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -955,10 +854,14 @@ public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { @ApiModelProperty( value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -978,10 +881,14 @@ public IndexSettingsAsSearchParams snippetEllipsisText( @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -1001,10 +908,14 @@ public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -1022,10 +933,14 @@ public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -1045,10 +960,14 @@ public IndexSettingsAsSearchParams minWordSizefor1Typo( @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -1068,10 +987,14 @@ public IndexSettingsAsSearchParams minWordSizefor2Typos( @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -1091,10 +1014,14 @@ public IndexSettingsAsSearchParams typoTolerance( @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -1114,10 +1041,14 @@ public IndexSettingsAsSearchParams allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -1149,10 +1080,14 @@ public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -1172,10 +1107,14 @@ public IndexSettingsAsSearchParams separatorsToIndex( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -1193,10 +1132,14 @@ public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -1214,10 +1157,14 @@ public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -1237,10 +1184,14 @@ public IndexSettingsAsSearchParams keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -1270,10 +1221,14 @@ public IndexSettingsAsSearchParams addQueryLanguagesItem( @ApiModelProperty( value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." ) + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -1291,10 +1246,14 @@ public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -1310,10 +1269,14 @@ public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -1331,10 +1294,14 @@ public IndexSettingsAsSearchParams enablePersonalization( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -1352,10 +1319,14 @@ public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -1375,10 +1346,14 @@ public IndexSettingsAsSearchParams removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -1396,10 +1371,14 @@ public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -1427,10 +1406,14 @@ public IndexSettingsAsSearchParams addOptionalWordsItem( @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -1460,10 +1443,14 @@ public IndexSettingsAsSearchParams addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -1485,10 +1472,14 @@ public IndexSettingsAsSearchParams exactOnSingleWordQuery( @ApiModelProperty( value = "Controls how the exact ranking criterion is computed when the query contains only one word." ) + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -1520,10 +1511,14 @@ public IndexSettingsAsSearchParams addAlternativesAsExactItem( @ApiModelProperty( value = "List of alternatives that should be considered an exact match by the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -1555,10 +1550,14 @@ public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem( @ApiModelProperty( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." ) + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -1578,10 +1577,14 @@ public IndexSettingsAsSearchParams distinct(Integer distinct) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -1599,10 +1602,14 @@ public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -1622,10 +1629,14 @@ public IndexSettingsAsSearchParams replaceSynonymsInHighlight( @ApiModelProperty( value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." ) + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -1645,10 +1656,14 @@ public IndexSettingsAsSearchParams minProximity(Integer minProximity) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -1678,10 +1693,14 @@ public IndexSettingsAsSearchParams addResponseFieldsItem( @ApiModelProperty( value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." ) + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -1699,10 +1718,14 @@ public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -1723,10 +1746,14 @@ public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity( @ApiModelProperty( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -1747,10 +1774,14 @@ public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { @ApiModelProperty( value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." ) + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index 3a8746e335..63bf09be03 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.Index; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -29,17 +30,19 @@ /** * ListIndicesResponse */ - +@JsonPropertyOrder( + { + ListIndicesResponse.JSON_PROPERTY_ITEMS, + ListIndicesResponse.JSON_PROPERTY_NB_PAGES, + } +) +@JsonTypeName("listIndicesResponse") public class ListIndicesResponse { - public static final String SERIALIZED_NAME_ITEMS = "items"; - - @SerializedName(SERIALIZED_NAME_ITEMS) + public static final String JSON_PROPERTY_ITEMS = "items"; private List items = null; - public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; - - @SerializedName(SERIALIZED_NAME_NB_PAGES) + public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; private Integer nbPages; public ListIndicesResponse items(List items) { @@ -61,10 +64,14 @@ public ListIndicesResponse addItemsItem(Index itemsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of the fetched indices.") + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getItems() { return items; } + @JsonProperty(JSON_PROPERTY_ITEMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setItems(List items) { this.items = items; } @@ -80,10 +87,14 @@ public ListIndicesResponse nbPages(Integer nbPages) { **/ @javax.annotation.Nullable @ApiModelProperty(example = "100", value = "Number of pages.") + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbPages() { return nbPages; } + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java index 322f8db101..0b23ee86ea 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -12,37 +12,42 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * MultipleQueries */ - +@JsonPropertyOrder( + { + MultipleQueries.JSON_PROPERTY_INDEX_NAME, + MultipleQueries.JSON_PROPERTY_QUERY, + MultipleQueries.JSON_PROPERTY_TYPE, + MultipleQueries.JSON_PROPERTY_FACET, + MultipleQueries.JSON_PROPERTY_PARAMS, + } +) +@JsonTypeName("multipleQueries") public class MultipleQueries { - public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; - - @SerializedName(SERIALIZED_NAME_INDEX_NAME) + public static final String JSON_PROPERTY_INDEX_NAME = "indexName"; private String indexName; - public static final String SERIALIZED_NAME_QUERY = "query"; - - @SerializedName(SERIALIZED_NAME_QUERY) + public static final String JSON_PROPERTY_QUERY = "query"; private String query = ""; /** * Perform a search query with `default`, will search for facet values if `facet` is given. */ - @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DEFAULT("default"), @@ -54,6 +59,7 @@ public enum TypeEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -63,6 +69,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { @@ -71,38 +78,15 @@ public static TypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return TypeEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_TYPE = "type"; - - @SerializedName(SERIALIZED_NAME_TYPE) + public static final String JSON_PROPERTY_TYPE = "type"; private TypeEnum type = TypeEnum.DEFAULT; - public static final String SERIALIZED_NAME_FACET = "facet"; - - @SerializedName(SERIALIZED_NAME_FACET) + public static final String JSON_PROPERTY_FACET = "facet"; private String facet; - public static final String SERIALIZED_NAME_PARAMS = "params"; - - @SerializedName(SERIALIZED_NAME_PARAMS) + public static final String JSON_PROPERTY_PARAMS = "params"; private String params; public MultipleQueries indexName(String indexName) { @@ -120,10 +104,14 @@ public MultipleQueries indexName(String indexName) { required = true, value = "The Algolia index name." ) + @JsonProperty(JSON_PROPERTY_INDEX_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getIndexName() { return indexName; } + @JsonProperty(JSON_PROPERTY_INDEX_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setIndexName(String indexName) { this.indexName = indexName; } @@ -139,10 +127,14 @@ public MultipleQueries query(String query) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The text to search in the index.") + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQuery() { return query; } + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQuery(String query) { this.query = query; } @@ -160,10 +152,14 @@ public MultipleQueries type(TypeEnum type) { @ApiModelProperty( value = "Perform a search query with `default`, will search for facet values if `facet` is given." ) + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypeEnum getType() { return type; } + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setType(TypeEnum type) { this.type = type; } @@ -179,10 +175,14 @@ public MultipleQueries facet(String facet) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The `facet` name.") + @JsonProperty(JSON_PROPERTY_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFacet() { return facet; } + @JsonProperty(JSON_PROPERTY_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacet(String facet) { this.facet = facet; } @@ -198,10 +198,14 @@ public MultipleQueries params(String params) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "A query string of search parameters.") + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParams() { return params; } + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParams(String params) { this.params = params; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index 56b4fc0aad..81d097801f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.MultipleQueries; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -29,18 +30,21 @@ /** * MultipleQueriesObject */ - +@JsonPropertyOrder( + { + MultipleQueriesObject.JSON_PROPERTY_REQUESTS, + MultipleQueriesObject.JSON_PROPERTY_STRATEGY, + } +) +@JsonTypeName("multipleQueriesObject") public class MultipleQueriesObject { - public static final String SERIALIZED_NAME_REQUESTS = "requests"; - - @SerializedName(SERIALIZED_NAME_REQUESTS) + public static final String JSON_PROPERTY_REQUESTS = "requests"; private List requests = new ArrayList<>(); /** * Gets or Sets strategy */ - @JsonAdapter(StrategyEnum.Adapter.class) public enum StrategyEnum { NONE("none"), @@ -52,6 +56,7 @@ public enum StrategyEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -61,6 +66,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static StrategyEnum fromValue(String value) { for (StrategyEnum b : StrategyEnum.values()) { if (b.value.equals(value)) { @@ -69,28 +75,9 @@ public static StrategyEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final StrategyEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public StrategyEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return StrategyEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_STRATEGY = "strategy"; - - @SerializedName(SERIALIZED_NAME_STRATEGY) + public static final String JSON_PROPERTY_STRATEGY = "strategy"; private StrategyEnum strategy; public MultipleQueriesObject requests(List requests) { @@ -109,10 +96,14 @@ public MultipleQueriesObject addRequestsItem(MultipleQueries requestsItem) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_REQUESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getRequests() { return requests; } + @JsonProperty(JSON_PROPERTY_REQUESTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setRequests(List requests) { this.requests = requests; } @@ -128,10 +119,14 @@ public MultipleQueriesObject strategy(StrategyEnum strategy) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_STRATEGY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public StrategyEnum getStrategy() { return strategy; } + @JsonProperty(JSON_PROPERTY_STRATEGY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStrategy(StrategyEnum strategy) { this.strategy = strategy; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index 181d06b795..5467bc41f0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.SearchResponse; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -29,12 +30,11 @@ /** * MultipleQueriesResponse */ - +@JsonPropertyOrder({ MultipleQueriesResponse.JSON_PROPERTY_RESULTS }) +@JsonTypeName("multipleQueriesResponse") public class MultipleQueriesResponse { - public static final String SERIALIZED_NAME_RESULTS = "results"; - - @SerializedName(SERIALIZED_NAME_RESULTS) + public static final String JSON_PROPERTY_RESULTS = "results"; private List results = null; public MultipleQueriesResponse results(List results) { @@ -56,10 +56,14 @@ public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResults() { return results; } + @JsonProperty(JSON_PROPERTY_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResults(List results) { this.results = results; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index c5a4cdf2be..40150b171f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -29,13 +30,15 @@ /** * Operation */ - +@JsonPropertyOrder( + { Operation.JSON_PROPERTY_ACTION, Operation.JSON_PROPERTY_BODY } +) +@JsonTypeName("operation") public class Operation { /** * type of operation. */ - @JsonAdapter(ActionEnum.Adapter.class) public enum ActionEnum { ADDOBJECT("addObject"), @@ -57,6 +60,7 @@ public enum ActionEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -66,6 +70,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static ActionEnum fromValue(String value) { for (ActionEnum b : ActionEnum.values()) { if (b.value.equals(value)) { @@ -74,33 +79,12 @@ public static ActionEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ActionEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ActionEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ActionEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ACTION = "action"; - - @SerializedName(SERIALIZED_NAME_ACTION) + public static final String JSON_PROPERTY_ACTION = "action"; private ActionEnum action; - public static final String SERIALIZED_NAME_BODY = "body"; - - @SerializedName(SERIALIZED_NAME_BODY) + public static final String JSON_PROPERTY_BODY = "body"; private Map body = null; public Operation action(ActionEnum action) { @@ -114,10 +98,14 @@ public Operation action(ActionEnum action) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "type of operation.") + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ActionEnum getAction() { return action; } + @JsonProperty(JSON_PROPERTY_ACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAction(ActionEnum action) { this.action = action; } @@ -143,10 +131,20 @@ public Operation putBodyItem(String key, Object bodyItem) { @ApiModelProperty( value = "arguments to the operation (depends on the type of the operation)." ) + @JsonProperty(JSON_PROPERTY_BODY) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getBody() { return body; } + @JsonProperty(JSON_PROPERTY_BODY) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setBody(Map body) { this.body = body; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index f56a2e3494..756db512ea 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -28,13 +29,19 @@ /** * OperationIndexObject */ - +@JsonPropertyOrder( + { + OperationIndexObject.JSON_PROPERTY_OPERATION, + OperationIndexObject.JSON_PROPERTY_DESTINATION, + OperationIndexObject.JSON_PROPERTY_SCOPE, + } +) +@JsonTypeName("operationIndexObject") public class OperationIndexObject { /** * Type of operation to perform (move or copy). */ - @JsonAdapter(OperationEnum.Adapter.class) public enum OperationEnum { MOVE("move"), @@ -46,6 +53,7 @@ public enum OperationEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -55,6 +63,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static OperationEnum fromValue(String value) { for (OperationEnum b : OperationEnum.values()) { if (b.value.equals(value)) { @@ -63,40 +72,17 @@ public static OperationEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final OperationEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OperationEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return OperationEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_OPERATION = "operation"; - - @SerializedName(SERIALIZED_NAME_OPERATION) + public static final String JSON_PROPERTY_OPERATION = "operation"; private OperationEnum operation; - public static final String SERIALIZED_NAME_DESTINATION = "destination"; - - @SerializedName(SERIALIZED_NAME_DESTINATION) + public static final String JSON_PROPERTY_DESTINATION = "destination"; private String destination; /** * Gets or Sets scope */ - @JsonAdapter(ScopeEnum.Adapter.class) public enum ScopeEnum { SETTINGS("settings"), @@ -110,6 +96,7 @@ public enum ScopeEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -119,6 +106,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static ScopeEnum fromValue(String value) { for (ScopeEnum b : ScopeEnum.values()) { if (b.value.equals(value)) { @@ -127,28 +115,9 @@ public static ScopeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ScopeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ScopeEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return ScopeEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_SCOPE = "scope"; - - @SerializedName(SERIALIZED_NAME_SCOPE) + public static final String JSON_PROPERTY_SCOPE = "scope"; private List scope = null; public OperationIndexObject operation(OperationEnum operation) { @@ -165,10 +134,14 @@ public OperationIndexObject operation(OperationEnum operation) { required = true, value = "Type of operation to perform (move or copy)." ) + @JsonProperty(JSON_PROPERTY_OPERATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public OperationEnum getOperation() { return operation; } + @JsonProperty(JSON_PROPERTY_OPERATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setOperation(OperationEnum operation) { this.operation = operation; } @@ -188,10 +161,14 @@ public OperationIndexObject destination(String destination) { required = true, value = "The Algolia index name." ) + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getDestination() { return destination; } + @JsonProperty(JSON_PROPERTY_DESTINATION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setDestination(String destination) { this.destination = destination; } @@ -217,10 +194,14 @@ public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { @ApiModelProperty( value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied." ) + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getScope() { return scope; } + @JsonProperty(JSON_PROPERTY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setScope(List scope) { this.scope = scope; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index 16d43b8023..08dffba4ea 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Objects; @@ -27,17 +28,19 @@ /** * OperationIndexResponse */ - +@JsonPropertyOrder( + { + OperationIndexResponse.JSON_PROPERTY_TASK_I_D, + OperationIndexResponse.JSON_PROPERTY_UPDATED_AT, + } +) +@JsonTypeName("operationIndexResponse") public class OperationIndexResponse { - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) + public static final String JSON_PROPERTY_TASK_I_D = "taskID"; private Integer taskID; - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; private OffsetDateTime updatedAt; public OperationIndexResponse taskID(Integer taskID) { @@ -51,10 +54,14 @@ public OperationIndexResponse taskID(Integer taskID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -70,10 +77,14 @@ public OperationIndexResponse updatedAt(OffsetDateTime updatedAt) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index bf3c52c18f..39ab4c89d4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.RankingInfoMatchedGeoLocation; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -30,65 +31,58 @@ /** * RankingInfo */ - +@JsonPropertyOrder( + { + RankingInfo.JSON_PROPERTY_FILTERS, + RankingInfo.JSON_PROPERTY_FIRST_MATCHED_WORD, + RankingInfo.JSON_PROPERTY_GEO_DISTANCE, + RankingInfo.JSON_PROPERTY_GEO_PRECISION, + RankingInfo.JSON_PROPERTY_MATCHED_GEO_LOCATION, + RankingInfo.JSON_PROPERTY_NB_EXACT_WORDS, + RankingInfo.JSON_PROPERTY_NB_TYPOS, + RankingInfo.JSON_PROPERTY_PROMOTED, + RankingInfo.JSON_PROPERTY_PROXIMITY_DISTANCE, + RankingInfo.JSON_PROPERTY_USER_SCORE, + RankingInfo.JSON_PROPERTY_WORD, + } +) +@JsonTypeName("rankingInfo") public class RankingInfo { - public static final String SERIALIZED_NAME_FILTERS = "filters"; - - @SerializedName(SERIALIZED_NAME_FILTERS) + public static final String JSON_PROPERTY_FILTERS = "filters"; private Integer filters; - public static final String SERIALIZED_NAME_FIRST_MATCHED_WORD = + public static final String JSON_PROPERTY_FIRST_MATCHED_WORD = "firstMatchedWord"; - - @SerializedName(SERIALIZED_NAME_FIRST_MATCHED_WORD) private Integer firstMatchedWord; - public static final String SERIALIZED_NAME_GEO_DISTANCE = "geoDistance"; - - @SerializedName(SERIALIZED_NAME_GEO_DISTANCE) + public static final String JSON_PROPERTY_GEO_DISTANCE = "geoDistance"; private Integer geoDistance; - public static final String SERIALIZED_NAME_GEO_PRECISION = "geoPrecision"; - - @SerializedName(SERIALIZED_NAME_GEO_PRECISION) + public static final String JSON_PROPERTY_GEO_PRECISION = "geoPrecision"; private Integer geoPrecision; - public static final String SERIALIZED_NAME_MATCHED_GEO_LOCATION = + public static final String JSON_PROPERTY_MATCHED_GEO_LOCATION = "matchedGeoLocation"; - - @SerializedName(SERIALIZED_NAME_MATCHED_GEO_LOCATION) private Map matchedGeoLocation = null; - public static final String SERIALIZED_NAME_NB_EXACT_WORDS = "nbExactWords"; - - @SerializedName(SERIALIZED_NAME_NB_EXACT_WORDS) + public static final String JSON_PROPERTY_NB_EXACT_WORDS = "nbExactWords"; private Integer nbExactWords; - public static final String SERIALIZED_NAME_NB_TYPOS = "nbTypos"; - - @SerializedName(SERIALIZED_NAME_NB_TYPOS) + public static final String JSON_PROPERTY_NB_TYPOS = "nbTypos"; private Integer nbTypos; - public static final String SERIALIZED_NAME_PROMOTED = "promoted"; - - @SerializedName(SERIALIZED_NAME_PROMOTED) + public static final String JSON_PROPERTY_PROMOTED = "promoted"; private Boolean promoted; - public static final String SERIALIZED_NAME_PROXIMITY_DISTANCE = + public static final String JSON_PROPERTY_PROXIMITY_DISTANCE = "proximityDistance"; - - @SerializedName(SERIALIZED_NAME_PROXIMITY_DISTANCE) private Integer proximityDistance; - public static final String SERIALIZED_NAME_USER_SCORE = "userScore"; - - @SerializedName(SERIALIZED_NAME_USER_SCORE) + public static final String JSON_PROPERTY_USER_SCORE = "userScore"; private Integer userScore; - public static final String SERIALIZED_NAME_WORD = "word"; - - @SerializedName(SERIALIZED_NAME_WORD) + public static final String JSON_PROPERTY_WORD = "word"; private Integer word; public RankingInfo filters(Integer filters) { @@ -102,10 +96,14 @@ public RankingInfo filters(Integer filters) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "This field is reserved for advanced usage.") + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getFilters() { return filters; } + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(Integer filters) { this.filters = filters; } @@ -123,10 +121,14 @@ public RankingInfo firstMatchedWord(Integer firstMatchedWord) { @ApiModelProperty( value = "Position of the most important matched attribute in the attributes to index list." ) + @JsonProperty(JSON_PROPERTY_FIRST_MATCHED_WORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getFirstMatchedWord() { return firstMatchedWord; } + @JsonProperty(JSON_PROPERTY_FIRST_MATCHED_WORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFirstMatchedWord(Integer firstMatchedWord) { this.firstMatchedWord = firstMatchedWord; } @@ -144,10 +146,14 @@ public RankingInfo geoDistance(Integer geoDistance) { @ApiModelProperty( value = "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters)." ) + @JsonProperty(JSON_PROPERTY_GEO_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getGeoDistance() { return geoDistance; } + @JsonProperty(JSON_PROPERTY_GEO_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGeoDistance(Integer geoDistance) { this.geoDistance = geoDistance; } @@ -165,10 +171,14 @@ public RankingInfo geoPrecision(Integer geoPrecision) { @ApiModelProperty( value = "Precision used when computing the geo distance, in meters." ) + @JsonProperty(JSON_PROPERTY_GEO_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getGeoPrecision() { return geoPrecision; } + @JsonProperty(JSON_PROPERTY_GEO_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGeoPrecision(Integer geoPrecision) { this.geoPrecision = geoPrecision; } @@ -197,10 +207,14 @@ public RankingInfo putMatchedGeoLocationItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MATCHED_GEO_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMatchedGeoLocation() { return matchedGeoLocation; } + @JsonProperty(JSON_PROPERTY_MATCHED_GEO_LOCATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchedGeoLocation( Map matchedGeoLocation ) { @@ -218,10 +232,14 @@ public RankingInfo nbExactWords(Integer nbExactWords) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Number of exactly matched words.") + @JsonProperty(JSON_PROPERTY_NB_EXACT_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbExactWords() { return nbExactWords; } + @JsonProperty(JSON_PROPERTY_NB_EXACT_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbExactWords(Integer nbExactWords) { this.nbExactWords = nbExactWords; } @@ -239,10 +257,14 @@ public RankingInfo nbTypos(Integer nbTypos) { @ApiModelProperty( value = "Number of typos encountered when matching the record." ) + @JsonProperty(JSON_PROPERTY_NB_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbTypos() { return nbTypos; } + @JsonProperty(JSON_PROPERTY_NB_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbTypos(Integer nbTypos) { this.nbTypos = nbTypos; } @@ -260,10 +282,14 @@ public RankingInfo promoted(Boolean promoted) { @ApiModelProperty( value = "Present and set to true if a Rule promoted the hit." ) + @JsonProperty(JSON_PROPERTY_PROMOTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPromoted() { return promoted; } + @JsonProperty(JSON_PROPERTY_PROMOTED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPromoted(Boolean promoted) { this.promoted = promoted; } @@ -281,10 +307,14 @@ public RankingInfo proximityDistance(Integer proximityDistance) { @ApiModelProperty( value = "When the query contains more than one word, the sum of the distances between matched words (in meters)." ) + @JsonProperty(JSON_PROPERTY_PROXIMITY_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getProximityDistance() { return proximityDistance; } + @JsonProperty(JSON_PROPERTY_PROXIMITY_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setProximityDistance(Integer proximityDistance) { this.proximityDistance = proximityDistance; } @@ -302,10 +332,14 @@ public RankingInfo userScore(Integer userScore) { @ApiModelProperty( value = "Custom ranking for the object, expressed as a single integer value." ) + @JsonProperty(JSON_PROPERTY_USER_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getUserScore() { return userScore; } + @JsonProperty(JSON_PROPERTY_USER_SCORE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserScore(Integer userScore) { this.userScore = userScore; } @@ -323,10 +357,14 @@ public RankingInfo word(Integer word) { @ApiModelProperty( value = "Number of matched words, including prefixes and typos." ) + @JsonProperty(JSON_PROPERTY_WORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getWord() { return word; } + @JsonProperty(JSON_PROPERTY_WORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setWord(Integer word) { this.word = word; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java index 5da7af8d7b..41778441f8 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -12,36 +12,38 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * RankingInfoMatchedGeoLocation */ - +@JsonPropertyOrder( + { + RankingInfoMatchedGeoLocation.JSON_PROPERTY_LAT, + RankingInfoMatchedGeoLocation.JSON_PROPERTY_LNG, + RankingInfoMatchedGeoLocation.JSON_PROPERTY_DISTANCE, + } +) +@JsonTypeName("rankingInfo_matchedGeoLocation") public class RankingInfoMatchedGeoLocation { - public static final String SERIALIZED_NAME_LAT = "lat"; - - @SerializedName(SERIALIZED_NAME_LAT) + public static final String JSON_PROPERTY_LAT = "lat"; private Double lat; - public static final String SERIALIZED_NAME_LNG = "lng"; - - @SerializedName(SERIALIZED_NAME_LNG) + public static final String JSON_PROPERTY_LNG = "lng"; private Double lng; - public static final String SERIALIZED_NAME_DISTANCE = "distance"; - - @SerializedName(SERIALIZED_NAME_DISTANCE) + public static final String JSON_PROPERTY_DISTANCE = "distance"; private Integer distance; public RankingInfoMatchedGeoLocation lat(Double lat) { @@ -55,10 +57,14 @@ public RankingInfoMatchedGeoLocation lat(Double lat) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Latitude of the matched location.") + @JsonProperty(JSON_PROPERTY_LAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Double getLat() { return lat; } + @JsonProperty(JSON_PROPERTY_LAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLat(Double lat) { this.lat = lat; } @@ -74,10 +80,14 @@ public RankingInfoMatchedGeoLocation lng(Double lng) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Longitude of the matched location.") + @JsonProperty(JSON_PROPERTY_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Double getLng() { return lng; } + @JsonProperty(JSON_PROPERTY_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLng(Double lng) { this.lng = lng; } @@ -95,10 +105,14 @@ public RankingInfoMatchedGeoLocation distance(Integer distance) { @ApiModelProperty( value = "Distance between the matched location and the search location (in meters)." ) + @JsonProperty(JSON_PROPERTY_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistance() { return distance; } + @JsonProperty(JSON_PROPERTY_DISTANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistance(Integer distance) { this.distance = distance; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java index bdc36ff015..87d8af79f4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -15,14 +15,15 @@ import com.algolia.model.HighlightResult; import com.algolia.model.RankingInfo; import com.algolia.model.SnippetResult; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -32,33 +33,32 @@ * A single record. */ @ApiModel(description = "A single record.") +@JsonPropertyOrder( + { + Record.JSON_PROPERTY_OBJECT_I_D, + Record.JSON_PROPERTY_HIGHLIGHT_RESULT, + Record.JSON_PROPERTY_SNIPPET_RESULT, + Record.JSON_PROPERTY_RANKING_INFO, + Record.JSON_PROPERTY_DISTINCT_SEQ_I_D, + } +) +@JsonTypeName("record") public class Record extends HashMap { - public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; - - @SerializedName(SERIALIZED_NAME_OBJECT_I_D) + public static final String JSON_PROPERTY_OBJECT_I_D = "objectID"; private String objectID; - public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = + public static final String JSON_PROPERTY_HIGHLIGHT_RESULT = "_highlightResult"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_RESULT) private HighlightResult highlightResult; - public static final String SERIALIZED_NAME_SNIPPET_RESULT = "_snippetResult"; - - @SerializedName(SERIALIZED_NAME_SNIPPET_RESULT) + public static final String JSON_PROPERTY_SNIPPET_RESULT = "_snippetResult"; private SnippetResult snippetResult; - public static final String SERIALIZED_NAME_RANKING_INFO = "_rankingInfo"; - - @SerializedName(SERIALIZED_NAME_RANKING_INFO) + public static final String JSON_PROPERTY_RANKING_INFO = "_rankingInfo"; private RankingInfo rankingInfo; - public static final String SERIALIZED_NAME_DISTINCT_SEQ_I_D = - "_distinctSeqID"; - - @SerializedName(SERIALIZED_NAME_DISTINCT_SEQ_I_D) + public static final String JSON_PROPERTY_DISTINCT_SEQ_I_D = "_distinctSeqID"; private Integer distinctSeqID; public Record objectID(String objectID) { @@ -72,10 +72,14 @@ public Record objectID(String objectID) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Unique identifier of the object.") + @JsonProperty(JSON_PROPERTY_OBJECT_I_D) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getObjectID() { return objectID; } + @JsonProperty(JSON_PROPERTY_OBJECT_I_D) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setObjectID(String objectID) { this.objectID = objectID; } @@ -91,10 +95,14 @@ public Record highlightResult(HighlightResult highlightResult) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public HighlightResult getHighlightResult() { return highlightResult; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightResult(HighlightResult highlightResult) { this.highlightResult = highlightResult; } @@ -110,10 +118,14 @@ public Record snippetResult(SnippetResult snippetResult) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SNIPPET_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public SnippetResult getSnippetResult() { return snippetResult; } + @JsonProperty(JSON_PROPERTY_SNIPPET_RESULT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetResult(SnippetResult snippetResult) { this.snippetResult = snippetResult; } @@ -129,10 +141,14 @@ public Record rankingInfo(RankingInfo rankingInfo) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RankingInfo getRankingInfo() { return rankingInfo; } + @JsonProperty(JSON_PROPERTY_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRankingInfo(RankingInfo rankingInfo) { this.rankingInfo = rankingInfo; } @@ -148,10 +164,14 @@ public Record distinctSeqID(Integer distinctSeqID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_DISTINCT_SEQ_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinctSeqID() { return distinctSeqID; } + @JsonProperty(JSON_PROPERTY_DISTINCT_SEQ_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinctSeqID(Integer distinctSeqID) { this.distinctSeqID = distinctSeqID; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index 44cee476c6..0df481b6d9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -12,36 +12,38 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * SaveObjectResponse */ - +@JsonPropertyOrder( + { + SaveObjectResponse.JSON_PROPERTY_CREATED_AT, + SaveObjectResponse.JSON_PROPERTY_TASK_I_D, + SaveObjectResponse.JSON_PROPERTY_OBJECT_I_D, + } +) +@JsonTypeName("saveObjectResponse") public class SaveObjectResponse { - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) + public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; private String createdAt; - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) + public static final String JSON_PROPERTY_TASK_I_D = "taskID"; private Integer taskID; - public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; - - @SerializedName(SERIALIZED_NAME_OBJECT_I_D) + public static final String JSON_PROPERTY_OBJECT_I_D = "objectID"; private String objectID; public SaveObjectResponse createdAt(String createdAt) { @@ -55,10 +57,14 @@ public SaveObjectResponse createdAt(String createdAt) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getCreatedAt() { return createdAt; } + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } @@ -74,10 +80,14 @@ public SaveObjectResponse taskID(Integer taskID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -93,10 +103,14 @@ public SaveObjectResponse objectID(String objectID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Unique identifier of the object.") + @JsonProperty(JSON_PROPERTY_OBJECT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getObjectID() { return objectID; } + @JsonProperty(JSON_PROPERTY_OBJECT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setObjectID(String objectID) { this.objectID = objectID; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index 47a6827642..701c2d9616 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -13,14 +13,15 @@ package com.algolia.model; import com.algolia.model.Record; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -29,12 +30,11 @@ /** * SearchHits */ - +@JsonPropertyOrder({ SearchHits.JSON_PROPERTY_HITS }) +@JsonTypeName("searchHits") public class SearchHits { - public static final String SERIALIZED_NAME_HITS = "hits"; - - @SerializedName(SERIALIZED_NAME_HITS) + public static final String JSON_PROPERTY_HITS = "hits"; private List hits = null; public SearchHits hits(List hits) { @@ -56,10 +56,14 @@ public SearchHits addHitsItem(Record hitsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getHits() { return hits; } + @JsonProperty(JSON_PROPERTY_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHits(List hits) { this.hits = hits; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index c6f6c39769..6044a89441 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -15,309 +15,290 @@ import com.algolia.model.BaseSearchParams; import com.algolia.model.IndexSettingsAsSearchParams; import com.algolia.model.OneOfintegerstring; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.NoSuchElementException; import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.jackson.nullable.JsonNullable; /** * SearchParams */ - +@JsonPropertyOrder( + { + SearchParams.JSON_PROPERTY_QUERY, + SearchParams.JSON_PROPERTY_SIMILAR_QUERY, + SearchParams.JSON_PROPERTY_FILTERS, + SearchParams.JSON_PROPERTY_FACET_FILTERS, + SearchParams.JSON_PROPERTY_OPTIONAL_FILTERS, + SearchParams.JSON_PROPERTY_NUMERIC_FILTERS, + SearchParams.JSON_PROPERTY_TAG_FILTERS, + SearchParams.JSON_PROPERTY_SUM_OR_FILTERS_SCORES, + SearchParams.JSON_PROPERTY_FACETS, + SearchParams.JSON_PROPERTY_MAX_VALUES_PER_FACET, + SearchParams.JSON_PROPERTY_FACETING_AFTER_DISTINCT, + SearchParams.JSON_PROPERTY_SORT_FACET_VALUES_BY, + SearchParams.JSON_PROPERTY_PAGE, + SearchParams.JSON_PROPERTY_OFFSET, + SearchParams.JSON_PROPERTY_LENGTH, + SearchParams.JSON_PROPERTY_AROUND_LAT_LNG, + SearchParams.JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P, + SearchParams.JSON_PROPERTY_AROUND_RADIUS, + SearchParams.JSON_PROPERTY_AROUND_PRECISION, + SearchParams.JSON_PROPERTY_MINIMUM_AROUND_RADIUS, + SearchParams.JSON_PROPERTY_INSIDE_BOUNDING_BOX, + SearchParams.JSON_PROPERTY_INSIDE_POLYGON, + SearchParams.JSON_PROPERTY_NATURAL_LANGUAGES, + SearchParams.JSON_PROPERTY_RULE_CONTEXTS, + SearchParams.JSON_PROPERTY_PERSONALIZATION_IMPACT, + SearchParams.JSON_PROPERTY_USER_TOKEN, + SearchParams.JSON_PROPERTY_GET_RANKING_INFO, + SearchParams.JSON_PROPERTY_CLICK_ANALYTICS, + SearchParams.JSON_PROPERTY_ANALYTICS, + SearchParams.JSON_PROPERTY_ANALYTICS_TAGS, + SearchParams.JSON_PROPERTY_PERCENTILE_COMPUTATION, + SearchParams.JSON_PROPERTY_ENABLE_A_B_TEST, + SearchParams.JSON_PROPERTY_ENABLE_RE_RANKING, + SearchParams.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, + SearchParams.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, + SearchParams.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, + SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, + SearchParams.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, + SearchParams.JSON_PROPERTY_RANKING, + SearchParams.JSON_PROPERTY_CUSTOM_RANKING, + SearchParams.JSON_PROPERTY_RELEVANCY_STRICTNESS, + SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, + SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, + SearchParams.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, + SearchParams.JSON_PROPERTY_HIGHLIGHT_POST_TAG, + SearchParams.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, + SearchParams.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, + SearchParams.JSON_PROPERTY_HITS_PER_PAGE, + SearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, + SearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, + SearchParams.JSON_PROPERTY_TYPO_TOLERANCE, + SearchParams.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, + SearchParams.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, + SearchParams.JSON_PROPERTY_SEPARATORS_TO_INDEX, + SearchParams.JSON_PROPERTY_IGNORE_PLURALS, + SearchParams.JSON_PROPERTY_REMOVE_STOP_WORDS, + SearchParams.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, + SearchParams.JSON_PROPERTY_QUERY_LANGUAGES, + SearchParams.JSON_PROPERTY_DECOMPOUND_QUERY, + SearchParams.JSON_PROPERTY_ENABLE_RULES, + SearchParams.JSON_PROPERTY_ENABLE_PERSONALIZATION, + SearchParams.JSON_PROPERTY_QUERY_TYPE, + SearchParams.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, + SearchParams.JSON_PROPERTY_ADVANCED_SYNTAX, + SearchParams.JSON_PROPERTY_OPTIONAL_WORDS, + SearchParams.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, + SearchParams.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, + SearchParams.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, + SearchParams.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, + SearchParams.JSON_PROPERTY_DISTINCT, + SearchParams.JSON_PROPERTY_SYNONYMS, + SearchParams.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, + SearchParams.JSON_PROPERTY_MIN_PROXIMITY, + SearchParams.JSON_PROPERTY_RESPONSE_FIELDS, + SearchParams.JSON_PROPERTY_MAX_FACET_HITS, + SearchParams.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, + SearchParams.JSON_PROPERTY_RENDERING_CONTENT, + } +) +@JsonTypeName("searchParams") public class SearchParams { - public static final String SERIALIZED_NAME_QUERY = "query"; - - @SerializedName(SERIALIZED_NAME_QUERY) + public static final String JSON_PROPERTY_QUERY = "query"; private String query = ""; - public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; - - @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) + public static final String JSON_PROPERTY_SIMILAR_QUERY = "similarQuery"; private String similarQuery = ""; - public static final String SERIALIZED_NAME_FILTERS = "filters"; - - @SerializedName(SERIALIZED_NAME_FILTERS) + public static final String JSON_PROPERTY_FILTERS = "filters"; private String filters = ""; - public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; - - @SerializedName(SERIALIZED_NAME_FACET_FILTERS) + public static final String JSON_PROPERTY_FACET_FILTERS = "facetFilters"; private List facetFilters = null; - public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = - "optionalFilters"; - - @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) + public static final String JSON_PROPERTY_OPTIONAL_FILTERS = "optionalFilters"; private List optionalFilters = null; - public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; - - @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) + public static final String JSON_PROPERTY_NUMERIC_FILTERS = "numericFilters"; private List numericFilters = null; - public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; - - @SerializedName(SERIALIZED_NAME_TAG_FILTERS) + public static final String JSON_PROPERTY_TAG_FILTERS = "tagFilters"; private List tagFilters = null; - public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = + public static final String JSON_PROPERTY_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; - - @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; - public static final String SERIALIZED_NAME_FACETS = "facets"; - - @SerializedName(SERIALIZED_NAME_FACETS) + public static final String JSON_PROPERTY_FACETS = "facets"; private List facets = null; - public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = + public static final String JSON_PROPERTY_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; - - @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = + public static final String JSON_PROPERTY_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; - - @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = + public static final String JSON_PROPERTY_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; - - @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; - public static final String SERIALIZED_NAME_PAGE = "page"; - - @SerializedName(SERIALIZED_NAME_PAGE) + public static final String JSON_PROPERTY_PAGE = "page"; private Integer page = 0; - public static final String SERIALIZED_NAME_OFFSET = "offset"; - - @SerializedName(SERIALIZED_NAME_OFFSET) + public static final String JSON_PROPERTY_OFFSET = "offset"; private Integer offset; - public static final String SERIALIZED_NAME_LENGTH = "length"; - - @SerializedName(SERIALIZED_NAME_LENGTH) + public static final String JSON_PROPERTY_LENGTH = "length"; private Integer length; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; private String aroundLatLng = ""; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = + public static final String JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; - public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; - - @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) - private OneOfintegerstring aroundRadius; + public static final String JSON_PROPERTY_AROUND_RADIUS = "aroundRadius"; + private JsonNullable aroundRadius = JsonNullable.undefined(); - public static final String SERIALIZED_NAME_AROUND_PRECISION = - "aroundPrecision"; - - @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) + public static final String JSON_PROPERTY_AROUND_PRECISION = "aroundPrecision"; private Integer aroundPrecision = 10; - public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = + public static final String JSON_PROPERTY_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; - - @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = + public static final String JSON_PROPERTY_INSIDE_BOUNDING_BOX = "insideBoundingBox"; - - @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; - public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; - - @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) + public static final String JSON_PROPERTY_INSIDE_POLYGON = "insidePolygon"; private List insidePolygon = null; - public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = + public static final String JSON_PROPERTY_NATURAL_LANGUAGES = "naturalLanguages"; - - @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; - public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; - - @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) + public static final String JSON_PROPERTY_RULE_CONTEXTS = "ruleContexts"; private List ruleContexts = null; - public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = + public static final String JSON_PROPERTY_PERSONALIZATION_IMPACT = "personalizationImpact"; - - @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; - public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; - - @SerializedName(SERIALIZED_NAME_USER_TOKEN) + public static final String JSON_PROPERTY_USER_TOKEN = "userToken"; private String userToken; - public static final String SERIALIZED_NAME_GET_RANKING_INFO = - "getRankingInfo"; - - @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) + public static final String JSON_PROPERTY_GET_RANKING_INFO = "getRankingInfo"; private Boolean getRankingInfo = false; - public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; - - @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) + public static final String JSON_PROPERTY_CLICK_ANALYTICS = "clickAnalytics"; private Boolean clickAnalytics = false; - public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; - - @SerializedName(SERIALIZED_NAME_ANALYTICS) + public static final String JSON_PROPERTY_ANALYTICS = "analytics"; private Boolean analytics = true; - public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; - - @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) + public static final String JSON_PROPERTY_ANALYTICS_TAGS = "analyticsTags"; private List analyticsTags = null; - public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = + public static final String JSON_PROPERTY_PERCENTILE_COMPUTATION = "percentileComputation"; - - @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; - public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; - - @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) + public static final String JSON_PROPERTY_ENABLE_A_B_TEST = "enableABTest"; private Boolean enableABTest = true; - public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = + public static final String JSON_PROPERTY_ENABLE_RE_RANKING = "enableReRanking"; - - @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; - public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; - - @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = + public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; - - @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String SERIALIZED_NAME_RANKING = "ranking"; - - @SerializedName(SERIALIZED_NAME_RANKING) + public static final String JSON_PROPERTY_RANKING = "ranking"; private List ranking = null; - public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; - - @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) + public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; private List customRanking = null; - public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = + public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = "relevancyStrictness"; - - @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = + public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = "highlightPreTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = + public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = "highlightPostTag"; - - @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = + public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; - - @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; - - @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; - - @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = + public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; - - @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** * Controls whether typo tolerance is enabled and how it is applied. */ - @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -333,6 +314,7 @@ public enum TypoToleranceEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -342,6 +324,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -350,92 +333,50 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final TypoToleranceEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public TypoToleranceEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypoToleranceEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; - - @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) + public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; - - @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = + public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = "separatorsToIndex"; - - @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; - - @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) + public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; private String ignorePlurals = "false"; - public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = + public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = "removeStopWords"; - - @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; - - @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; - - @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) + public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; private List queryLanguages = null; - public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = - "decompoundQuery"; - - @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) + public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; private Boolean decompoundQuery = true; - public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; - - @SerializedName(SERIALIZED_NAME_ENABLE_RULES) + public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; private Boolean enableRules = true; - public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = + public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = "enablePersonalization"; - - @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** * Controls if and how query words are interpreted as prefixes. */ - @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -449,6 +390,7 @@ public enum QueryTypeEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -458,6 +400,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -466,35 +409,14 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final QueryTypeEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public QueryTypeEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return QueryTypeEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; - - @SerializedName(SERIALIZED_NAME_QUERY_TYPE) + public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** * Selects a strategy to remove words from the query when it doesn’t match any hits. */ - @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -510,6 +432,7 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -519,6 +442,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -527,54 +451,26 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final RemoveWordsIfNoResultsEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return RemoveWordsIfNoResultsEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = + public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; - - @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) + public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; private Boolean advancedSyntax = false; - public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; - - @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) + public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; private List optionalWords = null; - public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; - - @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** * Controls how the exact ranking criterion is computed when the query contains only one word. */ - @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -588,6 +484,7 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -597,6 +494,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -605,38 +503,16 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final ExactOnSingleWordQueryEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ExactOnSingleWordQueryEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = + public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; - - @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** * Gets or Sets alternativesAsExact */ - @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -650,6 +526,7 @@ public enum AlternativesAsExactEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -659,6 +536,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -667,36 +545,15 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AlternativesAsExactEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AlternativesAsExactEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AlternativesAsExactEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = + public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; - - @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** * Gets or Sets advancedSyntaxFeatures */ - @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -708,6 +565,7 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -717,6 +575,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -725,74 +584,37 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter - extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final AdvancedSyntaxFeaturesEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return AdvancedSyntaxFeaturesEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = + public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; - - @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String SERIALIZED_NAME_DISTINCT = "distinct"; - - @SerializedName(SERIALIZED_NAME_DISTINCT) + public static final String JSON_PROPERTY_DISTINCT = "distinct"; private Integer distinct = 0; - public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; - - @SerializedName(SERIALIZED_NAME_SYNONYMS) + public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; private Boolean synonyms = true; - public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; - - @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; - - @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) + public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; private Integer minProximity = 1; - public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; - - @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) + public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; private List responseFields = null; - public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; - - @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) + public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; private Integer maxFacetHits = 10; - public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; - - @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String SERIALIZED_NAME_RENDERING_CONTENT = + public static final String JSON_PROPERTY_RENDERING_CONTENT = "renderingContent"; - - @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public SearchParams query(String query) { @@ -806,10 +628,14 @@ public SearchParams query(String query) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -827,10 +653,14 @@ public SearchParams similarQuery(String similarQuery) { @ApiModelProperty( value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." ) + @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSimilarQuery() { return similarQuery; } + @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } @@ -848,10 +678,14 @@ public SearchParams filters(String filters) { @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." ) + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFilters() { return filters; } + @JsonProperty(JSON_PROPERTY_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(String filters) { this.filters = filters; } @@ -875,10 +709,14 @@ public SearchParams addFacetFiltersItem(String facetFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") + @JsonProperty(JSON_PROPERTY_FACET_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacetFilters() { return facetFilters; } + @JsonProperty(JSON_PROPERTY_FACET_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } @@ -904,10 +742,14 @@ public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { @ApiModelProperty( value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." ) + @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalFilters() { return optionalFilters; } + @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } @@ -931,10 +773,14 @@ public SearchParams addNumericFiltersItem(String numericFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") + @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericFilters() { return numericFilters; } + @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } @@ -958,10 +804,14 @@ public SearchParams addTagFiltersItem(String tagFiltersItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getTagFilters() { return tagFilters; } + @JsonProperty(JSON_PROPERTY_TAG_FILTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } @@ -979,10 +829,14 @@ public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { @ApiModelProperty( value = "Determines how to calculate the total score for filtering." ) + @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } + @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } @@ -1006,10 +860,14 @@ public SearchParams addFacetsItem(String facetsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacets() { return facets; } + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(List facets) { this.facets = facets; } @@ -1027,10 +885,14 @@ public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." ) + @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } + @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } @@ -1048,10 +910,14 @@ public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." ) + @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } + @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } @@ -1067,10 +933,14 @@ public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") + @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSortFacetValuesBy() { return sortFacetValuesBy; } + @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } @@ -1086,10 +956,14 @@ public SearchParams page(Integer page) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPage() { return page; } + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPage(Integer page) { this.page = page; } @@ -1105,10 +979,14 @@ public SearchParams offset(Integer offset) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getOffset() { return offset; } + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOffset(Integer offset) { this.offset = offset; } @@ -1128,10 +1006,14 @@ public SearchParams length(Integer length) { @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." ) + @JsonProperty(JSON_PROPERTY_LENGTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getLength() { return length; } + @JsonProperty(JSON_PROPERTY_LENGTH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLength(Integer length) { this.length = length; } @@ -1149,10 +1031,14 @@ public SearchParams aroundLatLng(String aroundLatLng) { @ApiModelProperty( value = "Search for entries around a central geolocation, enabling a geo search within a circular area." ) + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -1170,16 +1056,21 @@ public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { @ApiModelProperty( value = "Search for entries around a given location automatically computed from the requester’s IP address." ) + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = aroundRadius; + this.aroundRadius = JsonNullable.of(aroundRadius); + return this; } @@ -1191,14 +1082,28 @@ public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." ) + @JsonIgnore public OneOfintegerstring getAroundRadius() { + return aroundRadius.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAroundRadius_JsonNullable() { return aroundRadius; } - public void setAroundRadius(OneOfintegerstring aroundRadius) { + @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) + public void setAroundRadius_JsonNullable( + JsonNullable aroundRadius + ) { this.aroundRadius = aroundRadius; } + public void setAroundRadius(OneOfintegerstring aroundRadius) { + this.aroundRadius = JsonNullable.of(aroundRadius); + } + public SearchParams aroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; return this; @@ -1212,10 +1117,14 @@ public SearchParams aroundPrecision(Integer aroundPrecision) { @ApiModelProperty( value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." ) + @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAroundPrecision() { return aroundPrecision; } + @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } @@ -1234,10 +1143,14 @@ public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." ) + @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } + @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } @@ -1265,10 +1178,14 @@ public SearchParams addInsideBoundingBoxItem( @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." ) + @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsideBoundingBox() { return insideBoundingBox; } + @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } @@ -1292,10 +1209,14 @@ public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") + @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsidePolygon() { return insidePolygon; } + @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } @@ -1321,10 +1242,14 @@ public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { @ApiModelProperty( value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." ) + @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNaturalLanguages() { return naturalLanguages; } + @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } @@ -1348,10 +1273,14 @@ public SearchParams addRuleContextsItem(String ruleContextsItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") + @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRuleContexts() { return ruleContexts; } + @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } @@ -1367,10 +1296,14 @@ public SearchParams personalizationImpact(Integer personalizationImpact) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") + @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPersonalizationImpact() { return personalizationImpact; } + @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } @@ -1388,10 +1321,14 @@ public SearchParams userToken(String userToken) { @ApiModelProperty( value = "Associates a certain user token with the current search." ) + @JsonProperty(JSON_PROPERTY_USER_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUserToken() { return userToken; } + @JsonProperty(JSON_PROPERTY_USER_TOKEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserToken(String userToken) { this.userToken = userToken; } @@ -1407,10 +1344,14 @@ public SearchParams getRankingInfo(Boolean getRankingInfo) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") + @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getGetRankingInfo() { return getRankingInfo; } + @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } @@ -1426,10 +1367,14 @@ public SearchParams clickAnalytics(Boolean clickAnalytics) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") + @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getClickAnalytics() { return clickAnalytics; } + @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } @@ -1447,10 +1392,14 @@ public SearchParams analytics(Boolean analytics) { @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." ) + @JsonProperty(JSON_PROPERTY_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAnalytics() { return analytics; } + @JsonProperty(JSON_PROPERTY_ANALYTICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalytics(Boolean analytics) { this.analytics = analytics; } @@ -1476,10 +1425,14 @@ public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." ) + @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAnalyticsTags() { return analyticsTags; } + @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } @@ -1497,10 +1450,14 @@ public SearchParams percentileComputation(Boolean percentileComputation) { @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." ) + @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPercentileComputation() { return percentileComputation; } + @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } @@ -1518,10 +1475,14 @@ public SearchParams enableABTest(Boolean enableABTest) { @ApiModelProperty( value = "Whether this search should participate in running AB tests." ) + @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableABTest() { return enableABTest; } + @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } @@ -1537,10 +1498,14 @@ public SearchParams enableReRanking(Boolean enableReRanking) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") + @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableReRanking() { return enableReRanking; } + @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } @@ -1568,10 +1533,14 @@ public SearchParams addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } + @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -1601,10 +1570,14 @@ public SearchParams addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -1634,10 +1607,14 @@ public SearchParams addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } + @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -1665,10 +1642,14 @@ public SearchParams addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -1698,10 +1679,14 @@ public SearchParams addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } + @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -1727,10 +1712,14 @@ public SearchParams addRankingItem(String rankingItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } + @JsonProperty(JSON_PROPERTY_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -1754,10 +1743,14 @@ public SearchParams addCustomRankingItem(String customRankingItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } + @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -1775,10 +1768,14 @@ public SearchParams relevancyStrictness(Integer relevancyStrictness) { @ApiModelProperty( value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." ) + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } + @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -1806,10 +1803,14 @@ public SearchParams addAttributesToHighlightItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -1837,10 +1838,14 @@ public SearchParams addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -1858,10 +1863,14 @@ public SearchParams highlightPreTag(String highlightPreTag) { @ApiModelProperty( value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -1879,10 +1888,14 @@ public SearchParams highlightPostTag(String highlightPostTag) { @ApiModelProperty( value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." ) + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } + @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -1900,10 +1913,14 @@ public SearchParams snippetEllipsisText(String snippetEllipsisText) { @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } + @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -1923,10 +1940,14 @@ public SearchParams restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } + @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -1944,10 +1965,14 @@ public SearchParams hitsPerPage(Integer hitsPerPage) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -1965,10 +1990,14 @@ public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -1986,10 +2015,14 @@ public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { @ApiModelProperty( value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." ) + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } + @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -2007,10 +2040,14 @@ public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } + @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -2030,10 +2067,14 @@ public SearchParams allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } + @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -2065,10 +2106,14 @@ public SearchParams addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -2086,10 +2131,14 @@ public SearchParams separatorsToIndex(String separatorsToIndex) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } + @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -2107,10 +2156,14 @@ public SearchParams ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } + @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -2128,10 +2181,14 @@ public SearchParams removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } + @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -2151,10 +2208,14 @@ public SearchParams keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } + @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -2180,10 +2241,14 @@ public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { @ApiModelProperty( value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." ) + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } + @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -2201,10 +2266,14 @@ public SearchParams decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } + @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -2220,10 +2289,14 @@ public SearchParams enableRules(Boolean enableRules) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } + @JsonProperty(JSON_PROPERTY_ENABLE_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -2239,10 +2312,14 @@ public SearchParams enablePersonalization(Boolean enablePersonalization) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } + @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -2260,10 +2337,14 @@ public SearchParams queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } + @JsonProperty(JSON_PROPERTY_QUERY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -2283,10 +2364,14 @@ public SearchParams removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } + @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -2304,10 +2389,14 @@ public SearchParams advancedSyntax(Boolean advancedSyntax) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -2333,10 +2422,14 @@ public SearchParams addOptionalWordsItem(String optionalWordsItem) { @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } + @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -2366,10 +2459,14 @@ public SearchParams addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } + @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -2391,10 +2488,14 @@ public SearchParams exactOnSingleWordQuery( @ApiModelProperty( value = "Controls how the exact ranking criterion is computed when the query contains only one word." ) + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } + @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -2426,10 +2527,14 @@ public SearchParams addAlternativesAsExactItem( @ApiModelProperty( value = "List of alternatives that should be considered an exact match by the exact ranking criterion." ) + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } + @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -2461,10 +2566,14 @@ public SearchParams addAdvancedSyntaxFeaturesItem( @ApiModelProperty( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." ) + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } + @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -2484,10 +2593,14 @@ public SearchParams distinct(Integer distinct) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } + @JsonProperty(JSON_PROPERTY_DISTINCT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -2505,10 +2618,14 @@ public SearchParams synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } + @JsonProperty(JSON_PROPERTY_SYNONYMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -2528,10 +2645,14 @@ public SearchParams replaceSynonymsInHighlight( @ApiModelProperty( value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." ) + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } + @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -2551,10 +2672,14 @@ public SearchParams minProximity(Integer minProximity) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } + @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -2580,10 +2705,14 @@ public SearchParams addResponseFieldsItem(String responseFieldsItem) { @ApiModelProperty( value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." ) + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } + @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -2601,10 +2730,14 @@ public SearchParams maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } + @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -2625,10 +2758,14 @@ public SearchParams attributeCriteriaComputedByMinProximity( @ApiModelProperty( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." ) + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } + @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -2649,10 +2786,14 @@ public SearchParams renderingContent(Object renderingContent) { @ApiModelProperty( value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." ) + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } + @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } @@ -2690,7 +2831,7 @@ public boolean equals(Object o) { Objects.equals(this.length, searchParams.length) && Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && - Objects.equals(this.aroundRadius, searchParams.aroundRadius) && + equalsNullable(this.aroundRadius, searchParams.aroundRadius) && Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && Objects.equals( this.minimumAroundRadius, @@ -2867,7 +3008,7 @@ public int hashCode() { length, aroundLatLng, aroundLatLngViaIP, - aroundRadius, + hashCodeNullable(aroundRadius), aroundPrecision, minimumAroundRadius, insideBoundingBox, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java index f4243141c8..6627067d52 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java @@ -12,26 +12,26 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * SearchParamsAsString */ - +@JsonPropertyOrder({ SearchParamsAsString.JSON_PROPERTY_PARAMS }) +@JsonTypeName("searchParamsAsString") public class SearchParamsAsString { - public static final String SERIALIZED_NAME_PARAMS = "params"; - - @SerializedName(SERIALIZED_NAME_PARAMS) + public static final String JSON_PROPERTY_PARAMS = "params"; private String params; public SearchParamsAsString params(String params) { @@ -45,10 +45,14 @@ public SearchParamsAsString params(String params) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParams() { return params; } + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParams(String params) { this.params = params; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index ab4338b8be..1c5b37b671 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -16,14 +16,15 @@ import com.algolia.model.BaseSearchResponseFacetsStats; import com.algolia.model.Record; import com.algolia.model.SearchHits; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -34,138 +35,116 @@ /** * SearchResponse */ - +@JsonPropertyOrder( + { + SearchResponse.JSON_PROPERTY_AB_TEST_I_D, + SearchResponse.JSON_PROPERTY_AB_TEST_VARIANT_I_D, + SearchResponse.JSON_PROPERTY_AROUND_LAT_LNG, + SearchResponse.JSON_PROPERTY_AUTOMATIC_RADIUS, + SearchResponse.JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT, + SearchResponse.JSON_PROPERTY_EXHAUSTIVE_NB_HITS, + SearchResponse.JSON_PROPERTY_EXHAUSTIVE_TYPO, + SearchResponse.JSON_PROPERTY_FACETS, + SearchResponse.JSON_PROPERTY_FACETS_STATS, + SearchResponse.JSON_PROPERTY_HITS_PER_PAGE, + SearchResponse.JSON_PROPERTY_INDEX, + SearchResponse.JSON_PROPERTY_INDEX_USED, + SearchResponse.JSON_PROPERTY_MESSAGE, + SearchResponse.JSON_PROPERTY_NB_HITS, + SearchResponse.JSON_PROPERTY_NB_PAGES, + SearchResponse.JSON_PROPERTY_NB_SORTED_HITS, + SearchResponse.JSON_PROPERTY_PAGE, + SearchResponse.JSON_PROPERTY_PARAMS, + SearchResponse.JSON_PROPERTY_PARSED_QUERY, + SearchResponse.JSON_PROPERTY_PROCESSING_TIME_M_S, + SearchResponse.JSON_PROPERTY_QUERY, + SearchResponse.JSON_PROPERTY_QUERY_AFTER_REMOVAL, + SearchResponse.JSON_PROPERTY_SERVER_USED, + SearchResponse.JSON_PROPERTY_USER_DATA, + SearchResponse.JSON_PROPERTY_HITS, + } +) +@JsonTypeName("searchResponse") public class SearchResponse { - public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; - - @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) + public static final String JSON_PROPERTY_AB_TEST_I_D = "abTestID"; private Integer abTestID; - public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = + public static final String JSON_PROPERTY_AB_TEST_VARIANT_I_D = "abTestVariantID"; - - @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; - public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; - - @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) + public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; private String aroundLatLng; - public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = - "automaticRadius"; - - @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) + public static final String JSON_PROPERTY_AUTOMATIC_RADIUS = "automaticRadius"; private String automaticRadius; - public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = + public static final String JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = + public static final String JSON_PROPERTY_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; - public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; - - @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) + public static final String JSON_PROPERTY_EXHAUSTIVE_TYPO = "exhaustiveTypo"; private Boolean exhaustiveTypo; - public static final String SERIALIZED_NAME_FACETS = "facets"; - - @SerializedName(SERIALIZED_NAME_FACETS) + public static final String JSON_PROPERTY_FACETS = "facets"; private Map> facets = null; - public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; - - @SerializedName(SERIALIZED_NAME_FACETS_STATS) + public static final String JSON_PROPERTY_FACETS_STATS = "facets_stats"; private Map facetsStats = null; - public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; - - @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) + public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; private Integer hitsPerPage = 20; - public static final String SERIALIZED_NAME_INDEX = "index"; - - @SerializedName(SERIALIZED_NAME_INDEX) + public static final String JSON_PROPERTY_INDEX = "index"; private String index; - public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; - - @SerializedName(SERIALIZED_NAME_INDEX_USED) + public static final String JSON_PROPERTY_INDEX_USED = "indexUsed"; private String indexUsed; - public static final String SERIALIZED_NAME_MESSAGE = "message"; - - @SerializedName(SERIALIZED_NAME_MESSAGE) + public static final String JSON_PROPERTY_MESSAGE = "message"; private String message; - public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; - - @SerializedName(SERIALIZED_NAME_NB_HITS) + public static final String JSON_PROPERTY_NB_HITS = "nbHits"; private Integer nbHits; - public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; - - @SerializedName(SERIALIZED_NAME_NB_PAGES) + public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; private Integer nbPages; - public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; - - @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) + public static final String JSON_PROPERTY_NB_SORTED_HITS = "nbSortedHits"; private Integer nbSortedHits; - public static final String SERIALIZED_NAME_PAGE = "page"; - - @SerializedName(SERIALIZED_NAME_PAGE) + public static final String JSON_PROPERTY_PAGE = "page"; private Integer page = 0; - public static final String SERIALIZED_NAME_PARAMS = "params"; - - @SerializedName(SERIALIZED_NAME_PARAMS) + public static final String JSON_PROPERTY_PARAMS = "params"; private String params; - public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; - - @SerializedName(SERIALIZED_NAME_PARSED_QUERY) + public static final String JSON_PROPERTY_PARSED_QUERY = "parsedQuery"; private String parsedQuery; - public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = + public static final String JSON_PROPERTY_PROCESSING_TIME_M_S = "processingTimeMS"; - - @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; - public static final String SERIALIZED_NAME_QUERY = "query"; - - @SerializedName(SERIALIZED_NAME_QUERY) + public static final String JSON_PROPERTY_QUERY = "query"; private String query = ""; - public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = + public static final String JSON_PROPERTY_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; - - @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; - public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; - - @SerializedName(SERIALIZED_NAME_SERVER_USED) + public static final String JSON_PROPERTY_SERVER_USED = "serverUsed"; private String serverUsed; - public static final String SERIALIZED_NAME_USER_DATA = "userData"; - - @SerializedName(SERIALIZED_NAME_USER_DATA) + public static final String JSON_PROPERTY_USER_DATA = "userData"; private Map userData = null; - public static final String SERIALIZED_NAME_HITS = "hits"; - - @SerializedName(SERIALIZED_NAME_HITS) + public static final String JSON_PROPERTY_HITS = "hits"; private List hits = new ArrayList<>(); public SearchResponse abTestID(Integer abTestID) { @@ -181,10 +160,14 @@ public SearchResponse abTestID(Integer abTestID) { @ApiModelProperty( value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." ) + @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestID() { return abTestID; } + @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } @@ -202,10 +185,14 @@ public SearchResponse abTestVariantID(Integer abTestVariantID) { @ApiModelProperty( value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." ) + @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestVariantID() { return abTestVariantID; } + @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } @@ -221,10 +208,14 @@ public SearchResponse aroundLatLng(String aroundLatLng) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } + @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -242,10 +233,14 @@ public SearchResponse automaticRadius(String automaticRadius) { @ApiModelProperty( value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." ) + @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAutomaticRadius() { return automaticRadius; } + @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } @@ -263,10 +258,14 @@ public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } @@ -285,10 +284,14 @@ public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { required = true, value = "Indicate if the nbHits count was exhaustive or approximate" ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } @@ -307,10 +310,14 @@ public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { required = true, value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" ) + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } + @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } @@ -340,10 +347,14 @@ public SearchResponse putFacetsItem( example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts." ) + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getFacets() { return facets; } + @JsonProperty(JSON_PROPERTY_FACETS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(Map> facets) { this.facets = facets; } @@ -372,10 +383,14 @@ public SearchResponse putFacetsStatsItem( **/ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") + @JsonProperty(JSON_PROPERTY_FACETS_STATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getFacetsStats() { return facetsStats; } + @JsonProperty(JSON_PROPERTY_FACETS_STATS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetsStats( Map facetsStats ) { @@ -393,10 +408,14 @@ public SearchResponse hitsPerPage(Integer hitsPerPage) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getHitsPerPage() { return hitsPerPage; } + @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -415,10 +434,14 @@ public SearchResponse index(String index) { example = "indexName", value = "Index name used for the query." ) + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndex() { return index; } + @JsonProperty(JSON_PROPERTY_INDEX) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndex(String index) { this.index = index; } @@ -437,10 +460,14 @@ public SearchResponse indexUsed(String indexUsed) { example = "indexNameAlt", value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." ) + @JsonProperty(JSON_PROPERTY_INDEX_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndexUsed() { return indexUsed; } + @JsonProperty(JSON_PROPERTY_INDEX_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } @@ -456,10 +483,14 @@ public SearchResponse message(String message) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } + @JsonProperty(JSON_PROPERTY_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } @@ -479,10 +510,14 @@ public SearchResponse nbHits(Integer nbHits) { required = true, value = "Number of hits that the search query matched" ) + @JsonProperty(JSON_PROPERTY_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbHits() { return nbHits; } + @JsonProperty(JSON_PROPERTY_NB_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } @@ -502,10 +537,14 @@ public SearchResponse nbPages(Integer nbPages) { required = true, value = "Number of pages available for the current query" ) + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbPages() { return nbPages; } + @JsonProperty(JSON_PROPERTY_NB_PAGES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } @@ -524,10 +563,14 @@ public SearchResponse nbSortedHits(Integer nbSortedHits) { example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm" ) + @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbSortedHits() { return nbSortedHits; } + @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } @@ -543,10 +586,14 @@ public SearchResponse page(Integer page) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getPage() { return page; } + @JsonProperty(JSON_PROPERTY_PAGE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPage(Integer page) { this.page = page; } @@ -566,10 +613,14 @@ public SearchResponse params(String params) { required = true, value = "A url-encoded string of all search parameters." ) + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getParams() { return params; } + @JsonProperty(JSON_PROPERTY_PARAMS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setParams(String params) { this.params = params; } @@ -587,10 +638,14 @@ public SearchResponse parsedQuery(String parsedQuery) { @ApiModelProperty( value = "The query string that will be searched, after normalization." ) + @JsonProperty(JSON_PROPERTY_PARSED_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParsedQuery() { return parsedQuery; } + @JsonProperty(JSON_PROPERTY_PARSED_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } @@ -610,10 +665,14 @@ public SearchResponse processingTimeMS(Integer processingTimeMS) { required = true, value = "Time the server took to process the request, in milliseconds." ) + @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getProcessingTimeMS() { return processingTimeMS; } + @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } @@ -629,10 +688,14 @@ public SearchResponse query(String query) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } + @JsonProperty(JSON_PROPERTY_QUERY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -650,10 +713,14 @@ public SearchResponse queryAfterRemoval(String queryAfterRemoval) { @ApiModelProperty( value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." ) + @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQueryAfterRemoval() { return queryAfterRemoval; } + @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } @@ -671,10 +738,14 @@ public SearchResponse serverUsed(String serverUsed) { @ApiModelProperty( value = "Actual host name of the server that processed the request." ) + @JsonProperty(JSON_PROPERTY_SERVER_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getServerUsed() { return serverUsed; } + @JsonProperty(JSON_PROPERTY_SERVER_USED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } @@ -698,10 +769,20 @@ public SearchResponse putUserDataItem(String key, Object userDataItem) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public Map getUserData() { return userData; } + @JsonProperty(JSON_PROPERTY_USER_DATA) + @JsonInclude( + content = JsonInclude.Include.ALWAYS, + value = JsonInclude.Include.USE_DEFAULTS + ) public void setUserData(Map userData) { this.userData = userData; } @@ -722,10 +803,14 @@ public SearchResponse addHitsItem(Record hitsItem) { **/ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getHits() { return hits; } + @JsonProperty(JSON_PROPERTY_HITS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHits(List hits) { this.hits = hits; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 8ad15e0b56..89a0937554 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -12,14 +12,15 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.Objects; @@ -27,17 +28,19 @@ /** * SetSettingsResponse */ - +@JsonPropertyOrder( + { + SetSettingsResponse.JSON_PROPERTY_TASK_I_D, + SetSettingsResponse.JSON_PROPERTY_UPDATED_AT, + } +) +@JsonTypeName("setSettingsResponse") public class SetSettingsResponse { - public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; - - @SerializedName(SERIALIZED_NAME_TASK_I_D) + public static final String JSON_PROPERTY_TASK_I_D = "taskID"; private Integer taskID; - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) + public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; private OffsetDateTime updatedAt; public SetSettingsResponse taskID(Integer taskID) { @@ -51,10 +54,14 @@ public SetSettingsResponse taskID(Integer taskID) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } + @JsonProperty(JSON_PROPERTY_TASK_I_D) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -70,10 +77,14 @@ public SetSettingsResponse updatedAt(OffsetDateTime updatedAt) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getUpdatedAt() { return updatedAt; } + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java index e704f86d0c..179b21b74b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -12,32 +12,33 @@ package com.algolia.model; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; import java.util.Arrays; import java.util.Objects; /** * SnippetResult */ - +@JsonPropertyOrder( + { SnippetResult.JSON_PROPERTY_VALUE, SnippetResult.JSON_PROPERTY_MATCH_LEVEL } +) +@JsonTypeName("snippetResult") public class SnippetResult { - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) + public static final String JSON_PROPERTY_VALUE = "value"; private String value; /** * Indicates how well the attribute matched the search query. */ - @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), @@ -51,6 +52,7 @@ public enum MatchLevelEnum { this.value = value; } + @JsonValue public String getValue() { return value; } @@ -60,6 +62,7 @@ public String toString() { return String.valueOf(value); } + @JsonCreator public static MatchLevelEnum fromValue(String value) { for (MatchLevelEnum b : MatchLevelEnum.values()) { if (b.value.equals(value)) { @@ -68,29 +71,9 @@ public static MatchLevelEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - - public static class Adapter extends TypeAdapter { - - @Override - public void write( - final JsonWriter jsonWriter, - final MatchLevelEnum enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public MatchLevelEnum read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return MatchLevelEnum.fromValue(value); - } - } } - public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; - - @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) + public static final String JSON_PROPERTY_MATCH_LEVEL = "matchLevel"; private MatchLevelEnum matchLevel; public SnippetResult value(String value) { @@ -107,10 +90,14 @@ public SnippetResult value(String value) { example = "George Clooney...", value = "Markup text with occurrences highlighted." ) + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getValue() { return value; } + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValue(String value) { this.value = value; } @@ -128,10 +115,14 @@ public SnippetResult matchLevel(MatchLevelEnum matchLevel) { @ApiModelProperty( value = "Indicates how well the attribute matched the search query." ) + @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public MatchLevelEnum getMatchLevel() { return matchLevel; } + @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index af8ac2d62a..59c385ad87 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -1,25 +1,8 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.search; -import com.algolia.ApiCallback; import com.algolia.ApiClient; -import com.algolia.ApiException; -import com.algolia.ApiResponse; -import com.algolia.Configuration; -import com.algolia.Pair; -import com.algolia.ProgressRequestBody; -import com.algolia.ProgressResponseBody; +import com.algolia.EncodingUtils; +import com.algolia.model.ApiResponse; import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; import com.algolia.model.DeleteIndexResponse; @@ -35,1598 +18,375 @@ import com.algolia.model.SearchResponse; import com.algolia.model.SetSettingsResponse; import com.algolia.model.UNKNOWN_BASE_TYPE; -import com.google.gson.reflect.TypeToken; -import java.io.IOException; -import java.lang.reflect.Type; +import feign.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -public class SearchApi { - - private ApiClient localVarApiClient; - - public SearchApi() { - this(Configuration.getDefaultApiClient()); - } - - public SearchApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - /** - * Build call for batch - * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call batchCall( - String indexName, - BatchObject batchObject, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = batchObject; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}/batch".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call batchValidateBeforeCall( - String indexName, - BatchObject batchObject, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling batch(Async)" - ); - } - - // verify the required parameter 'batchObject' is set - if (batchObject == null) { - throw new ApiException( - "Missing the required parameter 'batchObject' when calling batch(Async)" - ); - } - - okhttp3.Call localVarCall = batchCall(indexName, batchObject, _callback); - return localVarCall; - } - - /** - * - * Performs multiple write operations in a single API call. - * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) - * @return BatchResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public BatchResponse batch(String indexName, BatchObject batchObject) - throws ApiException { - ApiResponse localVarResp = batchWithHttpInfo( - indexName, - batchObject - ); - return localVarResp.getData(); - } - - /** - * - * Performs multiple write operations in a single API call. - * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) - * @return ApiResponse<BatchResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse batchWithHttpInfo( - String indexName, +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" +) +public interface SearchApi extends ApiClient.Api { + /** + * + * Performs multiple write operations in a single API call. + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @return BatchResponse + */ + @RequestLine("POST /1/indexes/{indexName}/batch") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + BatchResponse batch( + @Param("indexName") String indexName, BatchObject batchObject - ) throws ApiException { - okhttp3.Call localVarCall = batchValidateBeforeCall( - indexName, - batchObject, - null - ); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * (asynchronously) - * Performs multiple write operations in a single API call. - * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call batchAsync( - String indexName, - BatchObject batchObject, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = batchValidateBeforeCall( - indexName, - batchObject, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for deleteIndex - * @param indexName The index in which to perform the request. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call deleteIndexCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call deleteIndexValidateBeforeCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteIndex(Async)" - ); - } - - okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); - return localVarCall; - } - - /** - * Delete index. - * Delete an existing index. - * @param indexName The index in which to perform the request. (required) - * @return DeleteIndexResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { - ApiResponse localVarResp = deleteIndexWithHttpInfo( - indexName - ); - return localVarResp.getData(); - } - - /** - * Delete index. - * Delete an existing index. - * @param indexName The index in which to perform the request. (required) - * @return ApiResponse<DeleteIndexResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse deleteIndexWithHttpInfo( - String indexName - ) throws ApiException { - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Delete index. (asynchronously) - * Delete an existing index. - * @param indexName The index in which to perform the request. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call deleteIndexAsync( - String indexName, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall( - indexName, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for getSettings - * @param indexName The index in which to perform the request. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call getSettingsCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}/settings".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingsValidateBeforeCall( - String indexName, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling getSettings(Async)" - ); - } - - okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); - return localVarCall; - } - - /** - * - * Retrieve settings of a given indexName. - * @param indexName The index in which to perform the request. (required) - * @return IndexSettings - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public IndexSettings getSettings(String indexName) throws ApiException { - ApiResponse localVarResp = getSettingsWithHttpInfo( - indexName - ); - return localVarResp.getData(); - } - - /** - * - * Retrieve settings of a given indexName. - * @param indexName The index in which to perform the request. (required) - * @return ApiResponse<IndexSettings> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse getSettingsWithHttpInfo(String indexName) - throws ApiException { - okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * (asynchronously) - * Retrieve settings of a given indexName. - * @param indexName The index in which to perform the request. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call getSettingsAsync( - String indexName, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = getSettingsValidateBeforeCall( - indexName, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for listIndices - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call listIndicesCall( - Integer page, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/1/indexes"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (page != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("Page", page) - ); - } - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listIndicesValidateBeforeCall( - Integer page, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = listIndicesCall(page, _callback); - return localVarCall; - } - - /** - * List existing indexes. - * List existing indexes from an application. - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * @return ListIndicesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ListIndicesResponse listIndices(Integer page) throws ApiException { - ApiResponse localVarResp = listIndicesWithHttpInfo( - page - ); - return localVarResp.getData(); - } - - /** - * List existing indexes. - * List existing indexes from an application. - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * @return ApiResponse<ListIndicesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse listIndicesWithHttpInfo(Integer page) - throws ApiException { - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * List existing indexes. (asynchronously) - * List existing indexes from an application. - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call listIndicesAsync( - Integer page, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for multipleQueries - * @param multipleQueriesObject (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call multipleQueriesCall( - MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = multipleQueriesObject; - - // create path and map variables - String localVarPath = "/1/indexes/*/queries"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call multipleQueriesValidateBeforeCall( - MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'multipleQueriesObject' is set - if (multipleQueriesObject == null) { - throw new ApiException( - "Missing the required parameter 'multipleQueriesObject' when calling multipleQueries(Async)" - ); + ); + + /** + * + * Similar to batch but it also returns the http response headers . + * Performs multiple write operations in a single API call. + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /1/indexes/{indexName}/batch") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse batchWithHttpInfo( + @Param("indexName") String indexName, + BatchObject batchObject + ); + + /** + * Delete index. + * Delete an existing index. + * @param indexName The index in which to perform the request. (required) + * @return DeleteIndexResponse + */ + @RequestLine("DELETE /1/indexes/{indexName}") + @Headers({ "Accept: application/json" }) + DeleteIndexResponse deleteIndex(@Param("indexName") String indexName); + + /** + * Delete index. + * Similar to deleteIndex but it also returns the http response headers . + * Delete an existing index. + * @param indexName The index in which to perform the request. (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("DELETE /1/indexes/{indexName}") + @Headers({ "Accept: application/json" }) + ApiResponse deleteIndexWithHttpInfo( + @Param("indexName") String indexName + ); + + /** + * + * Retrieve settings of a given indexName. + * @param indexName The index in which to perform the request. (required) + * @return IndexSettings + */ + @RequestLine("GET /1/indexes/{indexName}/settings") + @Headers({ "Accept: application/json" }) + IndexSettings getSettings(@Param("indexName") String indexName); + + /** + * + * Similar to getSettings but it also returns the http response headers . + * Retrieve settings of a given indexName. + * @param indexName The index in which to perform the request. (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /1/indexes/{indexName}/settings") + @Headers({ "Accept: application/json" }) + ApiResponse getSettingsWithHttpInfo( + @Param("indexName") String indexName + ); + + /** + * List existing indexes. + * List existing indexes from an application. + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @return ListIndicesResponse + */ + @RequestLine("GET /1/indexes?Page={page}") + @Headers({ "Accept: application/json" }) + ListIndicesResponse listIndices(@Param("page") Integer page); + + /** + * List existing indexes. + * Similar to listIndices but it also returns the http response headers . + * List existing indexes from an application. + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /1/indexes?Page={page}") + @Headers({ "Accept: application/json" }) + ApiResponse listIndicesWithHttpInfo( + @Param("page") Integer page + ); + + /** + * List existing indexes. + * List existing indexes from an application. + * Note, this is equivalent to the other listIndices method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link ListIndicesQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional)
  • + *
+ * @return ListIndicesResponse + */ + @RequestLine("GET /1/indexes?Page={page}") + @Headers({ "Accept: application/json" }) + ListIndicesResponse listIndices( + @QueryMap(encoded = true) Map queryParams + ); + + /** + * List existing indexes. + * List existing indexes from an application. + * Note, this is equivalent to the other listIndices that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional)
  • + *
+ * @return ListIndicesResponse + */ + @RequestLine("GET /1/indexes?Page={page}") + @Headers({ "Accept: application/json" }) + ApiResponse listIndicesWithHttpInfo( + @QueryMap(encoded = true) Map queryParams + ); + + /** + * A convenience class for generating query parameters for the + * listIndices method in a fluent style. + */ + public static class ListIndicesQueryParams extends HashMap { + + public ListIndicesQueryParams page(final Integer value) { + put("Page", EncodingUtils.encode(value)); + return this; } - - okhttp3.Call localVarCall = multipleQueriesCall( - multipleQueriesObject, - _callback - ); - return localVarCall; } /** - * - * Get search results for the given requests. - * @param multipleQueriesObject (required) - * @return MultipleQueriesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public MultipleQueriesResponse multipleQueries( + * + * Get search results for the given requests. + * @param multipleQueriesObject (required) + * @return MultipleQueriesResponse + */ + @RequestLine("POST /1/indexes/*/queries") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + MultipleQueriesResponse multipleQueries( MultipleQueriesObject multipleQueriesObject - ) throws ApiException { - ApiResponse localVarResp = multipleQueriesWithHttpInfo( - multipleQueriesObject - ); - return localVarResp.getData(); - } - - /** - * - * Get search results for the given requests. - * @param multipleQueriesObject (required) - * @return ApiResponse<MultipleQueriesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse multipleQueriesWithHttpInfo( + ); + + /** + * + * Similar to multipleQueries but it also returns the http response headers . + * Get search results for the given requests. + * @param multipleQueriesObject (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /1/indexes/*/queries") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse multipleQueriesWithHttpInfo( MultipleQueriesObject multipleQueriesObject - ) throws ApiException { - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( - multipleQueriesObject, - null - ); - Type localVarReturnType = new TypeToken() {} - .getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * (asynchronously) - * Get search results for the given requests. - * @param multipleQueriesObject (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call multipleQueriesAsync( - MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( - multipleQueriesObject, - _callback - ); - Type localVarReturnType = new TypeToken() {} - .getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for operationIndex - * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call operationIndexCall( - String indexName, - OperationIndexObject operationIndexObject, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = operationIndexObject; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}/operation".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call operationIndexValidateBeforeCall( - String indexName, - OperationIndexObject operationIndexObject, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling operationIndex(Async)" - ); - } - - // verify the required parameter 'operationIndexObject' is set - if (operationIndexObject == null) { - throw new ApiException( - "Missing the required parameter 'operationIndexObject' when calling operationIndex(Async)" - ); - } - - okhttp3.Call localVarCall = operationIndexCall( - indexName, - operationIndexObject, - _callback - ); - return localVarCall; - } - - /** - * Copy/move index. - * Peforms a copy or a move operation on a index. - * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @return OperationIndexResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public OperationIndexResponse operationIndex( - String indexName, + ); + + /** + * Copy/move index. + * Peforms a copy or a move operation on a index. + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return OperationIndexResponse + */ + @RequestLine("POST /1/indexes/{indexName}/operation") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + OperationIndexResponse operationIndex( + @Param("indexName") String indexName, OperationIndexObject operationIndexObject - ) throws ApiException { - ApiResponse localVarResp = operationIndexWithHttpInfo( - indexName, - operationIndexObject - ); - return localVarResp.getData(); - } - - /** - * Copy/move index. - * Peforms a copy or a move operation on a index. - * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @return ApiResponse<OperationIndexResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse operationIndexWithHttpInfo( - String indexName, + ); + + /** + * Copy/move index. + * Similar to operationIndex but it also returns the http response headers . + * Peforms a copy or a move operation on a index. + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /1/indexes/{indexName}/operation") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse operationIndexWithHttpInfo( + @Param("indexName") String indexName, OperationIndexObject operationIndexObject - ) throws ApiException { - okhttp3.Call localVarCall = operationIndexValidateBeforeCall( - indexName, - operationIndexObject, - null - ); - Type localVarReturnType = new TypeToken() {} - .getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Copy/move index. (asynchronously) - * Peforms a copy or a move operation on a index. - * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call operationIndexAsync( - String indexName, - OperationIndexObject operationIndexObject, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = operationIndexValidateBeforeCall( - indexName, - operationIndexObject, - _callback - ); - Type localVarReturnType = new TypeToken() {} - .getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for saveObject - * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call saveObjectCall( - String indexName, - Map requestBody, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = requestBody; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call saveObjectValidateBeforeCall( - String indexName, - Map requestBody, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling saveObject(Async)" - ); - } - - // verify the required parameter 'requestBody' is set - if (requestBody == null) { - throw new ApiException( - "Missing the required parameter 'requestBody' when calling saveObject(Async)" - ); - } - - okhttp3.Call localVarCall = saveObjectCall( - indexName, - requestBody, - _callback - ); - return localVarCall; - } - - /** - * - * Add an object to the index, automatically assigning it an object ID. - * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @return SaveObjectResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public SaveObjectResponse saveObject( - String indexName, + ); + + /** + * + * Add an object to the index, automatically assigning it an object ID. + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return SaveObjectResponse + */ + @RequestLine("POST /1/indexes/{indexName}") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + SaveObjectResponse saveObject( + @Param("indexName") String indexName, Map requestBody - ) throws ApiException { - ApiResponse localVarResp = saveObjectWithHttpInfo( - indexName, - requestBody - ); - return localVarResp.getData(); - } - - /** - * - * Add an object to the index, automatically assigning it an object ID. - * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @return ApiResponse<SaveObjectResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse saveObjectWithHttpInfo( - String indexName, + ); + + /** + * + * Similar to saveObject but it also returns the http response headers . + * Add an object to the index, automatically assigning it an object ID. + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /1/indexes/{indexName}") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse saveObjectWithHttpInfo( + @Param("indexName") String indexName, Map requestBody - ) throws ApiException { - okhttp3.Call localVarCall = saveObjectValidateBeforeCall( - indexName, - requestBody, - null - ); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * (asynchronously) - * Add an object to the index, automatically assigning it an object ID. - * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call saveObjectAsync( - String indexName, - Map requestBody, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = saveObjectValidateBeforeCall( - indexName, - requestBody, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for search - * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call searchCall( - String indexName, - UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = UNKNOWN_BASE_TYPE; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}/query".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call searchValidateBeforeCall( - String indexName, - UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling search(Async)" - ); - } - - // verify the required parameter 'UNKNOWN_BASE_TYPE' is set - if (UNKNOWN_BASE_TYPE == null) { - throw new ApiException( - "Missing the required parameter 'UNKNOWN_BASE_TYPE' when calling search(Async)" - ); - } - - okhttp3.Call localVarCall = searchCall( - indexName, - UNKNOWN_BASE_TYPE, - _callback - ); - return localVarCall; - } - - /** - * - * Get search results. - * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) - * @return SearchResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public SearchResponse search( - String indexName, + ); + + /** + * + * Get search results. + * @param indexName The index in which to perform the request. (required) + * @param UNKNOWN_BASE_TYPE (required) + * @return SearchResponse + */ + @RequestLine("POST /1/indexes/{indexName}/query") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + SearchResponse search( + @Param("indexName") String indexName, UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE - ) throws ApiException { - ApiResponse localVarResp = searchWithHttpInfo( - indexName, - UNKNOWN_BASE_TYPE - ); - return localVarResp.getData(); - } - - /** - * - * Get search results. - * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) - * @return ApiResponse<SearchResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse searchWithHttpInfo( - String indexName, + ); + + /** + * + * Similar to search but it also returns the http response headers . + * Get search results. + * @param indexName The index in which to perform the request. (required) + * @param UNKNOWN_BASE_TYPE (required) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("POST /1/indexes/{indexName}/query") + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse searchWithHttpInfo( + @Param("indexName") String indexName, UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE - ) throws ApiException { - okhttp3.Call localVarCall = searchValidateBeforeCall( - indexName, - UNKNOWN_BASE_TYPE, - null - ); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * (asynchronously) - * Get search results. - * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call searchAsync( - String indexName, - UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = searchValidateBeforeCall( - indexName, - UNKNOWN_BASE_TYPE, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for setSettings - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call setSettingsCall( - String indexName, + ); + + /** + * + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @return SetSettingsResponse + */ + @RequestLine( + "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" + ) + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + SetSettingsResponse setSettings( + @Param("indexName") String indexName, IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - Object localVarPostBody = indexSettings; - - // create path and map variables - String localVarPath = - "/1/indexes/{indexName}/settings".replaceAll( - "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) - ); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (forwardToReplicas != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair( - "forwardToReplicas", - forwardToReplicas - ) - ); - } - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call setSettingsValidateBeforeCall( - String indexName, + @Param("forwardToReplicas") Boolean forwardToReplicas + ); + + /** + * + * Similar to setSettings but it also returns the http response headers . + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine( + "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" + ) + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse setSettingsWithHttpInfo( + @Param("indexName") String indexName, IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - // verify the required parameter 'indexName' is set - if (indexName == null) { - throw new ApiException( - "Missing the required parameter 'indexName' when calling setSettings(Async)" - ); - } - - // verify the required parameter 'indexSettings' is set - if (indexSettings == null) { - throw new ApiException( - "Missing the required parameter 'indexSettings' when calling setSettings(Async)" - ); - } - - okhttp3.Call localVarCall = setSettingsCall( - indexName, - indexSettings, - forwardToReplicas, - _callback - ); - return localVarCall; - } - - /** - * - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @return SetSettingsResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public SetSettingsResponse setSettings( - String indexName, + @Param("forwardToReplicas") Boolean forwardToReplicas + ); + + /** + * + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * Note, this is equivalent to the other setSettings method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link SetSettingsQueryParams} class that allows for + * building up this map in a fluent style. + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. (optional)
  • + *
+ * @return SetSettingsResponse + */ + @RequestLine( + "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" + ) + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + SetSettingsResponse setSettings( + @Param("indexName") String indexName, IndexSettings indexSettings, - Boolean forwardToReplicas - ) throws ApiException { - ApiResponse localVarResp = setSettingsWithHttpInfo( - indexName, - indexSettings, - forwardToReplicas - ); - return localVarResp.getData(); - } - - /** - * - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @return ApiResponse<SetSettingsResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public ApiResponse setSettingsWithHttpInfo( - String indexName, + @QueryMap(encoded = true) Map queryParams + ); + + /** + * + * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. + * Note, this is equivalent to the other setSettings that receives the query parameters as a map, + * but this one also exposes the Http response headers + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. (optional)
  • + *
+ * @return SetSettingsResponse + */ + @RequestLine( + "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" + ) + @Headers({ "Content-Type: application/json", "Accept: application/json" }) + ApiResponse setSettingsWithHttpInfo( + @Param("indexName") String indexName, IndexSettings indexSettings, - Boolean forwardToReplicas - ) throws ApiException { - okhttp3.Call localVarCall = setSettingsValidateBeforeCall( - indexName, - indexSettings, - forwardToReplicas, - null - ); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } + @QueryMap(encoded = true) Map queryParams + ); /** - * (asynchronously) - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - -
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
- */ - public okhttp3.Call setSettingsAsync( - String indexName, - IndexSettings indexSettings, - Boolean forwardToReplicas, - final ApiCallback _callback - ) throws ApiException { - okhttp3.Call localVarCall = setSettingsValidateBeforeCall( - indexName, - indexSettings, - forwardToReplicas, - _callback - ); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; + * A convenience class for generating query parameters for the + * setSettings method in a fluent style. + */ + public static class SetSettingsQueryParams extends HashMap { + + public SetSettingsQueryParams forwardToReplicas(final Boolean value) { + put("forwardToReplicas", EncodingUtils.encode(value)); + return this; + } } } diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml index bb712df43f..c56b3916f6 100644 --- a/clients/algoliasearch-client-java-2/pom.xml +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -33,20 +33,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - org.apache.maven.plugins maven-enforcer-plugin @@ -131,8 +117,36 @@ + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + @@ -164,55 +178,133 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} + com.google.code.findbugs jsr305 3.0.2 + + + + io.github.openfeign + feign-core + ${feign-version} + + + io.github.openfeign + feign-jackson + ${feign-version} + - com.squareup.okhttp3 - okhttp - ${okhttp-version} + io.github.openfeign + feign-slf4j + ${feign-version} - com.squareup.okhttp3 - logging-interceptor - ${okhttp-version} + io.github.openfeign.form + feign-form + ${feign-form-version} - com.google.code.gson - gson - ${gson-version} + io.github.openfeign + feign-okhttp + ${feign-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} - io.gsonfire - gson-fire - ${gson-fire-version} + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} - org.apache.commons - commons-lang3 - ${commons-lang3-version} + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} org.openapitools jackson-databind-nullable ${jackson-databind-nullable-version} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.github.scribejava + scribejava-core + ${scribejava-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + + ch.qos.logback + logback-classic + 1.2.3 + test + + + org.junit.jupiter + junit-jupiter + ${junit-version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-version} + test + + + org.hamcrest + hamcrest + 2.2 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + commons-io + commons-io + 2.8.0 + test + + UTF-8 1.8 ${java.version} ${java.version} - 1.8.5 - 1.6.2 - 4.9.1 - 2.8.9 - 3.11 + 1.5.24 + 10.11 + 3.8.0 + 2.10.3 0.2.1 - UTF-8 + 2.10.3 + 1.3.5 + 5.7.0 + 1.0.0 + 8.0.0 diff --git a/openapitools.json b/openapitools.json index cf0ece6db3..16995792a9 100644 --- a/openapitools.json +++ b/openapitools.json @@ -69,7 +69,7 @@ "apiPackage": "com.algolia.search", "invokerPackage": "com.algolia", "modelPackage": "com.algolia.model", - "library": "okhttp-gson", + "library": "feign", "legacyDiscriminatorBehavior": false, "glob": "specs/search/spec.yml", "gitHost": "algolia", diff --git a/playground/java/pom.xml b/playground/java/pom.xml index b5b6d250b0..d8d5c58284 100644 --- a/playground/java/pom.xml +++ b/playground/java/pom.xml @@ -23,6 +23,11 @@ 4.11 test + + io.github.cdimascio + dotenv-java + 2.2.0 + com.algolia algoliasearch-client-java-2 diff --git a/playground/java/src/main/java/com/test/App.java b/playground/java/src/main/java/com/test/App.java index e53591faf1..cf1845ffb4 100644 --- a/playground/java/src/main/java/com/test/App.java +++ b/playground/java/src/main/java/com/test/App.java @@ -1,44 +1,24 @@ package com.test; -/** - * Hello world! - * - */ - -import com.algolia.auth.*; import com.algolia.model.*; import com.algolia.search.SearchApi; -import com.algolia.ApiClient; import com.algolia.ApiException; -import com.algolia.Configuration; + +import io.github.cdimascio.dotenv.Dotenv; public class App { public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://localhost"); - - // Configure API key authorization: apiKey - ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); - apiKey.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" - // (defaults to null) - // apiKey.setApiKeyPrefix("Token"); - - // Configure API key authorization: appId - ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); - appId.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" - // (defaults to null) - // appId.setApiKeyPrefix("Token"); + Dotenv dotenv = Dotenv.configure().directory("../").load(); + System.out.println(dotenv.get("ALGOLIA_APPLICATION_ID")); - SearchApi apiInstance = new SearchApi(defaultClient); + SearchApi client = new SearchApi(dotenv.get("ALGOLIA_APPLICATION_ID"), dotenv.get("ALGOLIA_SEARCH_KEY")); String indexName = "myIndexName"; // String | The index in which to perform the request. - BatchObject batchObject = new BatchObject(); // BatchObject | + SearchParams params = new SearchParams(); try { - BatchResponse result = apiInstance.batch(indexName, batchObject); + SearchResponse result = client.search(indexName, params); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling SearchApi#batch"); + System.err.println("Exception when calling SearchApi#search"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/templates/java/Configuration.mustache b/templates/java/Configuration.mustache deleted file mode 100644 index 6f6a434535..0000000000 --- a/templates/java/Configuration.mustache +++ /dev/null @@ -1,27 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/templates/java/auth/ApiKeyAuth.mustache b/templates/java/auth/ApiKeyAuth.mustache deleted file mode 100644 index 8e110e7e63..0000000000 --- a/templates/java/auth/ApiKeyAuth.mustache +++ /dev/null @@ -1,65 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}.auth; - -import {{invokerPackage}}.Pair; - -import java.util.Map; -import java.util.List; - -public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); - } - } -} diff --git a/templates/java/auth/Authentication.mustache b/templates/java/auth/Authentication.mustache deleted file mode 100644 index 033de98d56..0000000000 --- a/templates/java/auth/Authentication.mustache +++ /dev/null @@ -1,19 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}.auth; - -import {{invokerPackage}}.Pair; - -import java.util.Map; -import java.util.List; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams); -} diff --git a/templates/java/libraries/feign/ApiClient.mustache b/templates/java/libraries/feign/ApiClient.mustache new file mode 100644 index 0000000000..5c4e78970e --- /dev/null +++ b/templates/java/libraries/feign/ApiClient.mustache @@ -0,0 +1,354 @@ +package {{invokerPackage}}; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +{{#threetenbp}} +import org.threeten.bp.*; +{{/threetenbp}} +import feign.okhttp.OkHttpClient; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +{{#openApiNullable}} +import org.openapitools.jackson.nullable.JsonNullableModule; +{{/openApiNullable}} +{{#joda}} +import com.fasterxml.jackson.datatype.joda.JodaModule; +{{/joda}} +{{#java8}} +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +{{/java8}} +{{#threetenbp}} +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +{{/threetenbp}} + +import feign.Feign; +import feign.RequestInterceptor; +import feign.form.FormEncoder; +import feign.jackson.JacksonDecoder; +import feign.jackson.JacksonEncoder; +import feign.slf4j.Slf4jLogger; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.ApiKeyAuth; +import {{invokerPackage}}.ApiResponseDecoder; + +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.ApiErrorDecoder; +import {{invokerPackage}}.auth.OAuth; +import {{invokerPackage}}.auth.OAuth.AccessTokenListener; +import {{invokerPackage}}.auth.OAuthFlow; +import {{invokerPackage}}.auth.OauthPasswordGrant; +import {{invokerPackage}}.auth.OauthClientCredentialsGrant; +import feign.Retryer; +{{/hasOAuthMethods}} + +{{>generatedAnnotation}} +public class ApiClient { + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + + public interface Api {} + + protected ObjectMapper objectMapper; + private String basePath = "{{{basePath}}}"; + private Map apiAuthorizations; + private Feign.Builder feignBuilder; + + public ApiClient() { + objectMapper = createObjectMapper(); + apiAuthorizations = new LinkedHashMap(); + feignBuilder = Feign.builder() + .client(new OkHttpClient()) + .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) + .decoder(new ApiResponseDecoder(objectMapper)) + {{#hasOAuthMethods}} + .errorDecoder(new ApiErrorDecoder()) + .retryer(new Retryer.Default(0, 0, 2)) + {{/hasOAuthMethods}} + .logger(new Slf4jLogger()); + } + + public ApiClient(String[] authNames) { + this(); + for(String authName : authNames) { + log.log(Level.FINE, "Creating authentication {0}", authName); + {{#hasAuthMethods}} + RequestInterceptor auth; + {{#authMethods}}if ("{{name}}".equals(authName)) { + {{#isBasic}} + {{#isBasicBasic}} + auth = new HttpBasicAuth(); + {{/isBasicBasic}} + {{^isBasicBasic}} + auth = new HttpBearerAuth("{{scheme}}"); + {{/isBasicBasic}} + {{/isBasic}} + {{#isApiKey}} + auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); + {{/isApiKey}} + {{#isOAuth}} + auth = buildOauthRequestInterceptor(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); + {{/isOAuth}} + } else {{/authMethods}}{ + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + } + addAuthorization(authName, auth); + {{/hasAuthMethods}} + {{^hasAuthMethods}} + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + {{/hasAuthMethods}} + } + } + + /** + * Basic constructor for single auth name + * @param authName + */ + public ApiClient(String authName) { + this(new String[]{authName}); + } + + /** + * Helper constructor for single api key + * @param authName + * @param apiKey + */ + public ApiClient(String authName, String apiKey) { + this(authName); + this.setApiKey(apiKey); + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + public Map getApiAuthorizations() { + return apiAuthorizations; + } + + public void setApiAuthorizations(Map apiAuthorizations) { + this.apiAuthorizations = apiAuthorizations; + } + + public Feign.Builder getFeignBuilder() { + return feignBuilder; + } + + public ApiClient setFeignBuilder(Feign.Builder feignBuilder) { + this.feignBuilder = feignBuilder; + return this; + } + + private ObjectMapper createObjectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.setDateFormat(new RFC3339DateFormat()); + {{#joda}} + objectMapper.registerModule(new JodaModule()); + {{/joda}} + {{#java8}} + objectMapper.registerModule(new JavaTimeModule()); + {{/java8}} + {{#threetenbp}} + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + objectMapper.registerModule(module); + {{/threetenbp}} + {{#openApiNullable}} + JsonNullableModule jnm = new JsonNullableModule(); + objectMapper.registerModule(jnm); + {{/openApiNullable}} + return objectMapper; + } + + {{#hasOAuthMethods}} + private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + switch (flow) { + case password: + return new OauthPasswordGrant(tokenUrl, scopes); + case application: + return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); + default: + throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); + } + } + + {{/hasOAuthMethods}} + public ObjectMapper getObjectMapper(){ + return objectMapper; + } + + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + /** + * Creates a feign client for given API interface. + * + * Usage: + * ApiClient apiClient = new ApiClient(); + * apiClient.setBasePath("http://localhost:8080"); + * XYZApi api = apiClient.buildClient(XYZApi.class); + * XYZResponse response = api.someMethod(...); + * @param Type + * @param clientClass Client class + * @return The Client + */ + public T buildClient(Class clientClass) { + return feignBuilder.target(clientClass, basePath); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) return null; + if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json"; + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) return "application/json"; + if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json"; + return contentTypes[0]; + } + + /** + * Helper method to configure the bearer token. + * @param bearerToken the bearer token. + */ + public void setBearerToken(String bearerToken) { + HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); + apiAuthorization.setBearerToken(bearerToken); + } + + /** + * Helper method to configure the first api key found + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); + apiAuthorization.setApiKey(apiKey); + } + + /** + * Helper method to configure the username/password for basic auth + * @param username Username + * @param password Password + */ + public void setCredentials(String username, String password) { + HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); + apiAuthorization.setCredentials(username, password); + } + + {{#hasOAuthMethods}} + /** + * Helper method to configure the client credentials for Oauth + * @param username Username + * @param password Password + */ + public void setClientCredentials(String clientId, String clientSecret) { + OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); + authorization.configure(clientId, clientSecret); + } + + /** + * Helper method to configure the username/password for Oauth password grant + * @param username Username + * @param password Password + */ + public void setOauthPassword(String username, String password, String clientId, String clientSecret) { + OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); + apiAuthorization.configure(username, password, clientId, clientSecret); + } + + /** + * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) + * @param accessToken Access Token + * @param expiresIn Validity period in seconds + */ + public void setAccessToken(String accessToken, Integer expiresIn) { + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.setAccessToken(accessToken, expiresIn); + } + + /** + * Helper method to configure the oauth accessCode/implicit flow parameters + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI + */ + public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { + throw new RuntimeException("Not implemented"); + } + + /** + * Configures a listener which is notified when a new access token is received. + * @param accessTokenListener Acesss token listener + */ + public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + OAuth apiAuthorization = getAuthorization(OAuth.class); + apiAuthorization.registerAccessTokenListener(accessTokenListener); + } + + {{/hasOAuthMethods}} + /** + * Gets request interceptor based on authentication name + * @param authName Authentication name + * @return Request Interceptor + */ + public RequestInterceptor getAuthorization(String authName) { + return apiAuthorizations.get(authName); + } + + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Request interceptor + */ + public void addAuthorization(String authName, RequestInterceptor authorization) { + if (apiAuthorizations.containsKey(authName)) { + throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations"); + } + apiAuthorizations.put(authName, authorization); + feignBuilder.requestInterceptor(authorization); + } + + private T getAuthorization(Class type) { + return (T) apiAuthorizations.values() + .stream() + .filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass())) + .findFirst() + .orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!")); + } +} diff --git a/templates/java/libraries/feign/ApiResponseDecoder.mustache b/templates/java/libraries/feign/ApiResponseDecoder.mustache new file mode 100644 index 0000000000..ef171de943 --- /dev/null +++ b/templates/java/libraries/feign/ApiResponseDecoder.mustache @@ -0,0 +1,38 @@ +package {{invokerPackage}}; + +import com.fasterxml.jackson.databind.ObjectMapper; +import feign.Response; +import feign.Types; +import feign.jackson.JacksonDecoder; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; + +import {{modelPackage}}.ApiResponse; + +public class ApiResponseDecoder extends JacksonDecoder { + + public ApiResponseDecoder(ObjectMapper mapper) { + super(mapper); + } + + @Override + public Object decode(Response response, Type type) throws IOException { + Map> responseHeaders = Collections.unmodifiableMap(response.headers()); + //Detects if the type is an instance of the parameterized class ApiResponse + Type responseBodyType; + if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { + //The ApiResponse class has a single type parameter, the Dto class itself + responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; + Object body = super.decode(response, responseBodyType); + return new ApiResponse(response.status(), responseHeaders, body); + } else { + //The response is not encapsulated in the ApiResponse, decode the Dto as normal + return super.decode(response, type); + } + } +} \ No newline at end of file diff --git a/templates/java/libraries/feign/EncodingUtils.mustache b/templates/java/libraries/feign/EncodingUtils.mustache new file mode 100644 index 0000000000..705eb6aa9d --- /dev/null +++ b/templates/java/libraries/feign/EncodingUtils.mustache @@ -0,0 +1,86 @@ +package {{invokerPackage}}; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** +* Utilities to support Swagger encoding formats in Feign. +*/ +public final class EncodingUtils { + + /** + * Private constructor. Do not construct this class. + */ + private EncodingUtils() {} + + /** + *

Encodes a collection of query parameters according to the Swagger + * collection format.

+ * + *

Of the various collection formats defined by Swagger ("csv", "tsv", + * etc), Feign only natively supports "multi". This utility generates the + * other format types so it will be properly processed by Feign.

+ * + *

Note, as part of reformatting, it URL encodes the parameters as + * well.

+ * @param parameters The collection object to be formatted. This object will + * not be changed. + * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", + * "pipes"). See the + * + * OpenAPI Spec for more details. + * @return An object that will be correctly formatted by Feign. + */ + public static Object encodeCollection(Collection parameters, + String collectionFormat) { + if (parameters == null) { + return parameters; + } + List stringValues = new ArrayList<>(parameters.size()); + for (Object parameter : parameters) { + // ignore null values (same behavior as Feign) + if (parameter != null) { + stringValues.add(encode(parameter)); + } + } + // Feign natively handles single-element lists and the "multi" format. + if (stringValues.size() < 2 || "multi".equals(collectionFormat)) { + return stringValues; + } + // Otherwise return a formatted String + String[] stringArray = stringValues.toArray(new String[0]); + switch (collectionFormat) { + case "csv": + default: + return StringUtil.join(stringArray, ","); + case "ssv": + return StringUtil.join(stringArray, " "); + case "tsv": + return StringUtil.join(stringArray, "\t"); + case "pipes": + return StringUtil.join(stringArray, "|"); + } + } + + /** + * URL encode a single query parameter. + * @param parameter The query parameter to encode. This object will not be + * changed. + * @return The URL encoded string representation of the parameter. If the + * parameter is null, returns null. + */ + public static String encode(Object parameter) { + if (parameter == null) { + return null; + } + try { + return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } +} diff --git a/templates/java/libraries/feign/ParamExpander.mustache b/templates/java/libraries/feign/ParamExpander.mustache new file mode 100644 index 0000000000..2f5095d00f --- /dev/null +++ b/templates/java/libraries/feign/ParamExpander.mustache @@ -0,0 +1,22 @@ +package {{invokerPackage}}; + +import feign.Param; + +import java.text.DateFormat; +import java.util.Date; + +/** + * Param Expander to convert {@link Date} to RFC3339 + */ +public class ParamExpander implements Param.Expander { + + private static final DateFormat dateformat = new RFC3339DateFormat(); + + @Override + public String expand(Object value) { + if (value instanceof Date) { + return dateformat.format(value); + } + return value.toString(); + } +} diff --git a/templates/java/libraries/feign/README.mustache b/templates/java/libraries/feign/README.mustache new file mode 100644 index 0000000000..fed3cbebd5 --- /dev/null +++ b/templates/java/libraries/feign/README.mustache @@ -0,0 +1,77 @@ +# {{artifactId}} + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + {{groupId}} + {{artifactId}} + {{artifactVersion}} + compile + + +``` + +And to use the api you can follow the examples bellow: + +```java + + //Set bearer token manually + ApiClient apiClient = new ApiClient("petstore_auth_client"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setAccessToken("TOKEN", 10000); + + //Use api key + ApiClient apiClient = new ApiClient("api_key", "API KEY"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + + //Use http basic authentication + ApiClient apiClient = new ApiClient("basicAuth"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setCredentials("username", "password"); + + //Oauth password + ApiClient apiClient = new ApiClient("oauth_password"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); + + //Oauth client credentials flow + ApiClient apiClient = new ApiClient("oauth_client_credentials"); + apiClient.setBasePath("https://localhost:8243/petstore/1/"); + apiClient.setClientCredentials("client_id", "client_secret"); + + PetApi petApi = apiClient.buildClient(PetApi.class); + Pet petById = petApi.getPetById(12345L); + + System.out.println(petById); + } +``` + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/java/libraries/feign/api.mustache b/templates/java/libraries/feign/api.mustache new file mode 100644 index 0000000000..c494070002 --- /dev/null +++ b/templates/java/libraries/feign/api.mustache @@ -0,0 +1,190 @@ +package {{package}}; + +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.EncodingUtils; +{{#legacyDates}} +import {{invokerPackage}}.ParamExpander; +{{/legacyDates}} +import {{modelPackage}}.ApiResponse; + +{{#imports}}import {{import}}; +{{/imports}} + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} +import feign.*; + +{{>generatedAnnotation}} +public interface {{classname}} extends ApiClient.Api { + +{{#operations}}{{#operation}} + /** + * {{summary}} + * {{notes}} +{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} +{{/allParams}} +{{#returnType}} + * @return {{.}} +{{/returnType}} +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} +{{#isDeprecated}} + * @deprecated +{{/isDeprecated}} + */ +{{#isDeprecated}} + @Deprecated +{{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ +{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", +{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + /** + * {{summary}} + * Similar to {{operationId}} but it also returns the http response headers . + * {{notes}} +{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} +{{/allParams}} +{{#returnType}} + * @return A ApiResponse that wraps the response boyd and the http headers. +{{/returnType}} +{{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation +{{/externalDocs}} +{{#isDeprecated}} + * @deprecated +{{/isDeprecated}} + */ +{{#isDeprecated}} + @Deprecated +{{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ +{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", +{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + + {{#hasQueryParams}} + /** + * {{summary}} + * {{notes}} + * Note, this is equivalent to the other {{operationId}} method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link {{operationIdCamelCase}}QueryParams} class that allows for + * building up this map in a fluent style. + {{#allParams}} + {{^isQueryParam}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/isQueryParam}} + {{/allParams}} + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + {{#queryParams}} + *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • + {{/queryParams}} + *
+ {{#returnType}} + * @return {{.}} + {{/returnType}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ +{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", +{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); + + /** + * {{summary}} + * {{notes}} + * Note, this is equivalent to the other {{operationId}} that receives the query parameters as a map, + * but this one also exposes the Http response headers + {{#allParams}} + {{^isQueryParam}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} + {{/isQueryParam}} + {{/allParams}} + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + {{#queryParams}} + *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • + {{/queryParams}} + *
+ {{#returnType}} + * @return {{.}} + {{/returnType}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") + @Headers({ + {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", + {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} + "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, + {{/-last}}{{/headerParams}} + }) + ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); + + + /** + * A convenience class for generating query parameters for the + * {{operationId}} method in a fluent style. + */ + public static class {{operationIdCamelCase}}QueryParams extends HashMap { + {{#queryParams}} + public {{operationIdCamelCase}}QueryParams {{paramName}}(final {{{dataType}}} value) { + {{#collectionFormat}} + put("{{baseName}}", EncodingUtils.encodeCollection(value, "{{collectionFormat}}")); + {{/collectionFormat}} + {{^collectionFormat}} + put("{{baseName}}", EncodingUtils.encode(value)); + {{/collectionFormat}} + return this; + } + {{/queryParams}} + } + {{/hasQueryParams}} + {{/operation}} +{{/operations}} +} diff --git a/templates/java/libraries/feign/api_test.mustache b/templates/java/libraries/feign/api_test.mustache new file mode 100644 index 0000000000..a7f5bb0b32 --- /dev/null +++ b/templates/java/libraries/feign/api_test.mustache @@ -0,0 +1,70 @@ +package {{package}}; + +import {{invokerPackage}}.ApiClient; +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeEach; + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * API tests for {{classname}} + */ +class {{classname}}Test { + + private {{classname}} api; + + @BeforeEach + public void setup() { + api = new ApiClient().buildClient({{classname}}.class); + } + + {{#operations}}{{#operation}} + /** + * {{summary}} + * + * {{notes}} + */ + @Test + void {{operationId}}Test() { + {{#allParams}} + {{{dataType}}} {{paramName}} = null; + {{/allParams}} + // {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + + // TODO: test validations + } + + {{#hasQueryParams}} + /** + * {{summary}} + * + * {{notes}} + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + void {{operationId}}TestQueryMap() { + {{#allParams}} + {{^isQueryParam}} + {{{dataType}}} {{paramName}} = null; + {{/isQueryParam}} + {{/allParams}} + {{classname}}.{{operationIdCamelCase}}QueryParams queryParams = new {{classname}}.{{operationIdCamelCase}}QueryParams() + {{#queryParams}} + .{{paramName}}(null){{#-last}};{{/-last}} + {{/queryParams}} + // {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{^isQueryParam}}{{paramName}}, {{/isQueryParam}}{{/allParams}}queryParams); + + // TODO: test validations + } + {{/hasQueryParams}} + {{/operation}}{{/operations}} +} diff --git a/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache b/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache new file mode 100644 index 0000000000..da87f2563b --- /dev/null +++ b/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache @@ -0,0 +1,25 @@ +package {{invokerPackage}}.auth; + +import feign.Response; +import feign.RetryableException; +import feign.codec.ErrorDecoder; + +/** + * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token + * All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder + */ +public class ApiErrorDecoder implements ErrorDecoder { + + private final Default defaultErrorDecoder = new Default(); + + @Override + public Exception decode(String methodKey, Response response) { + //401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + Exception httpException = defaultErrorDecoder.decode(methodKey, response); + if (response.status() == 401 || response.status() == 403) { + return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token", + response.request().httpMethod(), httpException, null, response.request()); + } + return httpException; + } +} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/ApiKeyAuth.mustache b/templates/java/libraries/feign/auth/ApiKeyAuth.mustache new file mode 100644 index 0000000000..c03fe5c0bc --- /dev/null +++ b/templates/java/libraries/feign/auth/ApiKeyAuth.mustache @@ -0,0 +1,43 @@ +package {{invokerPackage}}.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; + +public class ApiKeyAuth implements RequestInterceptor { + private final String location; + private final String paramName; + + private String apiKey; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + @Override + public void apply(RequestTemplate template) { + if ("query".equals(location)) { + template.query(paramName, apiKey); + } else if ("header".equals(location)) { + template.header(paramName, apiKey); + } else if ("cookie".equals(location)) { + template.header("Cookie", String.format("%s=%s", paramName, apiKey)); + } + } +} diff --git a/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache b/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache new file mode 100644 index 0000000000..72b0a00495 --- /dev/null +++ b/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache @@ -0,0 +1,47 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.api.DefaultApi20; +import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; +import com.github.scribejava.core.extractors.TokenExtractor; +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; +import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; +import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; +import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; + +{{>generatedAnnotation}} +public class DefaultApi20Impl extends DefaultApi20 { + + private final String accessTokenEndpoint; + private final String authorizationBaseUrl; + + protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) { + this.authorizationBaseUrl = authorizationBaseUrl; + this.accessTokenEndpoint = accessTokenEndpoint; + } + + @Override + public String getAccessTokenEndpoint() { + return accessTokenEndpoint; + } + + @Override + protected String getAuthorizationBaseUrl() { + return authorizationBaseUrl; + } + + @Override + public BearerSignature getBearerSignature() { + return BearerSignatureURIQueryParameter.instance(); + } + + @Override + public ClientAuthentication getClientAuthentication() { + return RequestBodyAuthenticationScheme.instance(); + } + + @Override + public TokenExtractor getAccessTokenExtractor() { + return OAuth2AccessTokenJsonExtractor.instance(); + } +} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/HttpBasicAuth.mustache b/templates/java/libraries/feign/auth/HttpBasicAuth.mustache new file mode 100644 index 0000000000..c308131e8f --- /dev/null +++ b/templates/java/libraries/feign/auth/HttpBasicAuth.mustache @@ -0,0 +1,41 @@ +package {{invokerPackage}}.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.auth.BasicAuthRequestInterceptor; + +/** + * An interceptor that adds the request header needed to use HTTP basic authentication. + */ +public class HttpBasicAuth implements RequestInterceptor { + + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void setCredentials(String username, String password) { + this.username = username; + this.password = password; + } + + @Override + public void apply(RequestTemplate template) { + RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password); + requestInterceptor.apply(template); + } +} diff --git a/templates/java/libraries/feign/auth/HttpBearerAuth.mustache b/templates/java/libraries/feign/auth/HttpBearerAuth.mustache new file mode 100644 index 0000000000..2240a5518b --- /dev/null +++ b/templates/java/libraries/feign/auth/HttpBearerAuth.mustache @@ -0,0 +1,43 @@ +package {{invokerPackage}}.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; + +/** + * An interceptor that adds the request header needed to use HTTP bearer authentication. + */ +public class HttpBearerAuth implements RequestInterceptor { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void apply(RequestTemplate template) { + if(bearerToken == null) { + return; + } + + template.header("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/templates/java/libraries/feign/auth/OAuth.mustache b/templates/java/libraries/feign/auth/OAuth.mustache new file mode 100644 index 0000000000..e608296564 --- /dev/null +++ b/templates/java/libraries/feign/auth/OAuth.mustache @@ -0,0 +1,92 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.model.OAuth2AccessToken; +import com.github.scribejava.core.oauth.OAuth20Service; +import feign.RequestInterceptor; +import feign.RequestTemplate; + +import java.util.Collection; + +{{>generatedAnnotation}} +public abstract class OAuth implements RequestInterceptor { + + static final int MILLIS_PER_SECOND = 1000; + + public interface AccessTokenListener { + void notify(OAuth2AccessToken token); + } + + private volatile String accessToken; + private Long expirationTimeMillis; + private AccessTokenListener accessTokenListener; + + protected OAuth20Service service; + protected String scopes; + protected String authorizationUrl; + protected String tokenUrl; + + public OAuth(String authorizationUrl, String tokenUrl, String scopes) { + this.scopes = scopes; + this.authorizationUrl = authorizationUrl; + this.tokenUrl = tokenUrl; + } + + @Override + public void apply(RequestTemplate template) { + // If the request already have an authorization (eg. Basic auth), do nothing + if (requestContainsNonOauthAuthorization(template)) { + return; + } + String accessToken = getAccessToken(); + if (accessToken != null) { + template.header("Authorization", "Bearer " + accessToken); + } + } + + private boolean requestContainsNonOauthAuthorization(RequestTemplate template) { + Collection authorizations = template.headers().get("Authorization"); + if (authorizations == null) { + return false; + } + return !authorizations.stream() + .anyMatch(authHeader -> !authHeader.equalsIgnoreCase("Bearer")); + } + + private synchronized void updateAccessToken() { + OAuth2AccessToken accessTokenResponse; + accessTokenResponse = getOAuth2AccessToken(); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); + if (accessTokenListener != null) { + accessTokenListener.notify(accessTokenResponse); + } + } + } + + abstract OAuth2AccessToken getOAuth2AccessToken(); + + abstract OAuthFlow getFlow(); + + public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + this.accessTokenListener = accessTokenListener; + } + + public synchronized String getAccessToken() { + // If first time, get the token + if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + updateAccessToken(); + } + return accessToken; + } + + /** + * Manually sets the access token + * @param accessToken The access token + * @param expiresIn Seconds until the token expires + */ + public synchronized void setAccessToken(String accessToken, Integer expiresIn) { + this.accessToken = accessToken; + this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + } + +} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache b/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache new file mode 100644 index 0000000000..ef22c21163 --- /dev/null +++ b/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache @@ -0,0 +1,39 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +{{>generatedAnnotation}} +public class OauthClientCredentialsGrant extends OAuth { + + public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) { + super(authorizationUrl, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenClientCredentialsGrant(scopes); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.application; + } + + /** + * Configures the client credentials flow + * + * @param clientId + * @param clientSecret + */ + public void configure(String clientId, String clientSecret) { + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} diff --git a/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache b/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache new file mode 100644 index 0000000000..870c3755a8 --- /dev/null +++ b/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache @@ -0,0 +1,48 @@ +package {{invokerPackage}}.auth; + +import com.github.scribejava.core.builder.ServiceBuilder; +import com.github.scribejava.core.model.OAuth2AccessToken; + +{{>generatedAnnotation}} +public class OauthPasswordGrant extends OAuth { + + private String username; + private String password; + + public OauthPasswordGrant(String tokenUrl, String scopes) { + super(null, tokenUrl, scopes); + } + + @Override + protected OAuth2AccessToken getOAuth2AccessToken() { + try { + return service.getAccessTokenPasswordGrant(username, password); + } catch (Exception e) { + throw new RuntimeException("Failed to get oauth token", e); + } + } + + @Override + protected OAuthFlow getFlow() { + return OAuthFlow.password; + } + + /** + * Configures Oauth password grant flow + * Note: this flow is deprecated. + * + * @param username + * @param password + * @param clientId + * @param clientSecret + */ + public void configure(String username, String password, String clientId, String clientSecret) { + this.username = username; + this.password = password; + //TODO the clientId and secret are optional according with the RFC + service = new ServiceBuilder(clientId) + .apiSecret(clientSecret) + .defaultScope(scopes) + .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); + } +} \ No newline at end of file diff --git a/templates/java/libraries/feign/build.gradle.mustache b/templates/java/libraries/feign/build.gradle.mustache new file mode 100644 index 0000000000..93944f967e --- /dev/null +++ b/templates/java/libraries/feign/build.gradle.mustache @@ -0,0 +1,152 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = '{{groupId}}' +version = '{{artifactVersion}}' + +buildscript { + repositories { + maven { url "https://repo1.maven.org/maven2" } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + install { + repositories.mavenInstaller { + pom.artifactId = '{{artifactId}}' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +test { + useJUnitPlatform() +} + +ext { + swagger_annotations_version = "1.5.24" + jackson_version = "2.10.3" + jackson_databind_version = "2.10.3" + {{#openApiNullable}} + jackson_databind_nullable_version = "0.2.1" + {{/openApiNullable}} + jakarta_annotation_version = "1.3.5" + {{#threetenbp}} + jackson_threetenbp_version = "2.9.10" + {{/threetenbp}} + feign_version = "10.11" + feign_form_version = "3.8.0" + junit_version = "5.7.0" + scribejava_version = "8.0.0" +} + +dependencies { + implementation "io.swagger:swagger-annotations:$swagger_annotations_version" + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation "io.github.openfeign:feign-core:$feign_version" + implementation "io.github.openfeign:feign-jackson:$feign_version" + implementation "io.github.openfeign:feign-slf4j:$feign_version" + implementation "io.github.openfeign:feign-okhttp:$feign_version" + implementation "io.github.openfeign.form:feign-form:$feign_form_version" + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + {{#openApiNullable}} + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + {{/openApiNullable}} + {{#joda}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" + {{/joda}} + {{#java8}} + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + {{/java8}} + {{#threetenbp}} + implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" + {{/threetenbp}} + implementation "com.brsanthu:migbase64:2.2" + implementation "com.github.scribejava:scribejava-core:$scribejava_version" + implementation "com.brsanthu:migbase64:2.2" + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" + testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" + testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" + testImplementation "org.hamcrest:hamcrest:2.2" + testImplementation "commons-io:commons-io:2.8.0" + testImplementation "ch.qos.logback:logback-classic:1.2.3" +} diff --git a/templates/java/libraries/feign/build.sbt.mustache b/templates/java/libraries/feign/build.sbt.mustache new file mode 100644 index 0000000000..f2912f0dfb --- /dev/null +++ b/templates/java/libraries/feign/build.sbt.mustache @@ -0,0 +1,34 @@ +lazy val root = (project in file(".")). + settings( + organization := "{{groupId}}", + name := "{{artifactId}}", + version := "{{artifactVersion}}", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "io.github.openfeign" % "feign-core" % "10.11" % "compile", + "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", + "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", + "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", + "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.10" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", + "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", + "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", + "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", + "org.hamcrest" % "hamcrest" % "2.2" % "test", + "commons-io" % "commons-io" % "2.8.0" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/templates/java/libraries/okhttp-gson/ApiResponse.mustache b/templates/java/libraries/feign/model/ApiResponse.mustache similarity index 52% rename from templates/java/libraries/okhttp-gson/ApiResponse.mustache rename to templates/java/libraries/feign/model/ApiResponse.mustache index 1e277319a9..bc460dc59c 100644 --- a/templates/java/libraries/okhttp-gson/ApiResponse.mustache +++ b/templates/java/libraries/feign/model/ApiResponse.mustache @@ -1,20 +1,10 @@ -{{>licenseInfo}} +package {{modelPackage}}; -package {{invokerPackage}}; - -import java.util.List; import java.util.Map; -{{#caseInsensitiveResponseHeaders}} -import java.util.Map.Entry; -import java.util.TreeMap; -{{/caseInsensitiveResponseHeaders}} - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { +import java.util.List; + +public class ApiResponse{ + final private int statusCode; final private Map> headers; final private T data; @@ -34,13 +24,7 @@ public class ApiResponse { */ public ApiResponse(int statusCode, Map> headers, T data) { this.statusCode = statusCode; - {{#caseInsensitiveResponseHeaders}} - Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); - for(Entry> entry : headers.entrySet()){ - responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); - } - {{/caseInsensitiveResponseHeaders}} - this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; + this.headers = headers; this.data = data; } @@ -55,4 +39,5 @@ public class ApiResponse { public T getData() { return data; } -} + +} \ No newline at end of file diff --git a/templates/java/libraries/feign/model_test.mustache b/templates/java/libraries/feign/model_test.mustache new file mode 100644 index 0000000000..0d75e120b0 --- /dev/null +++ b/templates/java/libraries/feign/model_test.mustache @@ -0,0 +1,48 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.jupiter.api.Test; + +{{#fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +/** + * Model tests for {{classname}} + */ +class {{classname}}Test { + {{#models}} + {{#model}} + {{^vendorExtensions.x-is-one-of-interface}} + {{^isEnum}} + private final {{classname}} model = new {{classname}}(); + + {{/isEnum}} + /** + * Model tests for {{classname}} + */ + @Test + void test{{classname}}() { + // TODO: test {{classname}} + } + + {{#allVars}} + /** + * Test the property '{{name}}' + */ + @Test + void {{name}}Test() { + // TODO: test {{name}} + } + + {{/allVars}} + {{/vendorExtensions.x-is-one-of-interface}} + {{/model}} + {{/models}} +} diff --git a/templates/java/libraries/okhttp-gson/pom.mustache b/templates/java/libraries/feign/pom.mustache similarity index 58% rename from templates/java/libraries/okhttp-gson/pom.mustache rename to templates/java/libraries/feign/pom.mustache index 2e42031d4e..c1f440cf97 100644 --- a/templates/java/libraries/okhttp-gson/pom.mustache +++ b/templates/java/libraries/feign/pom.mustache @@ -40,20 +40,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - org.apache.maven.plugins maven-enforcer-plugin @@ -134,12 +120,40 @@ - {{{sourceFolder}}} + algoliasearch-core + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + @@ -171,53 +185,59 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} + com.google.code.findbugs jsr305 3.0.2 + + - com.squareup.okhttp3 - okhttp - ${okhttp-version} + io.github.openfeign + feign-core + ${feign-version} - com.squareup.okhttp3 - logging-interceptor - ${okhttp-version} + io.github.openfeign + feign-jackson + ${feign-version} - com.google.code.gson - gson - ${gson-version} + io.github.openfeign + feign-slf4j + ${feign-version} - io.gsonfire - gson-fire - ${gson-fire-version} + io.github.openfeign.form + feign-form + ${feign-form-version} - org.apache.commons - commons-lang3 - ${commons-lang3-version} + io.github.openfeign + feign-okhttp + ${feign-version} - {{#joda}} + + - joda-time - joda-time - ${jodatime-version} + com.fasterxml.jackson.core + jackson-core + ${jackson-version} - {{/joda}} - {{#threetenbp}} - org.threeten - threetenbp - ${threetenbp-version} + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-databind-version} - {{/threetenbp}} {{#openApiNullable}} org.openapitools @@ -225,25 +245,104 @@ ${jackson-databind-nullable-version} {{/openApiNullable}} + {{#withXml}} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson-version} + + {{/withXml}} + {{#joda}} + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + {{/joda}} + {{#java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{/java8}} + {{#threetenbp}} + + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + + {{/threetenbp}} + + com.github.scribejava + scribejava-core + ${scribejava-version} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + + + ch.qos.logback + logback-classic + 1.2.3 + test + + + org.junit.jupiter + junit-jupiter + ${junit-version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-version} + test + + + org.hamcrest + hamcrest + 2.2 + test + + + com.github.tomakehurst + wiremock-jre8 + 2.27.2 + test + + + commons-io + commons-io + 2.8.0 + test + - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + UTF-8 + 1.8 ${java.version} ${java.version} - 1.8.5 - 1.6.2 - 4.9.1 - 2.8.9 - 3.11 + 1.5.24 + 10.11 + 3.8.0 + 2.10.3 {{#openApiNullable}} 0.2.1 {{/openApiNullable}} - {{#joda}} - 2.10.9 - {{/joda}} + 2.10.3 {{#threetenbp}} - 1.5.0 + 2.9.10 {{/threetenbp}} - UTF-8 + 1.3.5 + 5.7.0 + 1.0.0 + 8.0.0 diff --git a/templates/java/libraries/okhttp-gson/ApiCallback.mustache b/templates/java/libraries/okhttp-gson/ApiCallback.mustache deleted file mode 100644 index 53b6a7b8e3..0000000000 --- a/templates/java/libraries/okhttp-gson/ApiCallback.mustache +++ /dev/null @@ -1,51 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import java.io.IOException; - -import java.util.Map; -import java.util.List; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache deleted file mode 100644 index 72e575cdc1..0000000000 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ /dev/null @@ -1,1345 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.BufferedSink; -import okio.Okio; -{{#joda}} -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormatter; -{{/joda}} -{{#threetenbp}} -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -{{/threetenbp}} - -import javax.net.ssl.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URI; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.text.DateFormat; -{{#java8}} -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -{{/java8}} -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import {{invokerPackage}}.auth.Authentication; -import {{invokerPackage}}.auth.ApiKeyAuth; - -public class ApiClient { - - private String basePath = "{{{basePath}}}"; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; - - private HttpLoggingInterceptor loggingInterceptor; - - /* - * Basic constructor for ApiClient - */ - public ApiClient() { - init(); - initHttpClient(); - - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - /* - * Basic constructor with custom OkHttpClient - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"));{{/isApiKey}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { - builder.addInterceptor(interceptor); - } - {{#useGzipFeature}} - // Enable gzip request compression - builder.addInterceptor(new GzipRequestInterceptor()); - {{/useGzipFeature}} - - httpClient = builder.build(); - } - - private void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - - authentications = new HashMap(); - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g {{{basePath}}} - * @return An instance of OkHttpClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Set HTTP client, which must never be null. - * - * @param newHttpClient An instance of OkHttpClient - * @return Api Client - * @throws NullPointerException when newHttpClient is null - */ - public ApiClient setHttpClient(OkHttpClient newHttpClient) { - this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); - return this; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. - * Default to true. - * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. - * Use null to reset to default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. - * Use null to reset to default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - public DateFormat getDateFormat() { - return dateFormat; - } - - public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); - return this; - } - - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); - return this; - } - - {{#joda}} - public ApiClient setDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setDateTimeFormat(dateFormat); - return this; - } - - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - {{/joda}} - {{#jsr310}} - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); - return this; - } - - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); - return this; - } - - {{/jsr310}} - public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Get authentications (key: authentication name, value: authentication). - * - * @return Map of authentication objects - */ - public Map getAuthentications() { - return authentications; - } - - /** - * Get authentication for the given name. - * - * @param authName The authentication name - * @return The authentication, null if not found - */ - public Authentication getAuthentication(String authName) { - return authentications.get(authName); - } - - /** - * Helper method to set API key value for the first API key authentication. - * - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKey(apiKey); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Helper method to set API key prefix for the first API key authentication. - * - * @param apiKeyPrefix API key prefix - */ - public void setApiKeyPrefix(String apiKeyPrefix) { - for (Authentication auth : authentications.values()) { - if (auth instanceof ApiKeyAuth) { - ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); - return; - } - } - throw new RuntimeException("No API key authentication configured!"); - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - /** - * Sets the connect timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - /** - * Sets the read timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - /** - * Sets the write timeout (in milliseconds). - * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { - //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(String.valueOf(o)); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * "* / *" is also default to JSON - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; - } - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code(), - response.headers().toMultimap(), - respBody); - } - } - - /** - * Serialize the given Java object into request body according to the object's - * class and the request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = json.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) - prefix = "download-"; - } - - if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); - else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); - } - } - - {{#supportStreaming}} - public InputStream executeStream(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - if (!response.isSuccessful()) { - throw new ApiException(response.code(), response.message()); - } - if (response.body() == null) { - return null; - } - return response.body().byteStream(); - } catch (IOException e) { - throw new ApiException(e); - } - } - - {{/supportStreaming}} - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws ApiException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); - } - } - throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws ApiException If fail to serialize the request body object - */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws ApiException If fail to serialize the request body object - */ - public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - - final String url = buildUrl(path, queryParams, collectionQueryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - - RequestBody reqBody; - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl(String path, List queryParams, List collectionQueryParams) { - final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); - } - } - } - - /** - * Update query and header parameters based on authentication settings. - * - * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams); - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, - * which could contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for - * async requests. - */ - private Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse.newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of - * verifyingSsl and sslCaCert. - */ - private void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = new TrustManager[]{ - new X509TrustManager() { - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { - } - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[]{}; - } - } - }; - hostnameVerifier = new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException("expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } -} diff --git a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache deleted file mode 100644 index b633aa8f58..0000000000 --- a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache +++ /dev/null @@ -1,74 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -import java.io.IOException; - -/** - * Encodes request bodies using gzip. - * - * Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = originalRequest.newBuilder() - .header("Content-Encoding", "gzip") - .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } - - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} diff --git a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache deleted file mode 100644 index 71e1e2b4cb..0000000000 --- a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ /dev/null @@ -1,62 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache deleted file mode 100644 index 45115940b6..0000000000 --- a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ /dev/null @@ -1,59 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.ResponseBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache deleted file mode 100644 index 2a6fac75ee..0000000000 --- a/templates/java/libraries/okhttp-gson/README.mustache +++ /dev/null @@ -1,172 +0,0 @@ -# {{artifactId}} - -{{appName}} -- API version: {{appVersion}} - -{{{appDescriptionWithNewLines}}} - -{{#infoUrl}} - For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - -## Requirements - -Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ -2. Maven/Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - {{{groupId}}} - {{{artifactId}}} - {{{artifactVersion}}} - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy -compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" -``` - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` -* `target/lib/*.jar` - -## Getting Started - -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -// Import classes: -import {{{invokerPackage}}}.ApiClient; -import {{{invokerPackage}}}.ApiException; -import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} -import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} -import {{{invokerPackage}}}.models.*; -import {{{package}}}.{{{classname}}}; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("{{{basePath}}}"); - {{#hasAuthMethods}} - {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - // Configure HTTP basic authorization: {{{name}}} - HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setUsername("YOUR USERNAME"); - {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} - // Configure HTTP bearer authorization: {{{name}}} - HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - // Configure API key authorization: {{{name}}} - ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} - // Configure OAuth2 access token for authorization: {{{name}}} - OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} - {{/authMethods}} - {{/hasAuthMethods}} - - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); - {{#allParams}} - {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} - {{/allParams}} - try { - {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{{paramName}}}({{{paramName}}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} - System.out.println(result);{{/returnType}} - } catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - -## Documentation for Authorization - -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} - -{{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{keyParamName}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}}- **Type**: OAuth -- **Flow**: {{flow}} -- **Authorization URL**: {{authorizationUrl}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - {{scope}}: {{description}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache deleted file mode 100644 index 7a33790a04..0000000000 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ /dev/null @@ -1,467 +0,0 @@ -{{>licenseInfo}} - -package {{package}}; - -import {{invokerPackage}}.ApiCallback; -import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.ApiException; -import {{invokerPackage}}.ApiResponse; -import {{invokerPackage}}.Configuration; -import {{invokerPackage}}.Pair; -import {{invokerPackage}}.ProgressRequestBody; -import {{invokerPackage}}.ProgressResponseBody; -{{#performBeanValidation}} -import {{invokerPackage}}.BeanValidationException; -{{/performBeanValidation}} - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - -{{#useBeanValidation}} -import javax.validation.constraints.*; -{{/useBeanValidation}} -{{#performBeanValidation}} -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.ValidatorFactory; -import javax.validation.executable.ExecutableValidator; -import java.util.Set; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -{{/performBeanValidation}} - -{{#imports}}import {{import}}; -{{/imports}} - -import java.lang.reflect.Type; -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{#supportStreaming}} -import java.io.InputStream; -{{/supportStreaming}} -{{/fullJavaUtil}} - -{{#operations}} -public class {{classname}} { - private ApiClient localVarApiClient; - - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - - public {{classname}}(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - {{#operation}} - {{^vendorExtensions.x-group-parameters}}/** - * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { - Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - - // create path and map variables - String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; - - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); - - {{#formParams}} - if ({{paramName}} != null) { - localVarFormParams.put("{{baseName}}", {{paramName}}); - } - - {{/formParams}} - {{#queryParams}} - if ({{paramName}} != null) { - {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - } - - {{/queryParams}} - {{#headerParams}} - if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/headerParams}} - {{#cookieParams}} - if ({{paramName}} != null) { - localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); - } - - {{/cookieParams}} - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - @SuppressWarnings("rawtypes") - private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { - {{^performBeanValidation}} - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); - } - {{/required}}{{/allParams}} - - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; - - {{/performBeanValidation}} - {{#performBeanValidation}} - try { - ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); - ExecutableValidator executableValidator = factory.getValidator().forExecutables(); - - Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; - Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); - Set> violations = executableValidator.validateParameters(this, method, - parameterValues); - - if (violations.size() == 0) { - okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - return localVarCall; - - } else { - throw new BeanValidationException((Set) violations); - } - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new ApiException(e.getMessage()); - } catch (SecurityException e) { - e.printStackTrace(); - throw new ApiException(e.getMessage()); - } - - {{/performBeanValidation}} - } - - {{^vendorExtensions.x-group-parameters}} - /** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} - * @return {{.}}{{/returnType}} - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - {{#vendorExtensions.x-streaming}} - public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp;{{/returnType}} - } - {{/vendorExtensions.x-streaming}} - {{^vendorExtensions.x-streaming}} - public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp.getData();{{/returnType}} - } - {{/vendorExtensions.x-streaming}} - {{/vendorExtensions.x-group-parameters}} - - {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} - } - {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} - } - {{/vendorExtensions.x-streaming}} - - {{^vendorExtensions.x-group-parameters}}/** - * {{summary}} (asynchronously) - * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - - okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); - {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} - return localVarCall; - } - {{#vendorExtensions.x-group-parameters}} - - public class API{{operationId}}Request { - {{#requiredParams}} - private final {{{dataType}}} {{paramName}}; - {{/requiredParams}} - {{#optionalParams}} - private {{{dataType}}} {{paramName}}; - {{/optionalParams}} - - private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { - {{#requiredParams}} - this.{{paramName}} = {{paramName}}; - {{/requiredParams}} - } - - {{#optionalParams}} - /** - * Set {{paramName}} - * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) - * @return API{{operationId}}Request - */ - public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { - this.{{paramName}} = {{paramName}}; - return this; - } - - {{/optionalParams}} - /** - * Build call for {{operationId}} - * @param _callback ApiCallback API callback - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { - return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); - } - - /** - * Execute {{operationId}} request{{#returnType}} - * @return {{.}}{{/returnType}} - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { - {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} - return localVarResp.getData();{{/returnType}} - } - - /** - * Execute {{operationId}} request with HTTP info returned - * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { - return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - } - - /** - * Execute {{operationId}} request (asynchronously) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); - } - } - - /** - * {{summary}} - * {{notes}}{{#requiredParams}} - * @param {{paramName}} {{description}} (required){{/requiredParams}} - * @return API{{operationId}}Request - {{#responses.0}} - * @http.response.details - - - {{#responses}} - - {{/responses}} -
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
- {{/responses.0}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { - return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); - } - {{/vendorExtensions.x-group-parameters}} - {{/operation}} -} -{{/operations}} diff --git a/templates/java/libraries/okhttp-gson/apiException.mustache b/templates/java/libraries/okhttp-gson/apiException.mustache deleted file mode 100644 index d1a38fc7d3..0000000000 --- a/templates/java/libraries/okhttp-gson/apiException.mustache +++ /dev/null @@ -1,95 +0,0 @@ -{{>licenseInfo}} - -package {{invokerPackage}}; - -import java.util.Map; -import java.util.List; -{{#caseInsensitiveResponseHeaders}} -import java.util.Map.Entry; -import java.util.TreeMap; -{{/caseInsensitiveResponseHeaders}} - -public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ - private int code = 0; - private Map> responseHeaders = null; - private String responseBody = null; - - public ApiException() {} - - public ApiException(Throwable throwable) { - super(throwable); - } - - public ApiException(String message) { - super(message); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { - super(message, throwable); - this.code = code; - {{#caseInsensitiveResponseHeaders}} - Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); - for(Entry> entry : responseHeaders.entrySet()){ - headers.put(entry.getKey().toLowerCase(), entry.getValue()); - } - {{/caseInsensitiveResponseHeaders}} - this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; - this.responseBody = responseBody; - } - - public ApiException(String message, int code, Map> responseHeaders, String responseBody) { - this(message, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { - this(message, throwable, code, responseHeaders, null); - } - - public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); - } - - public ApiException(int code, String message) { - super(message); - this.code = code; - } - - public ApiException(int code, String message, Map> responseHeaders, String responseBody) { - this(code, message); - {{#caseInsensitiveResponseHeaders}} - Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); - for(Entry> entry : responseHeaders.entrySet()){ - headers.put(entry.getKey().toLowerCase(), entry.getValue()); - } - {{/caseInsensitiveResponseHeaders}} - this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; - this.responseBody = responseBody; - } - - /** - * Get the HTTP status code. - * - * @return HTTP status code - */ - public int getCode() { - return code; - } - - /** - * Get the HTTP response headers. - * - * @return A map of list of string - */ - public Map> getResponseHeaders() { - return responseHeaders; - } - - /** - * Get the HTTP response body. - * - * @return Response body in the form of string - */ - public String getResponseBody() { - return responseBody; - } -} From f63bb8cedf8e72463e470df46fe14ee5f2a2bdfe Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Thu, 9 Dec 2021 15:53:24 +0100 Subject: [PATCH 13/19] use google formatter --- .../com/algolia/ApiClient.java | 37 +- .../com/algolia/ApiResponseDecoder.java | 6 +- .../com/algolia/EncodingUtils.java | 39 +- .../com/algolia/ParamExpander.java | 4 +- .../com/algolia/ServerConfiguration.java | 7 +- .../com/algolia/ServerVariable.java | 7 +- .../com/algolia/StringUtil.java | 11 +- .../com/algolia/auth/DefaultApi20Impl.java | 2 +- .../com/algolia/auth/HttpBasicAuth.java | 4 +- .../com/algolia/auth/HttpBearerAuth.java | 10 +- .../com/algolia/model/BaseIndexSettings.java | 66 +-- .../com/algolia/model/BaseSearchParams.java | 156 ++++--- .../com/algolia/model/BaseSearchResponse.java | 122 +++--- .../model/BaseSearchResponseFacetsStats.java | 24 +- .../com/algolia/model/BatchObject.java | 15 +- .../com/algolia/model/BatchResponse.java | 18 +- .../algolia/model/DeleteIndexResponse.java | 18 +- .../com/algolia/model/ErrorBase.java | 15 +- .../com/algolia/model/HighlightResult.java | 26 +- .../com/algolia/model/Index.java | 57 +-- .../com/algolia/model/IndexSettings.java | 295 +++++++------ .../model/IndexSettingsAsSearchParams.java | 240 ++++++----- .../algolia/model/ListIndicesResponse.java | 19 +- .../com/algolia/model/MultipleQueries.java | 34 +- .../algolia/model/MultipleQueriesObject.java | 21 +- .../model/MultipleQueriesResponse.java | 16 +- .../com/algolia/model/Operation.java | 21 +- .../algolia/model/OperationIndexObject.java | 33 +- .../algolia/model/OperationIndexResponse.java | 18 +- .../com/algolia/model/RankingInfo.java | 59 +-- .../model/RankingInfoMatchedGeoLocation.java | 21 +- .../com/algolia/model/Record.java | 30 +- .../com/algolia/model/SaveObjectResponse.java | 21 +- .../com/algolia/model/SearchHits.java | 16 +- .../com/algolia/model/SearchParams.java | 386 +++++++++++------- .../algolia/model/SearchParamsAsString.java | 15 +- .../com/algolia/model/SearchResponse.java | 127 +++--- .../algolia/model/SetSettingsResponse.java | 18 +- .../com/algolia/model/SnippetResult.java | 20 +- .../com/algolia/search/SearchApi.java | 202 ++++----- scripts/post-gen-java.sh | 11 +- 41 files changed, 1231 insertions(+), 1036 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index ac960d406d..0e52c9b5a1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -1,6 +1,5 @@ package com.algolia; -import com.algolia.ApiResponseDecoder; import com.algolia.auth.ApiKeyAuth; import com.algolia.auth.HttpBasicAuth; import com.algolia.auth.HttpBearerAuth; @@ -11,7 +10,6 @@ import feign.Feign; import feign.RequestInterceptor; import feign.form.FormEncoder; -import feign.jackson.JacksonDecoder; import feign.jackson.JacksonEncoder; import feign.okhttp.OkHttpClient; import feign.slf4j.Slf4jLogger; @@ -23,7 +21,7 @@ @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" + date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" ) public class ApiClient { @@ -68,6 +66,7 @@ public ApiClient(String[] authNames) { /** * Basic constructor for single auth name + * * @param authName */ public ApiClient(String authName) { @@ -76,6 +75,7 @@ public ApiClient(String authName) { /** * Helper constructor for single api key + * * @param authName * @param apiKey */ @@ -137,11 +137,10 @@ public void setObjectMapper(ObjectMapper objectMapper) { /** * Creates a feign client for given API interface. * - * Usage: - * ApiClient apiClient = new ApiClient(); - * apiClient.setBasePath("http://localhost:8080"); - * XYZApi api = apiClient.buildClient(XYZApi.class); - * XYZResponse response = api.someMethod(...); + *

Usage: ApiClient apiClient = new ApiClient(); + * apiClient.setBasePath("http://localhost:8080"); XYZApi api = + * apiClient.buildClient(XYZApi.class); XYZResponse response = api.someMethod(...); + * * @param Type * @param clientClass Client class * @return The Client @@ -151,13 +150,12 @@ public T buildClient(Class clientClass) { } /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) + * Select the Accept header's value from the given accepts array: if JSON exists in the given + * array, use it; otherwise use all of them (joining into a string) * * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). + * @return The Accept header to use. If the given array is empty, null will be returned (not to + * set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { if (accepts.length == 0) return null; @@ -168,13 +166,11 @@ public String selectHeaderAccept(String[] accepts) { } /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. + * Select the Content-Type header's value from the given array: if JSON exists in the given array, + * use it; otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. + * @return The Content-Type header to use. If the given array is empty, JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0) return "application/json"; @@ -186,6 +182,7 @@ public String selectHeaderContentType(String[] contentTypes) { /** * Helper method to configure the bearer token. + * * @param bearerToken the bearer token. */ public void setBearerToken(String bearerToken) { @@ -195,6 +192,7 @@ public void setBearerToken(String bearerToken) { /** * Helper method to configure the first api key found + * * @param apiKey API key */ public void setApiKey(String apiKey) { @@ -204,6 +202,7 @@ public void setApiKey(String apiKey) { /** * Helper method to configure the username/password for basic auth + * * @param username Username * @param password Password */ @@ -214,6 +213,7 @@ public void setCredentials(String username, String password) { /** * Gets request interceptor based on authentication name + * * @param authName Authentication name * @return Request Interceptor */ @@ -223,6 +223,7 @@ public RequestInterceptor getAuthorization(String authName) { /** * Adds an authorization to be used by the client + * * @param authName Authentication name * @param authorization Request interceptor */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java index 309895aa71..b96bfcd21d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java @@ -23,15 +23,15 @@ public Object decode(Response response, Type type) throws IOException { Map> responseHeaders = Collections.unmodifiableMap( response.headers() ); - //Detects if the type is an instance of the parameterized class ApiResponse + // Detects if the type is an instance of the parameterized class ApiResponse Type responseBodyType; if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { - //The ApiResponse class has a single type parameter, the Dto class itself + // The ApiResponse class has a single type parameter, the Dto class itself responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; Object body = super.decode(response, responseBodyType); return new ApiResponse(response.status(), responseHeaders, body); } else { - //The response is not encapsulated in the ApiResponse, decode the Dto as normal + // The response is not encapsulated in the ApiResponse, decode the Dto as normal return super.decode(response, type); } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java index bb9eff7305..5c63f8d600 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java @@ -6,32 +6,25 @@ import java.util.Collection; import java.util.List; -/** - * Utilities to support Swagger encoding formats in Feign. - */ +/** Utilities to support Swagger encoding formats in Feign. */ public final class EncodingUtils { - /** - * Private constructor. Do not construct this class. - */ + /** Private constructor. Do not construct this class. */ private EncodingUtils() {} /** - *

Encodes a collection of query parameters according to the Swagger - * collection format.

+ * Encodes a collection of query parameters according to the Swagger collection format. * - *

Of the various collection formats defined by Swagger ("csv", "tsv", - * etc), Feign only natively supports "multi". This utility generates the - * other format types so it will be properly processed by Feign.

+ *

Of the various collection formats defined by Swagger ("csv", "tsv", etc), Feign only + * natively supports "multi". This utility generates the other format types so it will be properly + * processed by Feign. * - *

Note, as part of reformatting, it URL encodes the parameters as - * well.

- * @param parameters The collection object to be formatted. This object will - * not be changed. - * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", - * "pipes"). See the - * - * OpenAPI Spec for more details. + *

Note, as part of reformatting, it URL encodes the parameters as well. + * + * @param parameters The collection object to be formatted. This object will not be changed. + * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", "pipes"). See the OpenAPI Spec for more + * details. * @return An object that will be correctly formatted by Feign. */ public static Object encodeCollection( @@ -69,10 +62,10 @@ public static Object encodeCollection( /** * URL encode a single query parameter. - * @param parameter The query parameter to encode. This object will not be - * changed. - * @return The URL encoded string representation of the parameter. If the - * parameter is null, returns null. + * + * @param parameter The query parameter to encode. This object will not be changed. + * @return The URL encoded string representation of the parameter. If the parameter is null, + * returns null. */ public static String encode(Object parameter) { if (parameter == null) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java index a057c9e50b..62406b46b1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java @@ -4,9 +4,7 @@ import java.text.DateFormat; import java.util.Date; -/** - * Param Expander to convert {@link Date} to RFC3339 - */ +/** Param Expander to convert {@link Date} to RFC3339 */ public class ParamExpander implements Param.Expander { private static final DateFormat dateformat = new RFC3339DateFormat(); diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java index 6dbe7a0216..2079f056c9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java @@ -2,9 +2,7 @@ import java.util.Map; -/** - * Representing a Server configuration. - */ +/** Representing a Server configuration. */ public class ServerConfiguration { public String URL; @@ -14,7 +12,8 @@ public class ServerConfiguration { /** * @param URL A URL to the target host. * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + * @param variables A map between a variable name and its value. The value is used for + * substitution in the server's URL template. */ public ServerConfiguration( String URL, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java index 52b3a21d57..c0e8b2aa67 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java @@ -2,9 +2,7 @@ import java.util.HashSet; -/** - * Representing a Server Variable for server URL template substitution. - */ +/** Representing a Server Variable for server URL template substitution. */ public class ServerVariable { public String description; @@ -14,7 +12,8 @@ public class ServerVariable { /** * @param description A description for the server variable. * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + * @param enumValues An enumeration of string values to be used if the substitution options are + * from a limited set. */ public ServerVariable( String description, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java index db6060f596..55d6187be4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java @@ -38,12 +38,11 @@ public static boolean containsIgnoreCase(String[] array, String value) { /** * Join an array of strings with the given separator. - *

- * Note: This might be replaced by utility method from commons-lang or guava someday - * if one of those libraries is added as dependency. - *

* - * @param array The array of strings + *

Note: This might be replaced by utility method from commons-lang or guava someday if one of + * those libraries is added as dependency. + * + * @param array The array of strings * @param separator The separator * @return the resulting string */ @@ -64,7 +63,7 @@ public static String join(String[] array, String separator) { /** * Join a list of strings with the given separator. * - * @param list The list of strings + * @param list The list of strings * @param separator The separator * @return the resulting string */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java index f3c0bb0907..7a2151ff41 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java @@ -11,7 +11,7 @@ @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" + date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" ) public class DefaultApi20Impl extends DefaultApi20 { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java index 1b6da4925a..dd0bcf98d9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java @@ -4,9 +4,7 @@ import feign.RequestTemplate; import feign.auth.BasicAuthRequestInterceptor; -/** - * An interceptor that adds the request header needed to use HTTP basic authentication. - */ +/** An interceptor that adds the request header needed to use HTTP basic authentication. */ public class HttpBasicAuth implements RequestInterceptor { private String username; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java index e9d0c7cf1a..39b75f4a93 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java @@ -3,9 +3,7 @@ import feign.RequestInterceptor; import feign.RequestTemplate; -/** - * An interceptor that adds the request header needed to use HTTP bearer authentication. - */ +/** An interceptor that adds the request header needed to use HTTP bearer authentication. */ public class HttpBearerAuth implements RequestInterceptor { private final String scheme; @@ -16,14 +14,16 @@ public HttpBearerAuth(String scheme) { } /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * Gets the token, which together with the scheme, will be sent as the value of the Authorization + * header. */ public String getBearerToken() { return bearerToken; } /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * Sets the token, which together with the scheme, will be sent as the value of the Authorization + * header. */ public void setBearerToken(String bearerToken) { this.bearerToken = bearerToken; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index 524a296d1b..1f35da6ed0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -12,25 +12,18 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -/** - * BaseIndexSettings - */ +/** BaseIndexSettings */ @JsonPropertyOrder( { BaseIndexSettings.JSON_PROPERTY_REPLICAS, @@ -109,8 +102,9 @@ public BaseIndexSettings addReplicasItem(String replicasItem) { /** * Creates replicas, exact copies of an index. + * * @return replicas - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") @JsonProperty(JSON_PROPERTY_REPLICAS) @@ -132,8 +126,9 @@ public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { /** * Set the maximum number of hits accessible via pagination. + * * @return paginationLimitedTo - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." @@ -169,8 +164,9 @@ public BaseIndexSettings addDisableTypoToleranceOnWordsItem( /** * A list of words for which you want to turn off typo tolerance. + * * @return disableTypoToleranceOnWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." @@ -208,8 +204,9 @@ public BaseIndexSettings addAttributesToTransliterateItem( /** * Specify on which attributes to apply transliteration. + * * @return attributesToTransliterate - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Specify on which attributes to apply transliteration." @@ -247,8 +244,9 @@ public BaseIndexSettings addCamelCaseAttributesItem( /** * List of attributes on which to do a decomposition of camel case words. + * * @return camelCaseAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." @@ -284,12 +282,15 @@ public BaseIndexSettings putDecompoundedAttributesItem( } /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. + * Specify on which attributes in your index Algolia should apply word segmentation, also known as + * decompounding. + * * @return decompoundedAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." + value = "Specify on which attributes in your index Algolia should apply word segmentation, also" + + " known as decompounding." ) @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) @JsonInclude( @@ -325,12 +326,15 @@ public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { } /** - * Sets the languages at the index level for language-specific processing such as tokenization and normalization. + * Sets the languages at the index level for language-specific processing such as tokenization and + * normalization. + * * @return indexLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." + value = "Sets the languages at the index level for language-specific processing such as" + + " tokenization and normalization." ) @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -350,12 +354,15 @@ public BaseIndexSettings filterPromotes(Boolean filterPromotes) { } /** - * Whether promoted results should match the filters of the current search, except for geographic filters. + * Whether promoted results should match the filters of the current search, except for geographic + * filters. + * * @return filterPromotes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Whether promoted results should match the filters of the current search, except for geographic filters." + value = "Whether promoted results should match the filters of the current search, except for" + + " geographic filters." ) @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -388,8 +395,9 @@ public BaseIndexSettings addDisablePrefixOnAttributesItem( /** * List of attributes on which you want to disable prefix matching. + * * @return disablePrefixOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." @@ -417,8 +425,9 @@ public BaseIndexSettings allowCompressionOfIntegerArray( /** * Enables compression of large integer arrays. + * * @return allowCompressionOfIntegerArray - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) @@ -454,8 +463,9 @@ public BaseIndexSettings addNumericAttributesForFilteringItem( /** * List of numeric attributes that can be used as numerical filters. + * * @return numericAttributesForFiltering - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." @@ -489,8 +499,9 @@ public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { /** * Lets you store custom data in your indices. + * * @return userData - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") @JsonProperty(JSON_PROPERTY_USER_DATA) @@ -629,8 +640,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index a06baebf5c..09cefffd16 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -12,29 +12,20 @@ package com.algolia.model; -import com.algolia.model.OneOfintegerstring; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.NoSuchElementException; import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; -import org.openapitools.jackson.nullable.JsonNullable; -/** - * BaseSearchParams - */ +/** BaseSearchParams */ @JsonPropertyOrder( { BaseSearchParams.JSON_PROPERTY_QUERY, @@ -192,8 +183,9 @@ public BaseSearchParams query(String query) { /** * The text to search in the index. + * * @return query - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") @JsonProperty(JSON_PROPERTY_QUERY) @@ -214,12 +206,15 @@ public BaseSearchParams similarQuery(String similarQuery) { } /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. + * Overrides the query parameter and performs a more generic search that can be used to find + * \"similar\" results. + * * @return similarQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." + value = "Overrides the query parameter and performs a more generic search that can be used to" + + " find \"similar\" results." ) @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -240,8 +235,9 @@ public BaseSearchParams filters(String filters) { /** * Filter the query with numeric, facet and/or tag filters. + * * @return filters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." @@ -273,8 +269,9 @@ public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { /** * Filter hits by facet value. + * * @return facetFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") @JsonProperty(JSON_PROPERTY_FACET_FILTERS) @@ -303,12 +300,15 @@ public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { } /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + * Create filters for ranking purposes, where records that match the filter are ranked higher, or + * lower in the case of a negative optional filter. + * * @return optionalFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." + value = "Create filters for ranking purposes, where records that match the filter are ranked" + + " higher, or lower in the case of a negative optional filter." ) @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -337,8 +337,9 @@ public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { /** * Filter on numeric attributes. + * * @return numericFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) @@ -368,8 +369,9 @@ public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { /** * Filter hits by tags. + * * @return tagFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") @JsonProperty(JSON_PROPERTY_TAG_FILTERS) @@ -391,8 +393,9 @@ public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { /** * Determines how to calculate the total score for filtering. + * * @return sumOrFiltersScores - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Determines how to calculate the total score for filtering." @@ -424,8 +427,9 @@ public BaseSearchParams addFacetsItem(String facetsItem) { /** * Retrieve facets and their facet values. + * * @return facets - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") @JsonProperty(JSON_PROPERTY_FACETS) @@ -447,8 +451,9 @@ public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { /** * Maximum number of facet values to return for each facet during a regular search. + * * @return maxValuesPerFacet - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." @@ -472,8 +477,9 @@ public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { /** * Force faceting to be applied after de-duplication (via the Distinct setting). + * * @return facetingAfterDistinct - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." @@ -497,8 +503,9 @@ public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { /** * Controls how facet values are fetched. + * * @return sortFacetValuesBy - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) @@ -520,8 +527,9 @@ public BaseSearchParams page(Integer page) { /** * Specify the page to retrieve. + * * @return page - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") @JsonProperty(JSON_PROPERTY_PAGE) @@ -543,8 +551,9 @@ public BaseSearchParams offset(Integer offset) { /** * Specify the offset of the first hit to return. + * * @return offset - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") @JsonProperty(JSON_PROPERTY_OFFSET) @@ -565,11 +574,10 @@ public BaseSearchParams length(Integer length) { } /** - * Set the number of hits to retrieve (used only with offset). - * minimum: 1 - * maximum: 1000 + * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 + * * @return length - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." @@ -593,11 +601,13 @@ public BaseSearchParams aroundLatLng(String aroundLatLng) { /** * Search for entries around a central geolocation, enabling a geo search within a circular area. + * * @return aroundLatLng - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Search for entries around a central geolocation, enabling a geo search within a circular area." + value = "Search for entries around a central geolocation, enabling a geo search within a circular" + + " area." ) @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -617,12 +627,15 @@ public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { } /** - * Search for entries around a given location automatically computed from the requester’s IP address. + * Search for entries around a given location automatically computed from the requester’s IP + * address. + * * @return aroundLatLngViaIP - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Search for entries around a given location automatically computed from the requester’s IP address." + value = "Search for entries around a given location automatically computed from the requester’s" + + " IP address." ) @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -644,8 +657,9 @@ public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { /** * Define the maximum radius for a geo search (in meters). + * * @return aroundRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." @@ -679,11 +693,13 @@ public BaseSearchParams aroundPrecision(Integer aroundPrecision) { /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. + * * @return aroundPrecision - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." + value = "Precision of geo search (in meters), to add grouping by geo location to the ranking" + + " formula." ) @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -703,10 +719,10 @@ public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { } /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - * minimum: 1 + * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 + * * @return minimumAroundRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." @@ -742,8 +758,9 @@ public BaseSearchParams addInsideBoundingBoxItem( /** * Search inside a rectangular area (in geo coordinates). + * * @return insideBoundingBox - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." @@ -775,8 +792,9 @@ public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { /** * Search inside a polygon (in geo coordinates). + * * @return insidePolygon - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) @@ -805,12 +823,21 @@ public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { } /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * This parameter changes the default values of certain parameters and settings that work best for + * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, + * analyticsTags and ruleContexts. These parameters and settings work well together when the query + * is formatted in natural language instead of keywords, for example when your user performs a + * voice search. + * * @return naturalLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." + value = "This parameter changes the default values of certain parameters and settings that work" + + " best for a natural language query, such as ignorePlurals, removeStopWords," + + " removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and" + + " settings work well together when the query is formatted in natural language" + + " instead of keywords, for example when your user performs a voice search." ) @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -839,8 +866,9 @@ public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { /** * Enables contextual rules. + * * @return ruleContexts - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) @@ -862,8 +890,9 @@ public BaseSearchParams personalizationImpact(Integer personalizationImpact) { /** * Define the impact of the Personalization feature. + * * @return personalizationImpact - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) @@ -885,8 +914,9 @@ public BaseSearchParams userToken(String userToken) { /** * Associates a certain user token with the current search. + * * @return userToken - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Associates a certain user token with the current search." @@ -910,8 +940,9 @@ public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { /** * Retrieve detailed ranking information. + * * @return getRankingInfo - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) @@ -933,8 +964,9 @@ public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { /** * Enable the Click Analytics feature. + * * @return clickAnalytics - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) @@ -956,8 +988,9 @@ public BaseSearchParams analytics(Boolean analytics) { /** * Whether the current query will be taken into account in the Analytics. + * * @return analytics - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." @@ -989,8 +1022,9 @@ public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { /** * List of tags to apply to the query for analytics purposes. + * * @return analyticsTags - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." @@ -1014,8 +1048,9 @@ public BaseSearchParams percentileComputation(Boolean percentileComputation) { /** * Whether to include or exclude a query from the processing-time percentile computation. + * * @return percentileComputation - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." @@ -1039,8 +1074,9 @@ public BaseSearchParams enableABTest(Boolean enableABTest) { /** * Whether this search should participate in running AB tests. + * * @return enableABTest - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether this search should participate in running AB tests." @@ -1064,8 +1100,9 @@ public BaseSearchParams enableReRanking(Boolean enableReRanking) { /** * Whether this search should use AI Re-Ranking. + * * @return enableReRanking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) @@ -1341,8 +1378,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index 88db72a337..c1ec915293 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -12,25 +12,16 @@ package com.algolia.model; -import com.algolia.model.BaseSearchResponseFacetsStats; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** - * BaseSearchResponse - */ +/** BaseSearchResponse */ @JsonPropertyOrder( { BaseSearchResponse.JSON_PROPERTY_AB_TEST_I_D, @@ -145,12 +136,15 @@ public BaseSearchResponse abTestID(Integer abTestID) { } /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. + * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test + * ID. + * * @return abTestID - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." + value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing" + + " A/B test ID." ) @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -170,12 +164,15 @@ public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { } /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. + * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant + * ID of the index used. + * * @return abTestVariantID - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." + value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the" + + " variant ID of the index used." ) @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -196,8 +193,9 @@ public BaseSearchResponse aroundLatLng(String aroundLatLng) { /** * The computed geo location. + * * @return aroundLatLng - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) @@ -218,12 +216,15 @@ public BaseSearchResponse automaticRadius(String automaticRadius) { } /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. + * The automatically computed radius. For legacy reasons, this parameter is a string and not an + * integer. + * * @return automaticRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." + value = "The automatically computed radius. For legacy reasons, this parameter is a string and" + + " not an integer." ) @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -246,8 +247,9 @@ public BaseSearchResponse exhaustiveFacetsCount( /** * Whether the facet count is exhaustive or approximate. + * * @return exhaustiveFacetsCount - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." @@ -271,8 +273,9 @@ public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { /** * Indicate if the nbHits count was exhaustive or approximate + * * @return exhaustiveNbHits - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -296,13 +299,16 @@ public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { } /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + * Indicate if the typo-tolerence search was exhaustive or approximate (only included when + * typo-tolerance is enabled) + * * @return exhaustiveTypo - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, - value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" + value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when" + + " typo-tolerance is enabled)" ) @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -334,8 +340,9 @@ public BaseSearchResponse putFacetsItem( /** * A mapping of each facet name to the corresponding facet counts. + * * @return facets - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "{\"category\":{\"food\":1,\"tech\":42}}", @@ -373,8 +380,9 @@ public BaseSearchResponse putFacetsStatsItem( /** * Statistics for numerical facets. + * * @return facetsStats - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") @JsonProperty(JSON_PROPERTY_FACETS_STATS) @@ -398,8 +406,9 @@ public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { /** * Set the number of hits per page. + * * @return hitsPerPage - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) @@ -421,8 +430,9 @@ public BaseSearchResponse index(String index) { /** * Index name used for the query. + * * @return index - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "indexName", @@ -446,13 +456,16 @@ public BaseSearchResponse indexUsed(String indexUsed) { } /** - * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. + * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the + * index used by the query. + * * @return indexUsed - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "indexNameAlt", - value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." + value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t" + + " always the index used by the query." ) @JsonProperty(JSON_PROPERTY_INDEX_USED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -473,8 +486,9 @@ public BaseSearchResponse message(String message) { /** * Used to return warnings about the query. + * * @return message - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") @JsonProperty(JSON_PROPERTY_MESSAGE) @@ -496,8 +510,9 @@ public BaseSearchResponse nbHits(Integer nbHits) { /** * Number of hits that the search query matched + * * @return nbHits - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "20", @@ -523,8 +538,9 @@ public BaseSearchResponse nbPages(Integer nbPages) { /** * Number of pages available for the current query + * * @return nbPages - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "1", @@ -550,8 +566,9 @@ public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { /** * The number of hits selected and sorted by the relevant sort algorithm + * * @return nbSortedHits - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "20", @@ -576,8 +593,9 @@ public BaseSearchResponse page(Integer page) { /** * Specify the page to retrieve. + * * @return page - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") @JsonProperty(JSON_PROPERTY_PAGE) @@ -599,8 +617,9 @@ public BaseSearchResponse params(String params) { /** * A url-encoded string of all search parameters. + * * @return params - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "query=a&hitsPerPage=20", @@ -626,8 +645,9 @@ public BaseSearchResponse parsedQuery(String parsedQuery) { /** * The query string that will be searched, after normalization. + * * @return parsedQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The query string that will be searched, after normalization." @@ -651,8 +671,9 @@ public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { /** * Time the server took to process the request, in milliseconds. + * * @return processingTimeMS - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "20", @@ -678,8 +699,9 @@ public BaseSearchResponse query(String query) { /** * The text to search in the index. + * * @return query - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") @JsonProperty(JSON_PROPERTY_QUERY) @@ -700,12 +722,15 @@ public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { } /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. + * A markup text indicating which parts of the original query have been removed in order to + * retrieve a non-empty result set. + * * @return queryAfterRemoval - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." + value = "A markup text indicating which parts of the original query have been removed in order to" + + " retrieve a non-empty result set." ) @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -726,8 +751,9 @@ public BaseSearchResponse serverUsed(String serverUsed) { /** * Actual host name of the server that processed the request. + * * @return serverUsed - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Actual host name of the server that processed the request." @@ -759,8 +785,9 @@ public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { /** * Lets you store custom data in your indices. + * * @return userData - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") @JsonProperty(JSON_PROPERTY_USER_DATA) @@ -941,8 +968,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java index 4fad206779..0cad641410 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -12,21 +12,14 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * BaseSearchResponseFacetsStats - */ +/** BaseSearchResponseFacetsStats */ @JsonPropertyOrder( { BaseSearchResponseFacetsStats.JSON_PROPERTY_MIN, @@ -57,8 +50,9 @@ public BaseSearchResponseFacetsStats min(Integer min) { /** * The minimum value in the result set. + * * @return min - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The minimum value in the result set.") @JsonProperty(JSON_PROPERTY_MIN) @@ -80,8 +74,9 @@ public BaseSearchResponseFacetsStats max(Integer max) { /** * The maximum value in the result set. + * * @return max - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The maximum value in the result set.") @JsonProperty(JSON_PROPERTY_MAX) @@ -103,8 +98,9 @@ public BaseSearchResponseFacetsStats avg(Integer avg) { /** * The average facet value in the result set. + * * @return avg - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The average facet value in the result set.") @JsonProperty(JSON_PROPERTY_AVG) @@ -126,8 +122,9 @@ public BaseSearchResponseFacetsStats sum(Integer sum) { /** * The sum of all values in the result set. + * * @return sum - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The sum of all values in the result set.") @JsonProperty(JSON_PROPERTY_SUM) @@ -177,8 +174,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 468758488b..5647309b28 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -12,24 +12,17 @@ package com.algolia.model; -import com.algolia.model.Operation; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * The `batch` requests. - */ +/** The `batch` requests. */ @ApiModel(description = "The `batch` requests.") @JsonPropertyOrder({ BatchObject.JSON_PROPERTY_REQUESTS }) @JsonTypeName("batchObject") @@ -53,8 +46,9 @@ public BatchObject addRequestsItem(Operation requestsItem) { /** * Get requests + * * @return requests - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_REQUESTS) @@ -96,8 +90,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index 404af3a895..6d17b08f37 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -12,23 +12,16 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * BatchResponse - */ +/** BatchResponse */ @JsonPropertyOrder( { BatchResponse.JSON_PROPERTY_TASK_I_D, @@ -51,8 +44,9 @@ public BatchResponse taskID(Integer taskID) { /** * taskID of the indexing task to wait for. + * * @return taskID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") @JsonProperty(JSON_PROPERTY_TASK_I_D) @@ -82,8 +76,9 @@ public BatchResponse addObjectIDsItem(String objectIDsItem) { /** * List of objectID. + * * @return objectIDs - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "List of objectID.") @JsonProperty(JSON_PROPERTY_OBJECT_I_DS) @@ -132,8 +127,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index d5379c06b3..846417f3ba 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -12,22 +12,15 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; -import java.util.Arrays; import java.util.Objects; -/** - * DeleteIndexResponse - */ +/** DeleteIndexResponse */ @JsonPropertyOrder( { DeleteIndexResponse.JSON_PROPERTY_TASK_I_D, @@ -50,8 +43,9 @@ public DeleteIndexResponse taskID(Integer taskID) { /** * taskID of the indexing task to wait for. + * * @return taskID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") @JsonProperty(JSON_PROPERTY_TASK_I_D) @@ -73,8 +67,9 @@ public DeleteIndexResponse deleteAt(OffsetDateTime deleteAt) { /** * Date of deletion (ISO-8601 format). + * * @return deleteAt - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") @JsonProperty(JSON_PROPERTY_DELETE_AT) @@ -120,8 +115,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java index bc50487b5e..dc621fa24d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -12,23 +12,16 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.HashMap; -import java.util.Map; import java.util.Objects; -/** - * Error. - */ +/** Error. */ @ApiModel(description = "Error.") @JsonPropertyOrder({ ErrorBase.JSON_PROPERTY_MESSAGE }) @JsonTypeName("ErrorBase") @@ -44,8 +37,9 @@ public ErrorBase message(String message) { /** * Get message + * * @return message - **/ + */ @javax.annotation.Nullable @ApiModelProperty(example = "Invalid Application-Id or API-Key", value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @@ -88,8 +82,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index 1256ec3fec..1a92468013 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -17,18 +17,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * HighlightResult - */ +/** HighlightResult */ @JsonPropertyOrder( { HighlightResult.JSON_PROPERTY_VALUE, @@ -43,9 +38,7 @@ public class HighlightResult { public static final String JSON_PROPERTY_VALUE = "value"; private String value; - /** - * Indicates how well the attribute matched the search query. - */ + /** Indicates how well the attribute matched the search query. */ public enum MatchLevelEnum { NONE("none"), @@ -97,8 +90,9 @@ public HighlightResult value(String value) { /** * Markup text with occurrences highlighted. + * * @return value - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "George Clooney", @@ -123,8 +117,9 @@ public HighlightResult matchLevel(MatchLevelEnum matchLevel) { /** * Indicates how well the attribute matched the search query. + * * @return matchLevel - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Indicates how well the attribute matched the search query." @@ -156,8 +151,9 @@ public HighlightResult addMatchedWordsItem(String matchedWordsItem) { /** * List of words from the query that matched the object. + * * @return matchedWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of words from the query that matched the object." @@ -181,8 +177,9 @@ public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { /** * Whether the entire attribute value is highlighted. + * * @return fullyHighlighted - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether the entire attribute value is highlighted." @@ -243,8 +240,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index 01b2318b17..2f35aaac62 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -12,24 +12,17 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * Index - */ +/** Index */ @JsonPropertyOrder( { Index.JSON_PROPERTY_NAME, @@ -89,8 +82,9 @@ public Index name(String name) { /** * Index name. + * * @return name - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Index name.") @JsonProperty(JSON_PROPERTY_NAME) @@ -112,8 +106,9 @@ public Index createdAt(OffsetDateTime createdAt) { /** * Index creation date. An empty string means that the index has no records. + * * @return createdAt - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -138,8 +133,9 @@ public Index updatedAt(OffsetDateTime updatedAt) { /** * Date of last update (ISO-8601 format). + * * @return updatedAt - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -164,8 +160,9 @@ public Index entries(Integer entries) { /** * Number of records contained in the index. + * * @return entries - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -190,8 +187,9 @@ public Index dataSize(Integer dataSize) { /** * Number of bytes of the index in minified format. + * * @return dataSize - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -216,8 +214,9 @@ public Index fileSize(Integer fileSize) { /** * Number of bytes of the index binary file. + * * @return fileSize - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -242,8 +241,9 @@ public Index lastBuildTimeS(Integer lastBuildTimeS) { /** * Last build time + * * @return lastBuildTimeS - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Last build time") @JsonProperty(JSON_PROPERTY_LAST_BUILD_TIME_S) @@ -265,8 +265,9 @@ public Index numberOfPendingTask(Integer numberOfPendingTask) { /** * Number of pending indexing operations. This value is deprecated and should not be used. + * * @return numberOfPendingTask - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Number of pending indexing operations. This value is deprecated and should not be used." @@ -289,13 +290,16 @@ public Index pendingTask(Boolean pendingTask) { } /** - * A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. + * A boolean which says whether the index has pending tasks. This value is deprecated and should + * not be used. + * * @return pendingTask - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, - value = "A boolean which says whether the index has pending tasks. This value is deprecated and should not be used." + value = "A boolean which says whether the index has pending tasks. This value is deprecated and" + + " should not be used." ) @JsonProperty(JSON_PROPERTY_PENDING_TASK) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -316,8 +320,9 @@ public Index primary(String primary) { /** * Only present if the index is a replica. Contains the name of the related primary index. + * * @return primary - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Only present if the index is a replica. Contains the name of the related primary index." @@ -348,12 +353,15 @@ public Index addReplicasItem(String replicasItem) { } /** - * Only present if the index is a primary index with replicas. Contains the names of all linked replicas. + * Only present if the index is a primary index with replicas. Contains the names of all linked + * replicas. + * * @return replicas - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Only present if the index is a primary index with replicas. Contains the names of all linked replicas." + value = "Only present if the index is a primary index with replicas. Contains the names of all" + + " linked replicas." ) @JsonProperty(JSON_PROPERTY_REPLICAS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -443,8 +451,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index 7ced42c5f3..cb4bfcb52e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -12,27 +12,21 @@ package com.algolia.model; -import com.algolia.model.BaseIndexSettings; -import com.algolia.model.IndexSettingsAsSearchParams; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -/** - * The Algolia index settings. - */ +/** The Algolia index settings. */ @ApiModel(description = "The Algolia index settings.") @JsonPropertyOrder( { @@ -206,9 +200,7 @@ public class IndexSettings { "minWordSizefor2Typos"; private Integer minWordSizefor2Typos = 8; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ + /** Controls whether typo tolerance is enabled and how it is applied. */ public enum TypoToleranceEnum { TRUE("true"), @@ -284,9 +276,7 @@ public static TypoToleranceEnum fromValue(String value) { "enablePersonalization"; private Boolean enablePersonalization = false; - /** - * Controls if and how query words are interpreted as prefixes. - */ + /** Controls if and how query words are interpreted as prefixes. */ public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -324,9 +314,7 @@ public static QueryTypeEnum fromValue(String value) { public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - /** - * Selects a strategy to remove words from the query when it doesn’t match any hits. - */ + /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -378,9 +366,7 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { "disableExactOnAttributes"; private List disableExactOnAttributes = null; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ + /** Controls how the exact ranking criterion is computed when the query contains only one word. */ public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -420,9 +406,7 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; - /** - * Gets or Sets alternativesAsExact - */ + /** Gets or Sets alternativesAsExact */ public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -461,9 +445,7 @@ public static AlternativesAsExactEnum fromValue(String value) { "alternativesAsExact"; private List alternativesAsExact = null; - /** - * Gets or Sets advancedSyntaxFeatures - */ + /** Gets or Sets advancedSyntaxFeatures */ public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -542,8 +524,9 @@ public IndexSettings addReplicasItem(String replicasItem) { /** * Creates replicas, exact copies of an index. + * * @return replicas - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") @JsonProperty(JSON_PROPERTY_REPLICAS) @@ -565,8 +548,9 @@ public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { /** * Set the maximum number of hits accessible via pagination. + * * @return paginationLimitedTo - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." @@ -602,8 +586,9 @@ public IndexSettings addDisableTypoToleranceOnWordsItem( /** * A list of words for which you want to turn off typo tolerance. + * * @return disableTypoToleranceOnWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." @@ -641,8 +626,9 @@ public IndexSettings addAttributesToTransliterateItem( /** * Specify on which attributes to apply transliteration. + * * @return attributesToTransliterate - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Specify on which attributes to apply transliteration." @@ -678,8 +664,9 @@ public IndexSettings addCamelCaseAttributesItem( /** * List of attributes on which to do a decomposition of camel case words. + * * @return camelCaseAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." @@ -715,12 +702,15 @@ public IndexSettings putDecompoundedAttributesItem( } /** - * Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding. + * Specify on which attributes in your index Algolia should apply word segmentation, also known as + * decompounding. + * * @return decompoundedAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding." + value = "Specify on which attributes in your index Algolia should apply word segmentation, also" + + " known as decompounding." ) @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) @JsonInclude( @@ -756,12 +746,15 @@ public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { } /** - * Sets the languages at the index level for language-specific processing such as tokenization and normalization. + * Sets the languages at the index level for language-specific processing such as tokenization and + * normalization. + * * @return indexLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Sets the languages at the index level for language-specific processing such as tokenization and normalization." + value = "Sets the languages at the index level for language-specific processing such as" + + " tokenization and normalization." ) @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -781,12 +774,15 @@ public IndexSettings filterPromotes(Boolean filterPromotes) { } /** - * Whether promoted results should match the filters of the current search, except for geographic filters. + * Whether promoted results should match the filters of the current search, except for geographic + * filters. + * * @return filterPromotes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Whether promoted results should match the filters of the current search, except for geographic filters." + value = "Whether promoted results should match the filters of the current search, except for" + + " geographic filters." ) @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -819,8 +815,9 @@ public IndexSettings addDisablePrefixOnAttributesItem( /** * List of attributes on which you want to disable prefix matching. + * * @return disablePrefixOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." @@ -848,8 +845,9 @@ public IndexSettings allowCompressionOfIntegerArray( /** * Enables compression of large integer arrays. + * * @return allowCompressionOfIntegerArray - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) @@ -885,8 +883,9 @@ public IndexSettings addNumericAttributesForFilteringItem( /** * List of numeric attributes that can be used as numerical filters. + * * @return numericAttributesForFiltering - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." @@ -920,8 +919,9 @@ public IndexSettings putUserDataItem(String key, Object userDataItem) { /** * Lets you store custom data in your indices. + * * @return userData - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") @JsonProperty(JSON_PROPERTY_USER_DATA) @@ -959,8 +959,9 @@ public IndexSettings addSearchableAttributesItem( /** * The complete list of attributes used for searching. + * * @return searchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes used for searching." @@ -996,8 +997,9 @@ public IndexSettings addAttributesForFacetingItem( /** * The complete list of attributes that will be used for faceting. + * * @return attributesForFaceting - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." @@ -1033,8 +1035,9 @@ public IndexSettings addUnretrievableAttributesItem( /** * List of attributes that can’t be retrieved at query time. + * * @return unretrievableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." @@ -1068,8 +1071,9 @@ public IndexSettings addAttributesToRetrieveItem( /** * This parameter controls which attributes to retrieve and which not to retrieve. + * * @return attributesToRetrieve - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." @@ -1105,8 +1109,9 @@ public IndexSettings addRestrictSearchableAttributesItem( /** * Restricts a given query to look in only a subset of your searchable attributes. + * * @return restrictSearchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." @@ -1140,8 +1145,9 @@ public IndexSettings addRankingItem(String rankingItem) { /** * Controls how Algolia should sort your results. + * * @return ranking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") @JsonProperty(JSON_PROPERTY_RANKING) @@ -1171,8 +1177,9 @@ public IndexSettings addCustomRankingItem(String customRankingItem) { /** * Specifies the custom ranking criterion. + * * @return customRanking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) @@ -1193,12 +1200,15 @@ public IndexSettings relevancyStrictness(Integer relevancyStrictness) { } /** - * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * Controls the relevancy threshold below which less relevant results aren’t included in the + * results. + * * @return relevancyStrictness - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + value = "Controls the relevancy threshold below which less relevant results aren’t included in" + + " the results." ) @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1231,8 +1241,9 @@ public IndexSettings addAttributesToHighlightItem( /** * List of attributes to highlight. + * * @return attributesToHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) @@ -1264,8 +1275,9 @@ public IndexSettings addAttributesToSnippetItem( /** * List of attributes to snippet, with an optional maximum number of words to snippet. + * * @return attributesToSnippet - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." @@ -1289,11 +1301,13 @@ public IndexSettings highlightPreTag(String highlightPreTag) { /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * * @return highlightPreTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1314,11 +1328,13 @@ public IndexSettings highlightPostTag(String highlightPostTag) { /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * * @return highlightPostTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1339,8 +1355,9 @@ public IndexSettings snippetEllipsisText(String snippetEllipsisText) { /** * String used as an ellipsis indicator when a snippet is truncated. + * * @return snippetEllipsisText - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." @@ -1366,8 +1383,9 @@ public IndexSettings restrictHighlightAndSnippetArrays( /** * Restrict highlighting and snippeting to items that matched the query. + * * @return restrictHighlightAndSnippetArrays - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." @@ -1393,8 +1411,9 @@ public IndexSettings hitsPerPage(Integer hitsPerPage) { /** * Set the number of hits per page. + * * @return hitsPerPage - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) @@ -1415,12 +1434,15 @@ public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { } /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * Minimum number of characters a word in the query string must contain to accept matches with 1 + * typo. + * * @return minWordSizefor1Typo - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 1 typo." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1440,12 +1462,15 @@ public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { } /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * Minimum number of characters a word in the query string must contain to accept matches with 2 + * typos. + * * @return minWordSizefor2Typos - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 2 typos." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1466,8 +1491,9 @@ public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { /** * Controls whether typo tolerance is enabled and how it is applied. + * * @return typoTolerance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." @@ -1493,8 +1519,9 @@ public IndexSettings allowTyposOnNumericTokens( /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * * @return allowTyposOnNumericTokens - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." @@ -1532,8 +1559,9 @@ public IndexSettings addDisableTypoToleranceOnAttributesItem( /** * List of attributes on which you want to disable typo tolerance. + * * @return disableTypoToleranceOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." @@ -1559,8 +1587,9 @@ public IndexSettings separatorsToIndex(String separatorsToIndex) { /** * Control which separators are indexed. + * * @return separatorsToIndex - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) @@ -1582,8 +1611,9 @@ public IndexSettings ignorePlurals(String ignorePlurals) { /** * Treats singular, plurals, and other forms of declensions as matching terms. + * * @return ignorePlurals - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." @@ -1607,8 +1637,9 @@ public IndexSettings removeStopWords(String removeStopWords) { /** * Removes stop (common) words from the query before executing it. + * * @return removeStopWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." @@ -1634,8 +1665,9 @@ public IndexSettings keepDiacriticsOnCharacters( /** * List of characters that the engine shouldn’t automatically normalize. + * * @return keepDiacriticsOnCharacters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." @@ -1666,12 +1698,15 @@ public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { } /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * Sets the languages to be used by language-specific settings and functionalities such as + * ignorePlurals, removeStopWords, and CJK word-detection. + * * @return queryLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + value = "Sets the languages to be used by language-specific settings and functionalities such as" + + " ignorePlurals, removeStopWords, and CJK word-detection." ) @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1692,8 +1727,9 @@ public IndexSettings decompoundQuery(Boolean decompoundQuery) { /** * Splits compound words into their composing atoms in the query. + * * @return decompoundQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." @@ -1717,8 +1753,9 @@ public IndexSettings enableRules(Boolean enableRules) { /** * Whether Rules should be globally enabled. + * * @return enableRules - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") @JsonProperty(JSON_PROPERTY_ENABLE_RULES) @@ -1740,8 +1777,9 @@ public IndexSettings enablePersonalization(Boolean enablePersonalization) { /** * Enable the Personalization feature. + * * @return enablePersonalization - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) @@ -1763,8 +1801,9 @@ public IndexSettings queryType(QueryTypeEnum queryType) { /** * Controls if and how query words are interpreted as prefixes. + * * @return queryType - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." @@ -1790,8 +1829,9 @@ public IndexSettings removeWordsIfNoResults( /** * Selects a strategy to remove words from the query when it doesn’t match any hits. + * * @return removeWordsIfNoResults - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." @@ -1817,8 +1857,9 @@ public IndexSettings advancedSyntax(Boolean advancedSyntax) { /** * Enables the advanced query syntax. + * * @return advancedSyntax - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) @@ -1848,8 +1889,9 @@ public IndexSettings addOptionalWordsItem(String optionalWordsItem) { /** * A list of words that should be considered as optional when found in the query. + * * @return optionalWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." @@ -1885,8 +1927,9 @@ public IndexSettings addDisableExactOnAttributesItem( /** * List of attributes on which you want to disable the exact ranking criterion. + * * @return disableExactOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." @@ -1914,11 +1957,13 @@ public IndexSettings exactOnSingleWordQuery( /** * Controls how the exact ranking criterion is computed when the query contains only one word. + * * @return exactOnSingleWordQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls how the exact ranking criterion is computed when the query contains only one word." + value = "Controls how the exact ranking criterion is computed when the query contains only one" + + " word." ) @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1953,11 +1998,13 @@ public IndexSettings addAlternativesAsExactItem( /** * List of alternatives that should be considered an exact match by the exact ranking criterion. + * * @return alternativesAsExact - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + value = "List of alternatives that should be considered an exact match by the exact ranking" + + " criterion." ) @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1991,12 +2038,15 @@ public IndexSettings addAdvancedSyntaxFeaturesItem( } /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is + * enabled. + * * @return advancedSyntaxFeatures - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + + " enabled." ) @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2018,11 +2068,10 @@ public IndexSettings distinct(Integer distinct) { } /** - * Enables de-duplication or grouping of results. - * minimum: 0 - * maximum: 4 + * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 + * * @return distinct - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") @JsonProperty(JSON_PROPERTY_DISTINCT) @@ -2044,8 +2093,9 @@ public IndexSettings synonyms(Boolean synonyms) { /** * Whether to take into account an index’s synonyms for a particular search. + * * @return synonyms - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." @@ -2070,12 +2120,15 @@ public IndexSettings replaceSynonymsInHighlight( } /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * Whether to highlight and snippet the original word that matches the synonym or the synonym + * itself. + * * @return replaceSynonymsInHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + value = "Whether to highlight and snippet the original word that matches the synonym or the" + + " synonym itself." ) @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2097,11 +2150,10 @@ public IndexSettings minProximity(Integer minProximity) { } /** - * Precision of the proximity ranking criterion. - * minimum: 1 - * maximum: 7 + * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 + * * @return minProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) @@ -2130,12 +2182,15 @@ public IndexSettings addResponseFieldsItem(String responseFieldsItem) { } /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * Choose which fields to return in the API response. This parameters applies to search and browse + * queries. + * * @return responseFields - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + value = "Choose which fields to return in the API response. This parameters applies to search and" + + " browse queries." ) @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2156,8 +2211,9 @@ public IndexSettings maxFacetHits(Integer maxFacetHits) { /** * Maximum number of facet hits to return during a search for facet values. + * * @return maxFacetHits - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." @@ -2183,12 +2239,15 @@ public IndexSettings attributeCriteriaComputedByMinProximity( } /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * When attribute is ranked above proximity in your ranking formula, proximity is used to select + * which searchable attribute is matched in the attribute ranking stage. + * * @return attributeCriteriaComputedByMinProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + + " select which searchable attribute is matched in the attribute ranking stage." ) @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2211,12 +2270,15 @@ public IndexSettings renderingContent(Object renderingContent) { } /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * Content defining how the search interface should be rendered. Can be set via the settings for a + * default value and can be overridden via rules. + * * @return renderingContent - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + value = "Content defining how the search interface should be rendered. Can be set via the" + + " settings for a default value and can be overridden via rules." ) @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2672,8 +2734,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index 363093b239..3b0239b29f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -17,18 +17,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * IndexSettingsAsSearchParams - */ +/** IndexSettingsAsSearchParams */ @JsonPropertyOrder( { IndexSettingsAsSearchParams.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, @@ -145,9 +140,7 @@ public class IndexSettingsAsSearchParams { "minWordSizefor2Typos"; private Integer minWordSizefor2Typos = 8; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ + /** Controls whether typo tolerance is enabled and how it is applied. */ public enum TypoToleranceEnum { TRUE("true"), @@ -223,9 +216,7 @@ public static TypoToleranceEnum fromValue(String value) { "enablePersonalization"; private Boolean enablePersonalization = false; - /** - * Controls if and how query words are interpreted as prefixes. - */ + /** Controls if and how query words are interpreted as prefixes. */ public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -263,9 +254,7 @@ public static QueryTypeEnum fromValue(String value) { public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - /** - * Selects a strategy to remove words from the query when it doesn’t match any hits. - */ + /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -317,9 +306,7 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { "disableExactOnAttributes"; private List disableExactOnAttributes = null; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ + /** Controls how the exact ranking criterion is computed when the query contains only one word. */ public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -359,9 +346,7 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; - /** - * Gets or Sets alternativesAsExact - */ + /** Gets or Sets alternativesAsExact */ public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -400,9 +385,7 @@ public static AlternativesAsExactEnum fromValue(String value) { "alternativesAsExact"; private List alternativesAsExact = null; - /** - * Gets or Sets advancedSyntaxFeatures - */ + /** Gets or Sets advancedSyntaxFeatures */ public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -485,8 +468,9 @@ public IndexSettingsAsSearchParams addSearchableAttributesItem( /** * The complete list of attributes used for searching. + * * @return searchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes used for searching." @@ -522,8 +506,9 @@ public IndexSettingsAsSearchParams addAttributesForFacetingItem( /** * The complete list of attributes that will be used for faceting. + * * @return attributesForFaceting - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." @@ -559,8 +544,9 @@ public IndexSettingsAsSearchParams addUnretrievableAttributesItem( /** * List of attributes that can’t be retrieved at query time. + * * @return unretrievableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." @@ -596,8 +582,9 @@ public IndexSettingsAsSearchParams addAttributesToRetrieveItem( /** * This parameter controls which attributes to retrieve and which not to retrieve. + * * @return attributesToRetrieve - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." @@ -633,8 +620,9 @@ public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem( /** * Restricts a given query to look in only a subset of your searchable attributes. + * * @return restrictSearchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." @@ -668,8 +656,9 @@ public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { /** * Controls how Algolia should sort your results. + * * @return ranking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") @JsonProperty(JSON_PROPERTY_RANKING) @@ -701,8 +690,9 @@ public IndexSettingsAsSearchParams addCustomRankingItem( /** * Specifies the custom ranking criterion. + * * @return customRanking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) @@ -725,12 +715,15 @@ public IndexSettingsAsSearchParams relevancyStrictness( } /** - * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * Controls the relevancy threshold below which less relevant results aren’t included in the + * results. + * * @return relevancyStrictness - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + value = "Controls the relevancy threshold below which less relevant results aren’t included in" + + " the results." ) @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -763,8 +756,9 @@ public IndexSettingsAsSearchParams addAttributesToHighlightItem( /** * List of attributes to highlight. + * * @return attributesToHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) @@ -798,8 +792,9 @@ public IndexSettingsAsSearchParams addAttributesToSnippetItem( /** * List of attributes to snippet, with an optional maximum number of words to snippet. + * * @return attributesToSnippet - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." @@ -823,11 +818,13 @@ public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * * @return highlightPreTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -848,11 +845,13 @@ public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * * @return highlightPostTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -875,8 +874,9 @@ public IndexSettingsAsSearchParams snippetEllipsisText( /** * String used as an ellipsis indicator when a snippet is truncated. + * * @return snippetEllipsisText - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." @@ -902,8 +902,9 @@ public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays( /** * Restrict highlighting and snippeting to items that matched the query. + * * @return restrictHighlightAndSnippetArrays - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." @@ -929,8 +930,9 @@ public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { /** * Set the number of hits per page. + * * @return hitsPerPage - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) @@ -953,12 +955,15 @@ public IndexSettingsAsSearchParams minWordSizefor1Typo( } /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * Minimum number of characters a word in the query string must contain to accept matches with 1 + * typo. + * * @return minWordSizefor1Typo - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 1 typo." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -980,12 +985,15 @@ public IndexSettingsAsSearchParams minWordSizefor2Typos( } /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * Minimum number of characters a word in the query string must contain to accept matches with 2 + * typos. + * * @return minWordSizefor2Typos - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 2 typos." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1008,8 +1016,9 @@ public IndexSettingsAsSearchParams typoTolerance( /** * Controls whether typo tolerance is enabled and how it is applied. + * * @return typoTolerance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." @@ -1035,8 +1044,9 @@ public IndexSettingsAsSearchParams allowTyposOnNumericTokens( /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * * @return allowTyposOnNumericTokens - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." @@ -1074,8 +1084,9 @@ public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem( /** * List of attributes on which you want to disable typo tolerance. + * * @return disableTypoToleranceOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." @@ -1103,8 +1114,9 @@ public IndexSettingsAsSearchParams separatorsToIndex( /** * Control which separators are indexed. + * * @return separatorsToIndex - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) @@ -1126,8 +1138,9 @@ public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { /** * Treats singular, plurals, and other forms of declensions as matching terms. + * * @return ignorePlurals - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." @@ -1151,8 +1164,9 @@ public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { /** * Removes stop (common) words from the query before executing it. + * * @return removeStopWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." @@ -1178,8 +1192,9 @@ public IndexSettingsAsSearchParams keepDiacriticsOnCharacters( /** * List of characters that the engine shouldn’t automatically normalize. + * * @return keepDiacriticsOnCharacters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." @@ -1214,12 +1229,15 @@ public IndexSettingsAsSearchParams addQueryLanguagesItem( } /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * Sets the languages to be used by language-specific settings and functionalities such as + * ignorePlurals, removeStopWords, and CJK word-detection. + * * @return queryLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + value = "Sets the languages to be used by language-specific settings and functionalities such as" + + " ignorePlurals, removeStopWords, and CJK word-detection." ) @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1240,8 +1258,9 @@ public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { /** * Splits compound words into their composing atoms in the query. + * * @return decompoundQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." @@ -1265,8 +1284,9 @@ public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { /** * Whether Rules should be globally enabled. + * * @return enableRules - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") @JsonProperty(JSON_PROPERTY_ENABLE_RULES) @@ -1290,8 +1310,9 @@ public IndexSettingsAsSearchParams enablePersonalization( /** * Enable the Personalization feature. + * * @return enablePersonalization - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) @@ -1313,8 +1334,9 @@ public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { /** * Controls if and how query words are interpreted as prefixes. + * * @return queryType - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." @@ -1340,8 +1362,9 @@ public IndexSettingsAsSearchParams removeWordsIfNoResults( /** * Selects a strategy to remove words from the query when it doesn’t match any hits. + * * @return removeWordsIfNoResults - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." @@ -1367,8 +1390,9 @@ public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { /** * Enables the advanced query syntax. + * * @return advancedSyntax - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) @@ -1400,8 +1424,9 @@ public IndexSettingsAsSearchParams addOptionalWordsItem( /** * A list of words that should be considered as optional when found in the query. + * * @return optionalWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." @@ -1437,8 +1462,9 @@ public IndexSettingsAsSearchParams addDisableExactOnAttributesItem( /** * List of attributes on which you want to disable the exact ranking criterion. + * * @return disableExactOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." @@ -1466,11 +1492,13 @@ public IndexSettingsAsSearchParams exactOnSingleWordQuery( /** * Controls how the exact ranking criterion is computed when the query contains only one word. + * * @return exactOnSingleWordQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls how the exact ranking criterion is computed when the query contains only one word." + value = "Controls how the exact ranking criterion is computed when the query contains only one" + + " word." ) @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1505,11 +1533,13 @@ public IndexSettingsAsSearchParams addAlternativesAsExactItem( /** * List of alternatives that should be considered an exact match by the exact ranking criterion. + * * @return alternativesAsExact - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + value = "List of alternatives that should be considered an exact match by the exact ranking" + + " criterion." ) @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1543,12 +1573,15 @@ public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem( } /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is + * enabled. + * * @return advancedSyntaxFeatures - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + + " enabled." ) @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1570,11 +1603,10 @@ public IndexSettingsAsSearchParams distinct(Integer distinct) { } /** - * Enables de-duplication or grouping of results. - * minimum: 0 - * maximum: 4 + * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 + * * @return distinct - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") @JsonProperty(JSON_PROPERTY_DISTINCT) @@ -1596,8 +1628,9 @@ public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { /** * Whether to take into account an index’s synonyms for a particular search. + * * @return synonyms - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." @@ -1622,12 +1655,15 @@ public IndexSettingsAsSearchParams replaceSynonymsInHighlight( } /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * Whether to highlight and snippet the original word that matches the synonym or the synonym + * itself. + * * @return replaceSynonymsInHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + value = "Whether to highlight and snippet the original word that matches the synonym or the" + + " synonym itself." ) @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1649,11 +1685,10 @@ public IndexSettingsAsSearchParams minProximity(Integer minProximity) { } /** - * Precision of the proximity ranking criterion. - * minimum: 1 - * maximum: 7 + * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 + * * @return minProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) @@ -1686,12 +1721,15 @@ public IndexSettingsAsSearchParams addResponseFieldsItem( } /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * Choose which fields to return in the API response. This parameters applies to search and browse + * queries. + * * @return responseFields - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + value = "Choose which fields to return in the API response. This parameters applies to search and" + + " browse queries." ) @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1712,8 +1750,9 @@ public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { /** * Maximum number of facet hits to return during a search for facet values. + * * @return maxFacetHits - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." @@ -1739,12 +1778,15 @@ public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity( } /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * When attribute is ranked above proximity in your ranking formula, proximity is used to select + * which searchable attribute is matched in the attribute ranking stage. + * * @return attributeCriteriaComputedByMinProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + + " select which searchable attribute is matched in the attribute ranking stage." ) @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1767,12 +1809,15 @@ public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { } /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * Content defining how the search interface should be rendered. Can be set via the settings for a + * default value and can be overridden via rules. + * * @return renderingContent - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + value = "Content defining how the search interface should be rendered. Can be set via the" + + " settings for a default value and can be overridden via rules." ) @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2189,8 +2234,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index 63bf09be03..98b642cca7 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -12,24 +12,16 @@ package com.algolia.model; -import com.algolia.model.Index; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * ListIndicesResponse - */ +/** ListIndicesResponse */ @JsonPropertyOrder( { ListIndicesResponse.JSON_PROPERTY_ITEMS, @@ -60,8 +52,9 @@ public ListIndicesResponse addItemsItem(Index itemsItem) { /** * List of the fetched indices. + * * @return items - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "List of the fetched indices.") @JsonProperty(JSON_PROPERTY_ITEMS) @@ -83,8 +76,9 @@ public ListIndicesResponse nbPages(Integer nbPages) { /** * Number of pages. + * * @return nbPages - **/ + */ @javax.annotation.Nullable @ApiModelProperty(example = "100", value = "Number of pages.") @JsonProperty(JSON_PROPERTY_NB_PAGES) @@ -130,8 +124,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java index 0b23ee86ea..ba993e0c9c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -17,16 +17,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * MultipleQueries - */ +/** MultipleQueries */ @JsonPropertyOrder( { MultipleQueries.JSON_PROPERTY_INDEX_NAME, @@ -46,7 +41,8 @@ public class MultipleQueries { private String query = ""; /** - * Perform a search query with `default`, will search for facet values if `facet` is given. + * Perform a search query with `default`, will search for facet values if + * `facet` is given. */ public enum TypeEnum { DEFAULT("default"), @@ -96,8 +92,9 @@ public MultipleQueries indexName(String indexName) { /** * The Algolia index name. + * * @return indexName - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "products", @@ -123,8 +120,9 @@ public MultipleQueries query(String query) { /** * The text to search in the index. + * * @return query - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The text to search in the index.") @JsonProperty(JSON_PROPERTY_QUERY) @@ -145,12 +143,15 @@ public MultipleQueries type(TypeEnum type) { } /** - * Perform a search query with `default`, will search for facet values if `facet` is given. + * Perform a search query with `default`, will search for facet values if + * `facet` is given. + * * @return type - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Perform a search query with `default`, will search for facet values if `facet` is given." + value = "Perform a search query with `default`, will search for facet values if `facet` is" + + " given." ) @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -171,8 +172,9 @@ public MultipleQueries facet(String facet) { /** * The `facet` name. + * * @return facet - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The `facet` name.") @JsonProperty(JSON_PROPERTY_FACET) @@ -194,8 +196,9 @@ public MultipleQueries params(String params) { /** * A query string of search parameters. + * * @return params - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "A query string of search parameters.") @JsonProperty(JSON_PROPERTY_PARAMS) @@ -250,8 +253,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index 81d097801f..49ea4ee370 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -12,24 +12,18 @@ package com.algolia.model; -import com.algolia.model.MultipleQueries; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * MultipleQueriesObject - */ +/** MultipleQueriesObject */ @JsonPropertyOrder( { MultipleQueriesObject.JSON_PROPERTY_REQUESTS, @@ -42,9 +36,7 @@ public class MultipleQueriesObject { public static final String JSON_PROPERTY_REQUESTS = "requests"; private List requests = new ArrayList<>(); - /** - * Gets or Sets strategy - */ + /** Gets or Sets strategy */ public enum StrategyEnum { NONE("none"), @@ -92,8 +84,9 @@ public MultipleQueriesObject addRequestsItem(MultipleQueries requestsItem) { /** * Get requests + * * @return requests - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_REQUESTS) @@ -115,8 +108,9 @@ public MultipleQueriesObject strategy(StrategyEnum strategy) { /** * Get strategy + * * @return strategy - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_STRATEGY) @@ -162,8 +156,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index 5467bc41f0..6024d120ed 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -12,24 +12,16 @@ package com.algolia.model; -import com.algolia.model.SearchResponse; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * MultipleQueriesResponse - */ +/** MultipleQueriesResponse */ @JsonPropertyOrder({ MultipleQueriesResponse.JSON_PROPERTY_RESULTS }) @JsonTypeName("multipleQueriesResponse") public class MultipleQueriesResponse { @@ -52,8 +44,9 @@ public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { /** * Get results + * * @return results - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_RESULTS) @@ -95,8 +88,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index 40150b171f..862a60d1ca 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -17,28 +17,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** - * Operation - */ +/** Operation */ @JsonPropertyOrder( { Operation.JSON_PROPERTY_ACTION, Operation.JSON_PROPERTY_BODY } ) @JsonTypeName("operation") public class Operation { - /** - * type of operation. - */ + /** type of operation. */ public enum ActionEnum { ADDOBJECT("addObject"), @@ -94,8 +86,9 @@ public Operation action(ActionEnum action) { /** * type of operation. + * * @return action - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "type of operation.") @JsonProperty(JSON_PROPERTY_ACTION) @@ -125,8 +118,9 @@ public Operation putBodyItem(String key, Object bodyItem) { /** * arguments to the operation (depends on the type of the operation). + * * @return body - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "arguments to the operation (depends on the type of the operation)." @@ -180,8 +174,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index 756db512ea..d1212fd16f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -17,18 +17,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * OperationIndexObject - */ +/** OperationIndexObject */ @JsonPropertyOrder( { OperationIndexObject.JSON_PROPERTY_OPERATION, @@ -39,9 +34,7 @@ @JsonTypeName("operationIndexObject") public class OperationIndexObject { - /** - * Type of operation to perform (move or copy). - */ + /** Type of operation to perform (move or copy). */ public enum OperationEnum { MOVE("move"), @@ -80,9 +73,7 @@ public static OperationEnum fromValue(String value) { public static final String JSON_PROPERTY_DESTINATION = "destination"; private String destination; - /** - * Gets or Sets scope - */ + /** Gets or Sets scope */ public enum ScopeEnum { SETTINGS("settings"), @@ -127,8 +118,9 @@ public OperationIndexObject operation(OperationEnum operation) { /** * Type of operation to perform (move or copy). + * * @return operation - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -153,8 +145,9 @@ public OperationIndexObject destination(String destination) { /** * The Algolia index name. + * * @return destination - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "products", @@ -187,12 +180,15 @@ public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { } /** - * Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. + * Scope of the data to copy. When absent, a full copy is performed. When present, only the + * selected scopes are copied. + * * @return scope - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied." + value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the" + + " selected scopes are copied." ) @JsonProperty(JSON_PROPERTY_SCOPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -245,8 +241,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index 08dffba4ea..c6927afbd9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -12,22 +12,15 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; -import java.util.Arrays; import java.util.Objects; -/** - * OperationIndexResponse - */ +/** OperationIndexResponse */ @JsonPropertyOrder( { OperationIndexResponse.JSON_PROPERTY_TASK_I_D, @@ -50,8 +43,9 @@ public OperationIndexResponse taskID(Integer taskID) { /** * taskID of the indexing task to wait for. + * * @return taskID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") @JsonProperty(JSON_PROPERTY_TASK_I_D) @@ -73,8 +67,9 @@ public OperationIndexResponse updatedAt(OffsetDateTime updatedAt) { /** * Date of last update (ISO-8601 format). + * * @return updatedAt - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") @JsonProperty(JSON_PROPERTY_UPDATED_AT) @@ -123,8 +118,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index 39ab4c89d4..121c849621 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -12,25 +12,16 @@ package com.algolia.model; -import com.algolia.model.RankingInfoMatchedGeoLocation; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Objects; -/** - * RankingInfo - */ +/** RankingInfo */ @JsonPropertyOrder( { RankingInfo.JSON_PROPERTY_FILTERS, @@ -92,8 +83,9 @@ public RankingInfo filters(Integer filters) { /** * This field is reserved for advanced usage. + * * @return filters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "This field is reserved for advanced usage.") @JsonProperty(JSON_PROPERTY_FILTERS) @@ -115,8 +107,9 @@ public RankingInfo firstMatchedWord(Integer firstMatchedWord) { /** * Position of the most important matched attribute in the attributes to index list. + * * @return firstMatchedWord - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Position of the most important matched attribute in the attributes to index list." @@ -139,12 +132,15 @@ public RankingInfo geoDistance(Integer geoDistance) { } /** - * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + * Distance between the geo location in the search query and the best matching geo location in the + * record, divided by the geo precision (in meters). + * * @return geoDistance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters)." + value = "Distance between the geo location in the search query and the best matching geo location" + + " in the record, divided by the geo precision (in meters)." ) @JsonProperty(JSON_PROPERTY_GEO_DISTANCE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -165,8 +161,9 @@ public RankingInfo geoPrecision(Integer geoPrecision) { /** * Precision used when computing the geo distance, in meters. + * * @return geoPrecision - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Precision used when computing the geo distance, in meters." @@ -203,8 +200,9 @@ public RankingInfo putMatchedGeoLocationItem( /** * Get matchedGeoLocation + * * @return matchedGeoLocation - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MATCHED_GEO_LOCATION) @@ -228,8 +226,9 @@ public RankingInfo nbExactWords(Integer nbExactWords) { /** * Number of exactly matched words. + * * @return nbExactWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Number of exactly matched words.") @JsonProperty(JSON_PROPERTY_NB_EXACT_WORDS) @@ -251,8 +250,9 @@ public RankingInfo nbTypos(Integer nbTypos) { /** * Number of typos encountered when matching the record. + * * @return nbTypos - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Number of typos encountered when matching the record." @@ -276,8 +276,9 @@ public RankingInfo promoted(Boolean promoted) { /** * Present and set to true if a Rule promoted the hit. + * * @return promoted - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Present and set to true if a Rule promoted the hit." @@ -300,12 +301,15 @@ public RankingInfo proximityDistance(Integer proximityDistance) { } /** - * When the query contains more than one word, the sum of the distances between matched words (in meters). + * When the query contains more than one word, the sum of the distances between matched words (in + * meters). + * * @return proximityDistance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "When the query contains more than one word, the sum of the distances between matched words (in meters)." + value = "When the query contains more than one word, the sum of the distances between matched" + + " words (in meters)." ) @JsonProperty(JSON_PROPERTY_PROXIMITY_DISTANCE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -326,8 +330,9 @@ public RankingInfo userScore(Integer userScore) { /** * Custom ranking for the object, expressed as a single integer value. + * * @return userScore - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Custom ranking for the object, expressed as a single integer value." @@ -351,8 +356,9 @@ public RankingInfo word(Integer word) { /** * Number of matched words, including prefixes and typos. + * * @return word - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Number of matched words, including prefixes and typos." @@ -451,8 +457,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java index 41778441f8..637a09d04e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -12,21 +12,14 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * RankingInfoMatchedGeoLocation - */ +/** RankingInfoMatchedGeoLocation */ @JsonPropertyOrder( { RankingInfoMatchedGeoLocation.JSON_PROPERTY_LAT, @@ -53,8 +46,9 @@ public RankingInfoMatchedGeoLocation lat(Double lat) { /** * Latitude of the matched location. + * * @return lat - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Latitude of the matched location.") @JsonProperty(JSON_PROPERTY_LAT) @@ -76,8 +70,9 @@ public RankingInfoMatchedGeoLocation lng(Double lng) { /** * Longitude of the matched location. + * * @return lng - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Longitude of the matched location.") @JsonProperty(JSON_PROPERTY_LNG) @@ -99,8 +94,9 @@ public RankingInfoMatchedGeoLocation distance(Integer distance) { /** * Distance between the matched location and the search location (in meters). + * * @return distance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Distance between the matched location and the search location (in meters)." @@ -150,8 +146,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java index 87d8af79f4..f8e67c7e1c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -12,26 +12,16 @@ package com.algolia.model; -import com.algolia.model.HighlightResult; -import com.algolia.model.RankingInfo; -import com.algolia.model.SnippetResult; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.HashMap; -import java.util.Map; import java.util.Objects; -/** - * A single record. - */ +/** A single record. */ @ApiModel(description = "A single record.") @JsonPropertyOrder( { @@ -68,8 +58,9 @@ public Record objectID(String objectID) { /** * Unique identifier of the object. + * * @return objectID - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Unique identifier of the object.") @JsonProperty(JSON_PROPERTY_OBJECT_I_D) @@ -91,8 +82,9 @@ public Record highlightResult(HighlightResult highlightResult) { /** * Get highlightResult + * * @return highlightResult - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_HIGHLIGHT_RESULT) @@ -114,8 +106,9 @@ public Record snippetResult(SnippetResult snippetResult) { /** * Get snippetResult + * * @return snippetResult - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SNIPPET_RESULT) @@ -137,8 +130,9 @@ public Record rankingInfo(RankingInfo rankingInfo) { /** * Get rankingInfo + * * @return rankingInfo - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_RANKING_INFO) @@ -160,8 +154,9 @@ public Record distinctSeqID(Integer distinctSeqID) { /** * Get distinctSeqID + * * @return distinctSeqID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DISTINCT_SEQ_I_D) @@ -234,8 +229,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index 0df481b6d9..6c31c24f10 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -12,21 +12,14 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * SaveObjectResponse - */ +/** SaveObjectResponse */ @JsonPropertyOrder( { SaveObjectResponse.JSON_PROPERTY_CREATED_AT, @@ -53,8 +46,9 @@ public SaveObjectResponse createdAt(String createdAt) { /** * Get createdAt + * * @return createdAt - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CREATED_AT) @@ -76,8 +70,9 @@ public SaveObjectResponse taskID(Integer taskID) { /** * taskID of the indexing task to wait for. + * * @return taskID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") @JsonProperty(JSON_PROPERTY_TASK_I_D) @@ -99,8 +94,9 @@ public SaveObjectResponse objectID(String objectID) { /** * Unique identifier of the object. + * * @return objectID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Unique identifier of the object.") @JsonProperty(JSON_PROPERTY_OBJECT_I_D) @@ -151,8 +147,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index 701c2d9616..6a28d1f9e9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -12,24 +12,16 @@ package com.algolia.model; -import com.algolia.model.Record; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; -/** - * SearchHits - */ +/** SearchHits */ @JsonPropertyOrder({ SearchHits.JSON_PROPERTY_HITS }) @JsonTypeName("searchHits") public class SearchHits { @@ -52,8 +44,9 @@ public SearchHits addHitsItem(Record hitsItem) { /** * Get hits + * * @return hits - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_HITS) @@ -95,8 +88,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 6044a89441..fc0257dc09 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -12,31 +12,22 @@ package com.algolia.model; -import com.algolia.model.BaseSearchParams; -import com.algolia.model.IndexSettingsAsSearchParams; -import com.algolia.model.OneOfintegerstring; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.NoSuchElementException; import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; -import org.openapitools.jackson.nullable.JsonNullable; -/** - * SearchParams - */ +/** SearchParams */ @JsonPropertyOrder( { SearchParams.JSON_PROPERTY_QUERY, @@ -296,9 +287,7 @@ public class SearchParams { "minWordSizefor2Typos"; private Integer minWordSizefor2Typos = 8; - /** - * Controls whether typo tolerance is enabled and how it is applied. - */ + /** Controls whether typo tolerance is enabled and how it is applied. */ public enum TypoToleranceEnum { TRUE("true"), @@ -374,9 +363,7 @@ public static TypoToleranceEnum fromValue(String value) { "enablePersonalization"; private Boolean enablePersonalization = false; - /** - * Controls if and how query words are interpreted as prefixes. - */ + /** Controls if and how query words are interpreted as prefixes. */ public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -414,9 +401,7 @@ public static QueryTypeEnum fromValue(String value) { public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; - /** - * Selects a strategy to remove words from the query when it doesn’t match any hits. - */ + /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -468,9 +453,7 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { "disableExactOnAttributes"; private List disableExactOnAttributes = null; - /** - * Controls how the exact ranking criterion is computed when the query contains only one word. - */ + /** Controls how the exact ranking criterion is computed when the query contains only one word. */ public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -510,9 +493,7 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; - /** - * Gets or Sets alternativesAsExact - */ + /** Gets or Sets alternativesAsExact */ public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -551,9 +532,7 @@ public static AlternativesAsExactEnum fromValue(String value) { "alternativesAsExact"; private List alternativesAsExact = null; - /** - * Gets or Sets advancedSyntaxFeatures - */ + /** Gets or Sets advancedSyntaxFeatures */ public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -624,8 +603,9 @@ public SearchParams query(String query) { /** * The text to search in the index. + * * @return query - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") @JsonProperty(JSON_PROPERTY_QUERY) @@ -646,12 +626,15 @@ public SearchParams similarQuery(String similarQuery) { } /** - * Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results. + * Overrides the query parameter and performs a more generic search that can be used to find + * \"similar\" results. + * * @return similarQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Overrides the query parameter and performs a more generic search that can be used to find \"similar\" results." + value = "Overrides the query parameter and performs a more generic search that can be used to" + + " find \"similar\" results." ) @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -672,8 +655,9 @@ public SearchParams filters(String filters) { /** * Filter the query with numeric, facet and/or tag filters. + * * @return filters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." @@ -705,8 +689,9 @@ public SearchParams addFacetFiltersItem(String facetFiltersItem) { /** * Filter hits by facet value. + * * @return facetFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") @JsonProperty(JSON_PROPERTY_FACET_FILTERS) @@ -735,12 +720,15 @@ public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { } /** - * Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter. + * Create filters for ranking purposes, where records that match the filter are ranked higher, or + * lower in the case of a negative optional filter. + * * @return optionalFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter." + value = "Create filters for ranking purposes, where records that match the filter are ranked" + + " higher, or lower in the case of a negative optional filter." ) @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -769,8 +757,9 @@ public SearchParams addNumericFiltersItem(String numericFiltersItem) { /** * Filter on numeric attributes. + * * @return numericFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) @@ -800,8 +789,9 @@ public SearchParams addTagFiltersItem(String tagFiltersItem) { /** * Filter hits by tags. + * * @return tagFilters - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") @JsonProperty(JSON_PROPERTY_TAG_FILTERS) @@ -823,8 +813,9 @@ public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { /** * Determines how to calculate the total score for filtering. + * * @return sumOrFiltersScores - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Determines how to calculate the total score for filtering." @@ -856,8 +847,9 @@ public SearchParams addFacetsItem(String facetsItem) { /** * Retrieve facets and their facet values. + * * @return facets - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") @JsonProperty(JSON_PROPERTY_FACETS) @@ -879,8 +871,9 @@ public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { /** * Maximum number of facet values to return for each facet during a regular search. + * * @return maxValuesPerFacet - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." @@ -904,8 +897,9 @@ public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { /** * Force faceting to be applied after de-duplication (via the Distinct setting). + * * @return facetingAfterDistinct - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." @@ -929,8 +923,9 @@ public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { /** * Controls how facet values are fetched. + * * @return sortFacetValuesBy - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) @@ -952,8 +947,9 @@ public SearchParams page(Integer page) { /** * Specify the page to retrieve. + * * @return page - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") @JsonProperty(JSON_PROPERTY_PAGE) @@ -975,8 +971,9 @@ public SearchParams offset(Integer offset) { /** * Specify the offset of the first hit to return. + * * @return offset - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") @JsonProperty(JSON_PROPERTY_OFFSET) @@ -997,11 +994,10 @@ public SearchParams length(Integer length) { } /** - * Set the number of hits to retrieve (used only with offset). - * minimum: 1 - * maximum: 1000 + * Set the number of hits to retrieve (used only with offset). minimum: 1 maximum: 1000 + * * @return length - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." @@ -1025,11 +1021,13 @@ public SearchParams aroundLatLng(String aroundLatLng) { /** * Search for entries around a central geolocation, enabling a geo search within a circular area. + * * @return aroundLatLng - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Search for entries around a central geolocation, enabling a geo search within a circular area." + value = "Search for entries around a central geolocation, enabling a geo search within a circular" + + " area." ) @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1049,12 +1047,15 @@ public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { } /** - * Search for entries around a given location automatically computed from the requester’s IP address. + * Search for entries around a given location automatically computed from the requester’s IP + * address. + * * @return aroundLatLngViaIP - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Search for entries around a given location automatically computed from the requester’s IP address." + value = "Search for entries around a given location automatically computed from the requester’s" + + " IP address." ) @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1076,8 +1077,9 @@ public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { /** * Define the maximum radius for a geo search (in meters). + * * @return aroundRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." @@ -1111,11 +1113,13 @@ public SearchParams aroundPrecision(Integer aroundPrecision) { /** * Precision of geo search (in meters), to add grouping by geo location to the ranking formula. + * * @return aroundPrecision - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Precision of geo search (in meters), to add grouping by geo location to the ranking formula." + value = "Precision of geo search (in meters), to add grouping by geo location to the ranking" + + " formula." ) @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1135,10 +1139,10 @@ public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { } /** - * Minimum radius (in meters) used for a geo search when aroundRadius is not set. - * minimum: 1 + * Minimum radius (in meters) used for a geo search when aroundRadius is not set. minimum: 1 + * * @return minimumAroundRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." @@ -1172,8 +1176,9 @@ public SearchParams addInsideBoundingBoxItem( /** * Search inside a rectangular area (in geo coordinates). + * * @return insideBoundingBox - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." @@ -1205,8 +1210,9 @@ public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { /** * Search inside a polygon (in geo coordinates). + * * @return insidePolygon - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) @@ -1235,12 +1241,21 @@ public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { } /** - * This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * This parameter changes the default values of certain parameters and settings that work best for + * a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, + * analyticsTags and ruleContexts. These parameters and settings work well together when the query + * is formatted in natural language instead of keywords, for example when your user performs a + * voice search. + * * @return naturalLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search." + value = "This parameter changes the default values of certain parameters and settings that work" + + " best for a natural language query, such as ignorePlurals, removeStopWords," + + " removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and" + + " settings work well together when the query is formatted in natural language" + + " instead of keywords, for example when your user performs a voice search." ) @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1269,8 +1284,9 @@ public SearchParams addRuleContextsItem(String ruleContextsItem) { /** * Enables contextual rules. + * * @return ruleContexts - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) @@ -1292,8 +1308,9 @@ public SearchParams personalizationImpact(Integer personalizationImpact) { /** * Define the impact of the Personalization feature. + * * @return personalizationImpact - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) @@ -1315,8 +1332,9 @@ public SearchParams userToken(String userToken) { /** * Associates a certain user token with the current search. + * * @return userToken - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Associates a certain user token with the current search." @@ -1340,8 +1358,9 @@ public SearchParams getRankingInfo(Boolean getRankingInfo) { /** * Retrieve detailed ranking information. + * * @return getRankingInfo - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) @@ -1363,8 +1382,9 @@ public SearchParams clickAnalytics(Boolean clickAnalytics) { /** * Enable the Click Analytics feature. + * * @return clickAnalytics - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) @@ -1386,8 +1406,9 @@ public SearchParams analytics(Boolean analytics) { /** * Whether the current query will be taken into account in the Analytics. + * * @return analytics - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." @@ -1419,8 +1440,9 @@ public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { /** * List of tags to apply to the query for analytics purposes. + * * @return analyticsTags - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." @@ -1444,8 +1466,9 @@ public SearchParams percentileComputation(Boolean percentileComputation) { /** * Whether to include or exclude a query from the processing-time percentile computation. + * * @return percentileComputation - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." @@ -1469,8 +1492,9 @@ public SearchParams enableABTest(Boolean enableABTest) { /** * Whether this search should participate in running AB tests. + * * @return enableABTest - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether this search should participate in running AB tests." @@ -1494,8 +1518,9 @@ public SearchParams enableReRanking(Boolean enableReRanking) { /** * Whether this search should use AI Re-Ranking. + * * @return enableReRanking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) @@ -1527,8 +1552,9 @@ public SearchParams addSearchableAttributesItem( /** * The complete list of attributes used for searching. + * * @return searchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes used for searching." @@ -1564,8 +1590,9 @@ public SearchParams addAttributesForFacetingItem( /** * The complete list of attributes that will be used for faceting. + * * @return attributesForFaceting - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." @@ -1601,8 +1628,9 @@ public SearchParams addUnretrievableAttributesItem( /** * List of attributes that can’t be retrieved at query time. + * * @return unretrievableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." @@ -1636,8 +1664,9 @@ public SearchParams addAttributesToRetrieveItem( /** * This parameter controls which attributes to retrieve and which not to retrieve. + * * @return attributesToRetrieve - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." @@ -1673,8 +1702,9 @@ public SearchParams addRestrictSearchableAttributesItem( /** * Restricts a given query to look in only a subset of your searchable attributes. + * * @return restrictSearchableAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." @@ -1708,8 +1738,9 @@ public SearchParams addRankingItem(String rankingItem) { /** * Controls how Algolia should sort your results. + * * @return ranking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") @JsonProperty(JSON_PROPERTY_RANKING) @@ -1739,8 +1770,9 @@ public SearchParams addCustomRankingItem(String customRankingItem) { /** * Specifies the custom ranking criterion. + * * @return customRanking - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) @@ -1761,12 +1793,15 @@ public SearchParams relevancyStrictness(Integer relevancyStrictness) { } /** - * Controls the relevancy threshold below which less relevant results aren’t included in the results. + * Controls the relevancy threshold below which less relevant results aren’t included in the + * results. + * * @return relevancyStrictness - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls the relevancy threshold below which less relevant results aren’t included in the results." + value = "Controls the relevancy threshold below which less relevant results aren’t included in" + + " the results." ) @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1799,8 +1834,9 @@ public SearchParams addAttributesToHighlightItem( /** * List of attributes to highlight. + * * @return attributesToHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) @@ -1832,8 +1868,9 @@ public SearchParams addAttributesToSnippetItem( /** * List of attributes to snippet, with an optional maximum number of words to snippet. + * * @return attributesToSnippet - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." @@ -1857,11 +1894,13 @@ public SearchParams highlightPreTag(String highlightPreTag) { /** * The HTML string to insert before the highlighted parts in all highlight and snippet results. + * * @return highlightPreTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert before the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1882,11 +1921,13 @@ public SearchParams highlightPostTag(String highlightPostTag) { /** * The HTML string to insert after the highlighted parts in all highlight and snippet results. + * * @return highlightPostTag - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The HTML string to insert after the highlighted parts in all highlight and snippet results." + value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + + " results." ) @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -1907,8 +1948,9 @@ public SearchParams snippetEllipsisText(String snippetEllipsisText) { /** * String used as an ellipsis indicator when a snippet is truncated. + * * @return snippetEllipsisText - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." @@ -1934,8 +1976,9 @@ public SearchParams restrictHighlightAndSnippetArrays( /** * Restrict highlighting and snippeting to items that matched the query. + * * @return restrictHighlightAndSnippetArrays - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." @@ -1961,8 +2004,9 @@ public SearchParams hitsPerPage(Integer hitsPerPage) { /** * Set the number of hits per page. + * * @return hitsPerPage - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) @@ -1983,12 +2027,15 @@ public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { } /** - * Minimum number of characters a word in the query string must contain to accept matches with 1 typo. + * Minimum number of characters a word in the query string must contain to accept matches with 1 + * typo. + * * @return minWordSizefor1Typo - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 1 typo." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 1 typo." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2008,12 +2055,15 @@ public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { } /** - * Minimum number of characters a word in the query string must contain to accept matches with 2 typos. + * Minimum number of characters a word in the query string must contain to accept matches with 2 + * typos. + * * @return minWordSizefor2Typos - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Minimum number of characters a word in the query string must contain to accept matches with 2 typos." + value = "Minimum number of characters a word in the query string must contain to accept matches" + + " with 2 typos." ) @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2034,8 +2084,9 @@ public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { /** * Controls whether typo tolerance is enabled and how it is applied. + * * @return typoTolerance - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." @@ -2061,8 +2112,9 @@ public SearchParams allowTyposOnNumericTokens( /** * Whether to allow typos on numbers (“numeric tokens”) in the query string. + * * @return allowTyposOnNumericTokens - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." @@ -2100,8 +2152,9 @@ public SearchParams addDisableTypoToleranceOnAttributesItem( /** * List of attributes on which you want to disable typo tolerance. + * * @return disableTypoToleranceOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." @@ -2127,8 +2180,9 @@ public SearchParams separatorsToIndex(String separatorsToIndex) { /** * Control which separators are indexed. + * * @return separatorsToIndex - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) @@ -2150,8 +2204,9 @@ public SearchParams ignorePlurals(String ignorePlurals) { /** * Treats singular, plurals, and other forms of declensions as matching terms. + * * @return ignorePlurals - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." @@ -2175,8 +2230,9 @@ public SearchParams removeStopWords(String removeStopWords) { /** * Removes stop (common) words from the query before executing it. + * * @return removeStopWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." @@ -2202,8 +2258,9 @@ public SearchParams keepDiacriticsOnCharacters( /** * List of characters that the engine shouldn’t automatically normalize. + * * @return keepDiacriticsOnCharacters - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." @@ -2234,12 +2291,15 @@ public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { } /** - * Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection. + * Sets the languages to be used by language-specific settings and functionalities such as + * ignorePlurals, removeStopWords, and CJK word-detection. + * * @return queryLanguages - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection." + value = "Sets the languages to be used by language-specific settings and functionalities such as" + + " ignorePlurals, removeStopWords, and CJK word-detection." ) @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2260,8 +2320,9 @@ public SearchParams decompoundQuery(Boolean decompoundQuery) { /** * Splits compound words into their composing atoms in the query. + * * @return decompoundQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." @@ -2285,8 +2346,9 @@ public SearchParams enableRules(Boolean enableRules) { /** * Whether Rules should be globally enabled. + * * @return enableRules - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") @JsonProperty(JSON_PROPERTY_ENABLE_RULES) @@ -2308,8 +2370,9 @@ public SearchParams enablePersonalization(Boolean enablePersonalization) { /** * Enable the Personalization feature. + * * @return enablePersonalization - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) @@ -2331,8 +2394,9 @@ public SearchParams queryType(QueryTypeEnum queryType) { /** * Controls if and how query words are interpreted as prefixes. + * * @return queryType - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." @@ -2358,8 +2422,9 @@ public SearchParams removeWordsIfNoResults( /** * Selects a strategy to remove words from the query when it doesn’t match any hits. + * * @return removeWordsIfNoResults - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." @@ -2385,8 +2450,9 @@ public SearchParams advancedSyntax(Boolean advancedSyntax) { /** * Enables the advanced query syntax. + * * @return advancedSyntax - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) @@ -2416,8 +2482,9 @@ public SearchParams addOptionalWordsItem(String optionalWordsItem) { /** * A list of words that should be considered as optional when found in the query. + * * @return optionalWords - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." @@ -2453,8 +2520,9 @@ public SearchParams addDisableExactOnAttributesItem( /** * List of attributes on which you want to disable the exact ranking criterion. + * * @return disableExactOnAttributes - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." @@ -2482,11 +2550,13 @@ public SearchParams exactOnSingleWordQuery( /** * Controls how the exact ranking criterion is computed when the query contains only one word. + * * @return exactOnSingleWordQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Controls how the exact ranking criterion is computed when the query contains only one word." + value = "Controls how the exact ranking criterion is computed when the query contains only one" + + " word." ) @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2521,11 +2591,13 @@ public SearchParams addAlternativesAsExactItem( /** * List of alternatives that should be considered an exact match by the exact ranking criterion. + * * @return alternativesAsExact - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "List of alternatives that should be considered an exact match by the exact ranking criterion." + value = "List of alternatives that should be considered an exact match by the exact ranking" + + " criterion." ) @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2559,12 +2631,15 @@ public SearchParams addAdvancedSyntaxFeaturesItem( } /** - * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled. + * Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is + * enabled. + * * @return advancedSyntaxFeatures - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is enabled." + value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + + " enabled." ) @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2586,11 +2661,10 @@ public SearchParams distinct(Integer distinct) { } /** - * Enables de-duplication or grouping of results. - * minimum: 0 - * maximum: 4 + * Enables de-duplication or grouping of results. minimum: 0 maximum: 4 + * * @return distinct - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") @JsonProperty(JSON_PROPERTY_DISTINCT) @@ -2612,8 +2686,9 @@ public SearchParams synonyms(Boolean synonyms) { /** * Whether to take into account an index’s synonyms for a particular search. + * * @return synonyms - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." @@ -2638,12 +2713,15 @@ public SearchParams replaceSynonymsInHighlight( } /** - * Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + * Whether to highlight and snippet the original word that matches the synonym or the synonym + * itself. + * * @return replaceSynonymsInHighlight - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Whether to highlight and snippet the original word that matches the synonym or the synonym itself." + value = "Whether to highlight and snippet the original word that matches the synonym or the" + + " synonym itself." ) @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2665,11 +2743,10 @@ public SearchParams minProximity(Integer minProximity) { } /** - * Precision of the proximity ranking criterion. - * minimum: 1 - * maximum: 7 + * Precision of the proximity ranking criterion. minimum: 1 maximum: 7 + * * @return minProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) @@ -2698,12 +2775,15 @@ public SearchParams addResponseFieldsItem(String responseFieldsItem) { } /** - * Choose which fields to return in the API response. This parameters applies to search and browse queries. + * Choose which fields to return in the API response. This parameters applies to search and browse + * queries. + * * @return responseFields - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Choose which fields to return in the API response. This parameters applies to search and browse queries." + value = "Choose which fields to return in the API response. This parameters applies to search and" + + " browse queries." ) @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2724,8 +2804,9 @@ public SearchParams maxFacetHits(Integer maxFacetHits) { /** * Maximum number of facet hits to return during a search for facet values. + * * @return maxFacetHits - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." @@ -2751,12 +2832,15 @@ public SearchParams attributeCriteriaComputedByMinProximity( } /** - * When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage. + * When attribute is ranked above proximity in your ranking formula, proximity is used to select + * which searchable attribute is matched in the attribute ranking stage. + * * @return attributeCriteriaComputedByMinProximity - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "When attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage." + value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + + " select which searchable attribute is matched in the attribute ranking stage." ) @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -2779,12 +2863,15 @@ public SearchParams renderingContent(Object renderingContent) { } /** - * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * Content defining how the search interface should be rendered. Can be set via the settings for a + * default value and can be overridden via rules. + * * @return renderingContent - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules." + value = "Content defining how the search interface should be rendered. Can be set via the" + + " settings for a default value and can be overridden via rules." ) @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -3368,8 +3455,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java index 6627067d52..32fb03c62e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java @@ -12,21 +12,14 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * SearchParamsAsString - */ +/** SearchParamsAsString */ @JsonPropertyOrder({ SearchParamsAsString.JSON_PROPERTY_PARAMS }) @JsonTypeName("searchParamsAsString") public class SearchParamsAsString { @@ -41,8 +34,9 @@ public SearchParamsAsString params(String params) { /** * Get params + * * @return params - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PARAMS) @@ -84,8 +78,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index 1c5b37b671..d3007a3dfe 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -12,29 +12,18 @@ package com.algolia.model; -import com.algolia.model.BaseSearchResponse; -import com.algolia.model.BaseSearchResponseFacetsStats; -import com.algolia.model.Record; -import com.algolia.model.SearchHits; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -/** - * SearchResponse - */ +/** SearchResponse */ @JsonPropertyOrder( { SearchResponse.JSON_PROPERTY_AB_TEST_I_D, @@ -153,12 +142,15 @@ public SearchResponse abTestID(Integer abTestID) { } /** - * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID. + * If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test + * ID. + * * @return abTestID - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID." + value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing" + + " A/B test ID." ) @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -178,12 +170,15 @@ public SearchResponse abTestVariantID(Integer abTestVariantID) { } /** - * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used. + * If a search encounters an index that is being A/B tested, abTestVariantID reports the variant + * ID of the index used. + * * @return abTestVariantID - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used." + value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the" + + " variant ID of the index used." ) @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -204,8 +199,9 @@ public SearchResponse aroundLatLng(String aroundLatLng) { /** * The computed geo location. + * * @return aroundLatLng - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) @@ -226,12 +222,15 @@ public SearchResponse automaticRadius(String automaticRadius) { } /** - * The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. + * The automatically computed radius. For legacy reasons, this parameter is a string and not an + * integer. + * * @return automaticRadius - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "The automatically computed radius. For legacy reasons, this parameter is a string and not an integer." + value = "The automatically computed radius. For legacy reasons, this parameter is a string and" + + " not an integer." ) @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -252,8 +251,9 @@ public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { /** * Whether the facet count is exhaustive or approximate. + * * @return exhaustiveFacetsCount - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." @@ -277,8 +277,9 @@ public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { /** * Indicate if the nbHits count was exhaustive or approximate + * * @return exhaustiveNbHits - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, @@ -302,13 +303,16 @@ public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { } /** - * Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + * Indicate if the typo-tolerence search was exhaustive or approximate (only included when + * typo-tolerance is enabled) + * * @return exhaustiveTypo - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( required = true, - value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled)" + value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when" + + " typo-tolerance is enabled)" ) @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) @JsonInclude(value = JsonInclude.Include.ALWAYS) @@ -340,8 +344,9 @@ public SearchResponse putFacetsItem( /** * A mapping of each facet name to the corresponding facet counts. + * * @return facets - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "{\"category\":{\"food\":1,\"tech\":42}}", @@ -379,8 +384,9 @@ public SearchResponse putFacetsStatsItem( /** * Statistics for numerical facets. + * * @return facetsStats - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") @JsonProperty(JSON_PROPERTY_FACETS_STATS) @@ -404,8 +410,9 @@ public SearchResponse hitsPerPage(Integer hitsPerPage) { /** * Set the number of hits per page. + * * @return hitsPerPage - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) @@ -427,8 +434,9 @@ public SearchResponse index(String index) { /** * Index name used for the query. + * * @return index - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "indexName", @@ -452,13 +460,16 @@ public SearchResponse indexUsed(String indexUsed) { } /** - * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query. + * Index name used for the query. In the case of an A/B test, the targeted index isn’t always the + * index used by the query. + * * @return indexUsed - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "indexNameAlt", - value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t always the index used by the query." + value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t" + + " always the index used by the query." ) @JsonProperty(JSON_PROPERTY_INDEX_USED) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -479,8 +490,9 @@ public SearchResponse message(String message) { /** * Used to return warnings about the query. + * * @return message - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") @JsonProperty(JSON_PROPERTY_MESSAGE) @@ -502,8 +514,9 @@ public SearchResponse nbHits(Integer nbHits) { /** * Number of hits that the search query matched + * * @return nbHits - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "20", @@ -529,8 +542,9 @@ public SearchResponse nbPages(Integer nbPages) { /** * Number of pages available for the current query + * * @return nbPages - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "1", @@ -556,8 +570,9 @@ public SearchResponse nbSortedHits(Integer nbSortedHits) { /** * The number of hits selected and sorted by the relevant sort algorithm + * * @return nbSortedHits - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "20", @@ -582,8 +597,9 @@ public SearchResponse page(Integer page) { /** * Specify the page to retrieve. + * * @return page - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") @JsonProperty(JSON_PROPERTY_PAGE) @@ -605,8 +621,9 @@ public SearchResponse params(String params) { /** * A url-encoded string of all search parameters. + * * @return params - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "query=a&hitsPerPage=20", @@ -632,8 +649,9 @@ public SearchResponse parsedQuery(String parsedQuery) { /** * The query string that will be searched, after normalization. + * * @return parsedQuery - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "The query string that will be searched, after normalization." @@ -657,8 +675,9 @@ public SearchResponse processingTimeMS(Integer processingTimeMS) { /** * Time the server took to process the request, in milliseconds. + * * @return processingTimeMS - **/ + */ @javax.annotation.Nonnull @ApiModelProperty( example = "20", @@ -684,8 +703,9 @@ public SearchResponse query(String query) { /** * The text to search in the index. + * * @return query - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") @JsonProperty(JSON_PROPERTY_QUERY) @@ -706,12 +726,15 @@ public SearchResponse queryAfterRemoval(String queryAfterRemoval) { } /** - * A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set. + * A markup text indicating which parts of the original query have been removed in order to + * retrieve a non-empty result set. + * * @return queryAfterRemoval - **/ + */ @javax.annotation.Nullable @ApiModelProperty( - value = "A markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set." + value = "A markup text indicating which parts of the original query have been removed in order to" + + " retrieve a non-empty result set." ) @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -732,8 +755,9 @@ public SearchResponse serverUsed(String serverUsed) { /** * Actual host name of the server that processed the request. + * * @return serverUsed - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Actual host name of the server that processed the request." @@ -765,8 +789,9 @@ public SearchResponse putUserDataItem(String key, Object userDataItem) { /** * Lets you store custom data in your indices. + * * @return userData - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") @JsonProperty(JSON_PROPERTY_USER_DATA) @@ -799,8 +824,9 @@ public SearchResponse addHitsItem(Record hitsItem) { /** * Get hits + * * @return hits - **/ + */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_HITS) @@ -966,8 +992,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 89a0937554..822c1e1d56 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -12,22 +12,15 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; -import java.util.Arrays; import java.util.Objects; -/** - * SetSettingsResponse - */ +/** SetSettingsResponse */ @JsonPropertyOrder( { SetSettingsResponse.JSON_PROPERTY_TASK_I_D, @@ -50,8 +43,9 @@ public SetSettingsResponse taskID(Integer taskID) { /** * taskID of the indexing task to wait for. + * * @return taskID - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") @JsonProperty(JSON_PROPERTY_TASK_I_D) @@ -73,8 +67,9 @@ public SetSettingsResponse updatedAt(OffsetDateTime updatedAt) { /** * Date of last update (ISO-8601 format). + * * @return updatedAt - **/ + */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") @JsonProperty(JSON_PROPERTY_UPDATED_AT) @@ -123,8 +118,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java index 179b21b74b..796d1ab3f0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -17,16 +17,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Arrays; import java.util.Objects; -/** - * SnippetResult - */ +/** SnippetResult */ @JsonPropertyOrder( { SnippetResult.JSON_PROPERTY_VALUE, SnippetResult.JSON_PROPERTY_MATCH_LEVEL } ) @@ -36,9 +31,7 @@ public class SnippetResult { public static final String JSON_PROPERTY_VALUE = "value"; private String value; - /** - * Indicates how well the attribute matched the search query. - */ + /** Indicates how well the attribute matched the search query. */ public enum MatchLevelEnum { NONE("none"), @@ -83,8 +76,9 @@ public SnippetResult value(String value) { /** * Markup text with occurrences highlighted. + * * @return value - **/ + */ @javax.annotation.Nullable @ApiModelProperty( example = "George Clooney...", @@ -109,8 +103,9 @@ public SnippetResult matchLevel(MatchLevelEnum matchLevel) { /** * Indicates how well the attribute matched the search query. + * * @return matchLevel - **/ + */ @javax.annotation.Nullable @ApiModelProperty( value = "Indicates how well the attribute matched the search query." @@ -161,8 +156,7 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). + * 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) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 59c385ad87..8bedb140d4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -6,12 +6,10 @@ import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; import com.algolia.model.DeleteIndexResponse; -import com.algolia.model.ErrorBase; import com.algolia.model.IndexSettings; import com.algolia.model.ListIndicesResponse; import com.algolia.model.MultipleQueriesObject; import com.algolia.model.MultipleQueriesResponse; -import com.algolia.model.OneOfsearchParamsAsStringsearchParams; import com.algolia.model.OperationIndexObject; import com.algolia.model.OperationIndexResponse; import com.algolia.model.SaveObjectResponse; @@ -19,21 +17,19 @@ import com.algolia.model.SetSettingsResponse; import com.algolia.model.UNKNOWN_BASE_TYPE; import feign.*; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:22:27.248809+01:00[Europe/Paris]" + date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" ) public interface SearchApi extends ApiClient.Api { /** - * * Performs multiple write operations in a single API call. + * * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) + * @param batchObject (required) * @return BatchResponse */ @RequestLine("POST /1/indexes/{indexName}/batch") @@ -44,11 +40,11 @@ BatchResponse batch( ); /** + * Similar to batch but it also returns the http response headers . Performs multiple + * write operations in a single API call. * - * Similar to batch but it also returns the http response headers . - * Performs multiple write operations in a single API call. * @param indexName The index in which to perform the request. (required) - * @param batchObject (required) + * @param batchObject (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine("POST /1/indexes/{indexName}/batch") @@ -59,8 +55,8 @@ ApiResponse batchWithHttpInfo( ); /** - * Delete index. - * Delete an existing index. + * Delete index. Delete an existing index. + * * @param indexName The index in which to perform the request. (required) * @return DeleteIndexResponse */ @@ -69,9 +65,9 @@ ApiResponse batchWithHttpInfo( DeleteIndexResponse deleteIndex(@Param("indexName") String indexName); /** - * Delete index. - * Similar to deleteIndex but it also returns the http response headers . - * Delete an existing index. + * Delete index. Similar to deleteIndex but it also returns the http response headers + * . Delete an existing index. + * * @param indexName The index in which to perform the request. (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @@ -82,8 +78,8 @@ ApiResponse deleteIndexWithHttpInfo( ); /** - * * Retrieve settings of a given indexName. + * * @param indexName The index in which to perform the request. (required) * @return IndexSettings */ @@ -92,9 +88,9 @@ ApiResponse deleteIndexWithHttpInfo( IndexSettings getSettings(@Param("indexName") String indexName); /** + * Similar to getSettings but it also returns the http response headers . Retrieve + * settings of a given indexName. * - * Similar to getSettings but it also returns the http response headers . - * Retrieve settings of a given indexName. * @param indexName The index in which to perform the request. (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @@ -105,9 +101,11 @@ ApiResponse getSettingsWithHttpInfo( ); /** - * List existing indexes. - * List existing indexes from an application. - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * List existing indexes. List existing indexes from an application. + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) * @return ListIndicesResponse */ @RequestLine("GET /1/indexes?Page={page}") @@ -115,10 +113,12 @@ ApiResponse getSettingsWithHttpInfo( ListIndicesResponse listIndices(@Param("page") Integer page); /** - * List existing indexes. - * Similar to listIndices but it also returns the http response headers . - * List existing indexes from an application. - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * List existing indexes. Similar to listIndices but it also returns the http + * response headers . List existing indexes from an application. + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine("GET /1/indexes?Page={page}") @@ -128,18 +128,20 @@ ApiResponse listIndicesWithHttpInfo( ); /** - * List existing indexes. - * List existing indexes from an application. - * Note, this is equivalent to the other listIndices method, - * but with the query parameters collected into a single Map parameter. This - * is convenient for services with optional query parameters, especially when - * used with the {@link ListIndicesQueryParams} class that allows for - * building up this map in a fluent style. + * List existing indexes. List existing indexes from an application. Note, this is equivalent to + * the other listIndices method, but with the query parameters collected into a + * single Map parameter. This is convenient for services with optional query parameters, + * especially when used with the {@link ListIndicesQueryParams} class that allows for building up + * this map in a fluent style. + * * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional)
  • - *
+ *

The following elements may be specified in the query map: + *

    + *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; + * the page size is implicitly set to 100. When null, will retrieve all indices (no + * pagination). (optional) + *
+ * * @return ListIndicesResponse */ @RequestLine("GET /1/indexes?Page={page}") @@ -149,15 +151,18 @@ ListIndicesResponse listIndices( ); /** - * List existing indexes. - * List existing indexes from an application. - * Note, this is equivalent to the other listIndices that receives the query parameters as a map, - * but this one also exposes the Http response headers + * List existing indexes. List existing indexes from an application. Note, this is equivalent to + * the other listIndices that receives the query parameters as a map, but this one + * also exposes the Http response headers + * * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional)
  • - *
+ *

The following elements may be specified in the query map: + *

    + *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; + * the page size is implicitly set to 100. When null, will retrieve all indices (no + * pagination). (optional) + *
+ * * @return ListIndicesResponse */ @RequestLine("GET /1/indexes?Page={page}") @@ -167,8 +172,8 @@ ApiResponse listIndicesWithHttpInfo( ); /** - * A convenience class for generating query parameters for the - * listIndices method in a fluent style. + * A convenience class for generating query parameters for the listIndices method in + * a fluent style. */ public static class ListIndicesQueryParams extends HashMap { @@ -179,9 +184,9 @@ public ListIndicesQueryParams page(final Integer value) { } /** - * * Get search results for the given requests. - * @param multipleQueriesObject (required) + * + * @param multipleQueriesObject (required) * @return MultipleQueriesResponse */ @RequestLine("POST /1/indexes/*/queries") @@ -191,10 +196,10 @@ MultipleQueriesResponse multipleQueries( ); /** + * Similar to multipleQueries but it also returns the http response headers . Get + * search results for the given requests. * - * Similar to multipleQueries but it also returns the http response headers . - * Get search results for the given requests. - * @param multipleQueriesObject (required) + * @param multipleQueriesObject (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine("POST /1/indexes/*/queries") @@ -204,10 +209,10 @@ ApiResponse multipleQueriesWithHttpInfo( ); /** - * Copy/move index. - * Peforms a copy or a move operation on a index. + * Copy/move index. Peforms a copy or a move operation on a index. + * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) + * @param operationIndexObject (required) * @return OperationIndexResponse */ @RequestLine("POST /1/indexes/{indexName}/operation") @@ -218,11 +223,11 @@ OperationIndexResponse operationIndex( ); /** - * Copy/move index. - * Similar to operationIndex but it also returns the http response headers . - * Peforms a copy or a move operation on a index. + * Copy/move index. Similar to operationIndex but it also returns the http response + * headers . Peforms a copy or a move operation on a index. + * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) + * @param operationIndexObject (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine("POST /1/indexes/{indexName}/operation") @@ -233,8 +238,8 @@ ApiResponse operationIndexWithHttpInfo( ); /** - * * Add an object to the index, automatically assigning it an object ID. + * * @param indexName The index in which to perform the request. (required) * @param requestBody The Algolia object. (required) * @return SaveObjectResponse @@ -247,9 +252,9 @@ SaveObjectResponse saveObject( ); /** + * Similar to saveObject but it also returns the http response headers . Add an + * object to the index, automatically assigning it an object ID. * - * Similar to saveObject but it also returns the http response headers . - * Add an object to the index, automatically assigning it an object ID. * @param indexName The index in which to perform the request. (required) * @param requestBody The Algolia object. (required) * @return A ApiResponse that wraps the response boyd and the http headers. @@ -262,10 +267,10 @@ ApiResponse saveObjectWithHttpInfo( ); /** - * * Get search results. + * * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) + * @param UNKNOWN_BASE_TYPE (required) * @return SearchResponse */ @RequestLine("POST /1/indexes/{indexName}/query") @@ -276,11 +281,11 @@ SearchResponse search( ); /** + * Similar to search but it also returns the http response headers . Get search + * results. * - * Similar to search but it also returns the http response headers . - * Get search results. * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) + * @param UNKNOWN_BASE_TYPE (required) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine("POST /1/indexes/{indexName}/query") @@ -291,11 +296,13 @@ ApiResponse searchWithHttpInfo( ); /** + * Update settings of a given indexName. Only specified settings are overridden; unspecified + * settings are left unchanged. Specifying null for a setting resets it to its default value. * - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @return SetSettingsResponse */ @RequestLine( @@ -309,12 +316,14 @@ SetSettingsResponse setSettings( ); /** + * Similar to setSettings but it also returns the http response headers . Update + * settings of a given indexName. Only specified settings are overridden; unspecified settings are + * left unchanged. Specifying null for a setting resets it to its default value. * - * Similar to setSettings but it also returns the http response headers . - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @return A ApiResponse that wraps the response boyd and the http headers. */ @RequestLine( @@ -328,20 +337,22 @@ ApiResponse setSettingsWithHttpInfo( ); /** + * Update settings of a given indexName. Only specified settings are overridden; unspecified + * settings are left unchanged. Specifying null for a setting resets it to its default value. + * Note, this is equivalent to the other setSettings method, but with the query + * parameters collected into a single Map parameter. This is convenient for services with optional + * query parameters, especially when used with the {@link SetSettingsQueryParams} class that + * allows for building up this map in a fluent style. * - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * Note, this is equivalent to the other setSettings method, - * but with the query parameters collected into a single Map parameter. This - * is convenient for services with optional query parameters, especially when - * used with the {@link SetSettingsQueryParams} class that allows for - * building up this map in a fluent style. * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) + * @param indexSettings (required) * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. (optional)
  • - *
+ *

The following elements may be specified in the query map: + *

    + *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given + * indexName. (optional) + *
+ * * @return SetSettingsResponse */ @RequestLine( @@ -355,17 +366,20 @@ SetSettingsResponse setSettings( ); /** + * Update settings of a given indexName. Only specified settings are overridden; unspecified + * settings are left unchanged. Specifying null for a setting resets it to its default value. + * Note, this is equivalent to the other setSettings that receives the query + * parameters as a map, but this one also exposes the Http response headers * - * Update settings of a given indexName. Only specified settings are overridden; unspecified settings are left unchanged. Specifying null for a setting resets it to its default value. - * Note, this is equivalent to the other setSettings that receives the query parameters as a map, - * but this one also exposes the Http response headers * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) + * @param indexSettings (required) * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. (optional)
  • - *
+ *

The following elements may be specified in the query map: + *

    + *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given + * indexName. (optional) + *
+ * * @return SetSettingsResponse */ @RequestLine( @@ -379,8 +393,8 @@ ApiResponse setSettingsWithHttpInfo( ); /** - * A convenience class for generating query parameters for the - * setSettings method in a fluent style. + * A convenience class for generating query parameters for the setSettings method in + * a fluent style. */ public static class SetSettingsQueryParams extends HashMap { diff --git a/scripts/post-gen-java.sh b/scripts/post-gen-java.sh index b74897b482..a8b8f0073d 100644 --- a/scripts/post-gen-java.sh +++ b/scripts/post-gen-java.sh @@ -1,7 +1,16 @@ CLIENT_FOLDER=$1 + find $CLIENT_FOLDER -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT_FOLDER/algoliasearch-core/com/algolia/model/OneOfintegerstring.java -prettier --write $CLIENT_FOLDER/**/*.java +# Download the formatter if not present +javaFormatter="google-java-format-1.13.0-all-deps.jar" +if [[ ! -f "dist/$javaFormatter" ]]; then + mkdir dist + curl -L "https://github.com/google/google-java-format/releases/download/v1.13.0/$javaFormatter" > dist/$javaFormatter +fi +find $CLIENT_FOLDER -type f -name "*.java" | xargs java -jar dist/$javaFormatter -r + +yarn prettier --write $CLIENT_FOLDER/**/*.java From 6ca893da39811259e4536b6f182790440c31f66f Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 10:07:23 +0100 Subject: [PATCH 14/19] pre-gen script --- .../.openapi-generator-ignore | 4 + clients/algoliasearch-client-java-2/README.md | 181 +- .../com/algolia/ApiCallback.java | 67 + .../com/algolia/ApiClient.java | 1328 +++++++++++-- .../com/algolia/ApiException.java | 119 ++ .../com/algolia/{model => }/ApiResponse.java | 19 +- .../com/algolia/ApiResponseDecoder.java | 38 - .../com/algolia/Configuration.java | 42 + .../com/algolia/EncodingUtils.java | 83 - .../com/algolia/GzipRequestInterceptor.java | 92 + .../algoliasearch-core/com/algolia/JSON.java | 404 ++++ .../algoliasearch-core/com/algolia/Pair.java | 60 + .../com/algolia/ParamExpander.java | 19 - .../com/algolia/ProgressRequestBody.java | 73 + .../com/algolia/ProgressResponseBody.java | 71 + .../com/algolia/RFC3339DateFormat.java | 59 - .../com/algolia/auth/ApiKeyAuth.java | 53 +- .../com/algolia/auth/Authentication.java | 32 + .../com/algolia/auth/DefaultApi20Impl.java | 53 - .../com/algolia/auth/HttpBasicAuth.java | 46 +- .../com/algolia/auth/HttpBearerAuth.java | 36 +- .../com/algolia/model/BaseIndexSettings.java | 130 +- .../com/algolia/model/BaseSearchParams.java | 332 ++-- .../com/algolia/model/BaseSearchResponse.java | 233 +-- .../model/BaseSearchResponseFacetsStats.java | 46 +- .../com/algolia/model/BatchObject.java | 15 +- .../com/algolia/model/BatchResponse.java | 28 +- .../algolia/model/DeleteIndexResponse.java | 28 +- .../com/algolia/model/ErrorBase.java | 15 +- .../com/algolia/model/HighlightResult.java | 74 +- .../com/algolia/model/Index.java | 110 +- .../com/algolia/model/IndexSettings.java | 663 +++---- .../model/IndexSettingsAsSearchParams.java | 543 +++--- .../algolia/model/ListIndicesResponse.java | 28 +- .../com/algolia/model/MultipleQueries.java | 82 +- .../algolia/model/MultipleQueriesObject.java | 55 +- .../model/MultipleQueriesResponse.java | 15 +- .../com/algolia/model/Operation.java | 58 +- .../algolia/model/OperationIndexObject.java | 85 +- .../algolia/model/OperationIndexResponse.java | 28 +- .../com/algolia/model/RankingInfo.java | 109 +- .../model/RankingInfoMatchedGeoLocation.java | 37 +- .../com/algolia/model/Record.java | 56 +- .../com/algolia/model/SaveObjectResponse.java | 37 +- .../com/algolia/model/SearchHits.java | 15 +- .../com/algolia/model/SearchParams.java | 865 ++++----- .../algolia/model/SearchParamsAsString.java | 15 +- .../com/algolia/model/SearchResponse.java | 242 +-- .../algolia/model/SetSettingsResponse.java | 28 +- .../com/algolia/model/SnippetResult.java | 53 +- .../com/algolia/search/SearchApi.java | 1717 ++++++++++++++--- clients/algoliasearch-client-java-2/pom.xml | 164 +- openapitools.json | 3 +- scripts/multiplexer.sh | 2 +- scripts/post-gen-java.sh | 16 - scripts/post-gen/java.sh | 20 + scripts/pre-gen/java.sh | 6 + templates/java/api.mustache | 121 -- .../java/libraries/feign/ApiClient.mustache | 354 ---- .../feign/ApiResponseDecoder.mustache | 38 - .../libraries/feign/EncodingUtils.mustache | 86 - .../libraries/feign/ParamExpander.mustache | 22 - .../java/libraries/feign/README.mustache | 77 - templates/java/libraries/feign/api.mustache | 190 -- .../java/libraries/feign/api_test.mustache | 70 - .../feign/auth/ApiErrorDecoder.mustache | 25 - .../libraries/feign/auth/ApiKeyAuth.mustache | 43 - .../feign/auth/DefaultApi20Impl.mustache | 47 - .../feign/auth/HttpBasicAuth.mustache | 41 - .../feign/auth/HttpBearerAuth.mustache | 43 - .../java/libraries/feign/auth/OAuth.mustache | 92 - .../auth/OauthClientCredentialsGrant.mustache | 39 - .../feign/auth/OauthPasswordGrant.mustache | 48 - .../libraries/feign/build.gradle.mustache | 152 -- .../java/libraries/feign/build.sbt.mustache | 34 - .../java/libraries/feign/model_test.mustache | 48 - .../okhttp-gson/ApiCallback.mustache | 51 + .../libraries/okhttp-gson/ApiClient.mustache | 1176 +++++++++++ .../ApiResponse.mustache | 31 +- .../GzipRequestInterceptor.mustache | 74 + .../okhttp-gson/ProgressRequestBody.mustache | 62 + .../okhttp-gson/ProgressResponseBody.mustache | 59 + .../libraries/okhttp-gson/README.mustache | 176 ++ .../java/libraries/okhttp-gson/api.mustache | 467 +++++ .../okhttp-gson/apiException.mustache | 96 + .../{feign => okhttp-gson}/pom.mustache | 206 +- 86 files changed, 7823 insertions(+), 4977 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/{model => }/ApiResponse.java (69%) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java delete mode 100644 scripts/post-gen-java.sh create mode 100755 scripts/post-gen/java.sh create mode 100755 scripts/pre-gen/java.sh delete mode 100644 templates/java/api.mustache delete mode 100644 templates/java/libraries/feign/ApiClient.mustache delete mode 100644 templates/java/libraries/feign/ApiResponseDecoder.mustache delete mode 100644 templates/java/libraries/feign/EncodingUtils.mustache delete mode 100644 templates/java/libraries/feign/ParamExpander.mustache delete mode 100644 templates/java/libraries/feign/README.mustache delete mode 100644 templates/java/libraries/feign/api.mustache delete mode 100644 templates/java/libraries/feign/api_test.mustache delete mode 100644 templates/java/libraries/feign/auth/ApiErrorDecoder.mustache delete mode 100644 templates/java/libraries/feign/auth/ApiKeyAuth.mustache delete mode 100644 templates/java/libraries/feign/auth/DefaultApi20Impl.mustache delete mode 100644 templates/java/libraries/feign/auth/HttpBasicAuth.mustache delete mode 100644 templates/java/libraries/feign/auth/HttpBearerAuth.mustache delete mode 100644 templates/java/libraries/feign/auth/OAuth.mustache delete mode 100644 templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache delete mode 100644 templates/java/libraries/feign/auth/OauthPasswordGrant.mustache delete mode 100644 templates/java/libraries/feign/build.gradle.mustache delete mode 100644 templates/java/libraries/feign/build.sbt.mustache delete mode 100644 templates/java/libraries/feign/model_test.mustache create mode 100644 templates/java/libraries/okhttp-gson/ApiCallback.mustache create mode 100644 templates/java/libraries/okhttp-gson/ApiClient.mustache rename templates/java/libraries/{feign/model => okhttp-gson}/ApiResponse.mustache (52%) create mode 100644 templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache create mode 100644 templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache create mode 100644 templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache create mode 100644 templates/java/libraries/okhttp-gson/README.mustache create mode 100644 templates/java/libraries/okhttp-gson/api.mustache create mode 100644 templates/java/libraries/okhttp-gson/apiException.mustache rename templates/java/libraries/{feign => okhttp-gson}/pom.mustache (61%) diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore index f92cf6021b..ba2a273275 100644 --- a/clients/algoliasearch-client-java-2/.openapi-generator-ignore +++ b/clients/algoliasearch-client-java-2/.openapi-generator-ignore @@ -15,3 +15,7 @@ build.sbt git_push.sh gradle* settings.gradle + +# Selective source file +algoliasearch-core/com/algolia/auth/** +algoliasearch-core/com/algolia/Configuration.java diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 70574a571a..612f62a6bf 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -1,72 +1,185 @@ # algoliasearch-client-java-2 +Search API +- API version: 0.1.0 + - Build date: 2021-12-14T10:06:19.720908+01:00[Europe/Paris] + +API powering the Search feature of Algolia. + + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + ## Requirements -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. +Building the API client library requires: +1. Java 1.8+ +2. Maven/Gradle -## Installation & Usage +## Installation To install the API client library to your local Maven repository, simply execute: ```shell -mvn install +mvn clean install ``` To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: ```shell -mvn deploy +mvn clean deploy ``` -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: +Add this dependency to your project's POM: ```xml - com.algolia - algoliasearch-client-java-2 - 0.1.0 - compile + com.algolia + algoliasearch-client-java-2 + 0.1.0 + compile +``` + +### Gradle users +Add this dependency to your project's build file: + +```groovy +compile "com.algolia:algoliasearch-client-java-2:0.1.0" ``` -And to use the api you can follow the examples bellow: +### Others -```java +At first generate the JAR by executing: - //Set bearer token manually - ApiClient apiClient = new ApiClient("petstore_auth_client"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setAccessToken("TOKEN", 10000); +```shell +mvn clean package +``` - //Use api key - ApiClient apiClient = new ApiClient("api_key", "API KEY"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); +Then manually install the following JARs: - //Use http basic authentication - ApiClient apiClient = new ApiClient("basicAuth"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setCredentials("username", "password"); +* `target/algoliasearch-client-java-2-0.1.0.jar` +* `target/lib/*.jar` - //Oauth password - ApiClient apiClient = new ApiClient("oauth_password"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); +## Getting Started - //Oauth client credentials flow - ApiClient apiClient = new ApiClient("oauth_client_credentials"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setClientCredentials("client_id", "client_secret"); +Please follow the [installation](#installation) instruction and execute the following Java code: - PetApi petApi = apiClient.buildClient(PetApi.class); - Pet petById = petApi.getPetById(12345L); +```java - System.out.println(petById); +// Import classes: +import com.algolia.ApiClient; +import com.algolia.ApiException; +import com.algolia.Configuration; +import com.algolia.auth.*; +import com.algolia.models.*; +import com.algolia.search.SearchApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure API key authorization: apiKey + ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); + apiKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //apiKey.setApiKeyPrefix("Token"); + + // Configure API key authorization: appId + ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); + appId.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //appId.setApiKeyPrefix("Token"); + + SearchApi apiInstance = new SearchApi(defaultClient); + String indexName = "myIndexName"; // String | The index in which to perform the request. + BatchObject batchObject = new BatchObject(); // BatchObject | + try { + BatchResponse result = apiInstance.batch(indexName, batchObject); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling SearchApi#batch"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } } +} + ``` +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*SearchApi* | [**batch**](docs/SearchApi.md#batch) | **POST** /1/indexes/{indexName}/batch | +*SearchApi* | [**deleteIndex**](docs/SearchApi.md#deleteIndex) | **DELETE** /1/indexes/{indexName} | Delete index. +*SearchApi* | [**getSettings**](docs/SearchApi.md#getSettings) | **GET** /1/indexes/{indexName}/settings | +*SearchApi* | [**listIndices**](docs/SearchApi.md#listIndices) | **GET** /1/indexes | List existing indexes. +*SearchApi* | [**multipleQueries**](docs/SearchApi.md#multipleQueries) | **POST** /1/indexes/*/queries | +*SearchApi* | [**operationIndex**](docs/SearchApi.md#operationIndex) | **POST** /1/indexes/{indexName}/operation | Copy/move index. +*SearchApi* | [**saveObject**](docs/SearchApi.md#saveObject) | **POST** /1/indexes/{indexName} | +*SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /1/indexes/{indexName}/query | +*SearchApi* | [**setSettings**](docs/SearchApi.md#setSettings) | **PUT** /1/indexes/{indexName}/settings | + + +## Documentation for Models + + - [BaseIndexSettings](docs/BaseIndexSettings.md) + - [BaseSearchParams](docs/BaseSearchParams.md) + - [BaseSearchResponse](docs/BaseSearchResponse.md) + - [BaseSearchResponseFacetsStats](docs/BaseSearchResponseFacetsStats.md) + - [BatchObject](docs/BatchObject.md) + - [BatchResponse](docs/BatchResponse.md) + - [DeleteIndexResponse](docs/DeleteIndexResponse.md) + - [ErrorBase](docs/ErrorBase.md) + - [HighlightResult](docs/HighlightResult.md) + - [Index](docs/Index.md) + - [IndexSettings](docs/IndexSettings.md) + - [IndexSettingsAsSearchParams](docs/IndexSettingsAsSearchParams.md) + - [ListIndicesResponse](docs/ListIndicesResponse.md) + - [MultipleQueries](docs/MultipleQueries.md) + - [MultipleQueriesObject](docs/MultipleQueriesObject.md) + - [MultipleQueriesResponse](docs/MultipleQueriesResponse.md) + - [Operation](docs/Operation.md) + - [OperationIndexObject](docs/OperationIndexObject.md) + - [OperationIndexResponse](docs/OperationIndexResponse.md) + - [RankingInfo](docs/RankingInfo.md) + - [RankingInfoMatchedGeoLocation](docs/RankingInfoMatchedGeoLocation.md) + - [Record](docs/Record.md) + - [SaveObjectResponse](docs/SaveObjectResponse.md) + - [SearchHits](docs/SearchHits.md) + - [SearchParams](docs/SearchParams.md) + - [SearchResponse](docs/SearchResponse.md) + - [SetSettingsResponse](docs/SetSettingsResponse.md) + - [SnippetResult](docs/SnippetResult.md) + + +## Documentation for Authorization + +Authentication schemes defined for the API: +### apiKey + +- **Type**: API key +- **API key parameter name**: X-Algolia-API-Key +- **Location**: HTTP header + +### appId + +- **Type**: API key +- **API key parameter name**: X-Algolia-Application-Id +- **Location**: HTTP header + + ## Recommendation It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java new file mode 100644 index 0000000000..6e705f81e3 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java @@ -0,0 +1,67 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.util.List; +import java.util.Map; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure( + ApiException e, + int statusCode, + Map> responseHeaders + ); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess( + T result, + int statusCode, + Map> responseHeaders + ); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index 0e52c9b5a1..bd7dc8868e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -1,152 +1,537 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; -import com.algolia.auth.ApiKeyAuth; -import com.algolia.auth.HttpBasicAuth; -import com.algolia.auth.HttpBearerAuth; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import feign.Feign; -import feign.RequestInterceptor; -import feign.form.FormEncoder; -import feign.jackson.JacksonEncoder; -import feign.okhttp.OkHttpClient; -import feign.slf4j.Slf4jLogger; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.openapitools.jackson.nullable.JsonNullableModule; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" -) +import com.algolia.auth.Authentication; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import javax.net.ssl.*; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; + public class ApiClient { - private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + + private String basePath; + private String appId, apiKey; - public interface Api {} + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; - protected ObjectMapper objectMapper; - private String basePath = "http://localhost"; - private Map apiAuthorizations; - private Feign.Builder feignBuilder; + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; - public ApiClient() { - objectMapper = createObjectMapper(); - apiAuthorizations = new LinkedHashMap(); - feignBuilder = - Feign - .builder() - .client(new OkHttpClient()) - .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new ApiResponseDecoder(objectMapper)) - .logger(new Slf4jLogger()); + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Basic constructor for ApiClient + */ + public ApiClient(String appId, String apiKey) { + init(); + initHttpClient(); + + this.basePath = "https://" + appId + "-1.algolianet.com"; + this.appId = appId; + this.apiKey = apiKey; } - public ApiClient(String[] authNames) { - this(); - for (String authName : authNames) { - log.log(Level.FINE, "Creating authentication {0}", authName); - RequestInterceptor auth; - if ("apiKey".equals(authName)) { - auth = new ApiKeyAuth("header", "X-Algolia-API-Key"); - } else if ("appId".equals(authName)) { - auth = new ApiKeyAuth("header", "X-Algolia-Application-Id"); + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor : interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/0.1.0/java"); + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. Default to + * true. NOTE: Do NOT set to false in production code, otherwise you would face multiple types of + * cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. Use null to reset to + * default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = + httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { - throw new RuntimeException( - "auth name \"" + authName + "\" not found in available auth names" - ); + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; } - addAuthorization(authName, auth); } + this.debugging = debugging; + return this; } /** - * Basic constructor for single auth name + * The path of temporary folder used to store downloaded files from endpoints with file response. + * The default value is null, i.e. using the system's default temporary folder. * - * @param authName + * @see createTempFile + * @return Temporary folder path */ - public ApiClient(String authName) { - this(new String[] { authName }); + public String getTempFolderPath() { + return tempFolderPath; } /** - * Helper constructor for single api key + * Set the temporary folder path (for downloading files) * - * @param authName - * @param apiKey + * @param tempFolderPath Temporary folder path + * @return ApiClient */ - public ApiClient(String authName, String apiKey) { - this(authName); - this.setApiKey(apiKey); + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; } - public String getBasePath() { - return basePath; + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); } - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; + /** + * Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values + * must be between 1 and {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = + httpClient + .newBuilder() + .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) + .build(); return this; } - public Map getApiAuthorizations() { - return apiAuthorizations; + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); } - public void setApiAuthorizations( - Map apiAuthorizations - ) { - this.apiAuthorizations = apiAuthorizations; + /** + * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must + * be between 1 and {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = + httpClient + .newBuilder() + .readTimeout(readTimeout, TimeUnit.MILLISECONDS) + .build(); + return this; } - public Feign.Builder getFeignBuilder() { - return feignBuilder; + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); } - public ApiClient setFeignBuilder(Feign.Builder feignBuilder) { - this.feignBuilder = feignBuilder; + /** + * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values must + * be between 1 and {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = + httpClient + .newBuilder() + .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) + .build(); return this; } - private ObjectMapper createObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.setDateFormat(new RFC3339DateFormat()); - objectMapper.registerModule(new JavaTimeModule()); - JsonNullableModule jnm = new JsonNullableModule(); - objectMapper.registerModule(jnm); - return objectMapper; + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if ( + param instanceof Date || + param instanceof OffsetDateTime || + param instanceof LocalDate + ) { + // Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } } - public ObjectMapper getObjectMapper() { - return objectMapper; + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + *

Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if ( + name == null || + name.isEmpty() || + value == null || + value instanceof Collection + ) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; } - public void setObjectMapper(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + *

Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs( + String collectionFormat, + String name, + Collection value + ) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; } /** - * Creates a feign client for given API interface. + * Formats the specified collection path parameter to a string value. * - *

Usage: ApiClient apiClient = new ApiClient(); - * apiClient.setBasePath("http://localhost:8080"); XYZApi api = - * apiClient.buildClient(XYZApi.class); XYZResponse response = api.someMethod(...); + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString( + String collectionFormat, + Collection value + ) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif * - * @param Type - * @param clientClass Client class - * @return The Client + * @param filename The filename to be sanitized + * @return The sanitized filename */ - public T buildClient(Class clientClass) { - return feignBuilder.target(clientClass, basePath); + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; + * charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON + * + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = + "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } /** @@ -158,10 +543,14 @@ public T buildClient(Class clientClass) { * set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) return null; - if ( - StringUtil.containsIgnoreCase(accepts, "application/json") - ) return "application/json"; + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } return StringUtil.join(accepts, ","); } @@ -170,86 +559,721 @@ public String selectHeaderAccept(String[] accepts) { * use it; otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, JSON will be used. + * @return The Content-Type header to use. If the given array is empty, or matches "any", JSON + * will be used. */ public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) return "application/json"; - if ( - StringUtil.containsIgnoreCase(contentTypes, "application/json") - ) return "application/json"; + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } return contentTypes[0]; } /** - * Helper method to configure the bearer token. + * Escape the given string to be used as URL query value. * - * @param bearerToken the bearer token. + * @param str String to be escaped + * @return Escaped string */ - public void setBearerToken(String bearerToken) { - HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); - apiAuthorization.setBearerToken(bearerToken); + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } } /** - * Helper method to configure the first api key found + * Deserialize response body to Java object, according to the return type and the Content-Type + * response header. * - * @param apiKey API key + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body or + * the Content-Type of the response is not supported. */ - public void setApiKey(String apiKey) { - ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); - apiAuthorization.setApiKey(apiKey); + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) + throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + String respBody; + try { + if (response.body() != null) respBody = + response.body().string(); else respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + + contentType + + "\" is not supported for type: " + + returnType, + response.code(), + response.headers().toMultimap(), + respBody + ); + } + } + + /** + * Serialize the given Java object into request body according to the object's class and the + * request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) + throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported" + ); + } + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); } /** - * Helper method to configure the username/password for basic auth + * Execute HTTP call and deserialize the HTTP response body into the given return type. * - * @param username Username - * @param password Password + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and data, which is a Java object + * deserialized from response body and would be null when returnType is null. + * @throws ApiException If fail to execute the call */ - public void setCredentials(String username, String password) { - HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); - apiAuthorization.setCredentials(username, password); + public ApiResponse execute(Call call, Type returnType) + throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse( + response.code(), + response.headers().toMultimap(), + data + ); + } catch (IOException e) { + throw new ApiException(e); + } } /** - * Gets request interceptor based on authentication name + * {@link #executeAsync(Call, Type, ApiCallback)} * - * @param authName Authentication name - * @return Request Interceptor + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> */ - public RequestInterceptor getAuthorization(String authName) { - return apiAuthorizations.get(authName); + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); } /** - * Adds an authorization to be used by the client + * Execute HTTP call asynchronously. * - * @param authName Authentication name - * @param authorization Request interceptor + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) */ - public void addAuthorization( - String authName, - RequestInterceptor authorization + @SuppressWarnings("unchecked") + public void executeAsync( + Call call, + final Type returnType, + final ApiCallback callback ) { - if (apiAuthorizations.containsKey(authName)) { - throw new RuntimeException( - "auth name \"" + authName + "\" already in api authorizations" + call.enqueue( + new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) + throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure( + e, + response.code(), + response.headers().toMultimap() + ); + return; + } catch (Exception e) { + callback.onFailure( + new ApiException(e), + response.code(), + response.headers().toMultimap() + ); + return; + } + callback.onSuccess( + result, + response.code(), + response.headers().toMultimap() + ); + } + } + ); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws ApiException If the response has an unsuccessful status code or fail to deserialize the + * response body + */ + public T handleResponse(Response response, Type returnType) + throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap() + ); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException( + response.message(), + e, + response.code(), + response.headers().toMultimap() + ); + } + } + throw new ApiException( + response.message(), + response.code(), + response.headers().toMultimap(), + respBody ); } - apiAuthorizations.put(authName, authorization); - feignBuilder.requestInterceptor(authorization); } - private T getAuthorization(Class type) { - return (T) apiAuthorizations - .values() - .stream() - .filter(requestInterceptor -> - type.isAssignableFrom(requestInterceptor.getClass()) - ) - .findFirst() - .orElseThrow(() -> - new RuntimeException("No Oauth authentication or OAuth configured!") + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and + * "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String[] authNames, + ApiCallback callback + ) throws ApiException { + Request request = buildRequest( + path, + method, + queryParams, + collectionQueryParams, + body, + headerParams, + cookieParams, + formParams, + authNames, + callback + ); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and + * "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest( + String path, + String method, + List queryParams, + List collectionQueryParams, + Object body, + Map headerParams, + Map cookieParams, + Map formParams, + String[] authNames, + ApiCallback callback + ) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody( + reqBody, + callback ); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl( + String path, + List queryParams, + List collectionQueryParams + ) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url + .append(escapeString(param.getName())) + .append("=") + .append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams( + Map headerParams, + Request.Builder reqBuilder + ) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header( + header.getKey(), + parameterToString(header.getValue()) + ); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams( + Map cookieParams, + Request.Builder reqBuilder + ) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader( + "Cookie", + String.format("%s=%s", param.getKey(), param.getValue()) + ); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader( + "Cookie", + String.format("%s=%s", param.getKey(), param.getValue()) + ); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + public void updateParamsForAuth( + String[] authNames, + List queryParams, + Map headerParams, + Map cookieParams + ) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding( + Map formParams + ) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, which could + * contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder() + .setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of( + "Content-Disposition", + "form-data; name=\"" + + param.getKey() + + "\"; filename=\"" + + file.getName() + + "\"" + ); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } else { + Headers partHeaders = Headers.of( + "Content-Disposition", + "form-data; name=\"" + param.getKey() + "\"" + ); + mpBuilder.addPart( + partHeaders, + RequestBody.create(parameterToString(param.getValue()), null) + ); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for async + * requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse + .newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of verifyingSsl and + * sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = + new TrustManager[] { + new X509TrustManager() { + @Override + public void checkClientTrusted( + java.security.cert.X509Certificate[] chain, + String authType + ) throws CertificateException {} + + @Override + public void checkServerTrusted( + java.security.cert.X509Certificate[] chain, + String authType + ) throws CertificateException {} + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[] {}; + } + }, + }; + hostnameVerifier = + new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( + TrustManagerFactory.getDefaultAlgorithm() + ); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance( + "X.509" + ); + Collection certificates = certificateFactory.generateCertificates( + sslCaCert + ); + if (certificates.isEmpty()) { + throw new IllegalArgumentException( + "expected non-empty set of trusted certificates" + ); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = + httpClient + .newBuilder() + .sslSocketFactory( + sslContext.getSocketFactory(), + (X509TrustManager) trustManagers[0] + ) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) + throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java new file mode 100644 index 0000000000..a27764d7bf --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -0,0 +1,119 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.util.List; +import java.util.Map; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-14T10:06:19.720908+01:00[Europe/Paris]" +) +public class ApiException extends Exception { + + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders, + String responseBody + ) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException( + String message, + int code, + Map> responseHeaders, + String responseBody + ) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException( + String message, + Throwable throwable, + int code, + Map> responseHeaders + ) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException( + int code, + Map> responseHeaders, + String responseBody + ) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException( + int code, + String message, + Map> responseHeaders, + String responseBody + ) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java similarity index 69% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java index b6f28307d0..2e0cf698d2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ApiResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java @@ -1,8 +1,25 @@ -package com.algolia.model; +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.List; import java.util.Map; +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ public class ApiResponse { private final int statusCode; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java deleted file mode 100644 index b96bfcd21d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponseDecoder.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.algolia; - -import com.algolia.model.ApiResponse; -import com.fasterxml.jackson.databind.ObjectMapper; -import feign.Response; -import feign.Types; -import feign.jackson.JacksonDecoder; -import java.io.IOException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -public class ApiResponseDecoder extends JacksonDecoder { - - public ApiResponseDecoder(ObjectMapper mapper) { - super(mapper); - } - - @Override - public Object decode(Response response, Type type) throws IOException { - Map> responseHeaders = Collections.unmodifiableMap( - response.headers() - ); - // Detects if the type is an instance of the parameterized class ApiResponse - Type responseBodyType; - if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { - // The ApiResponse class has a single type parameter, the Dto class itself - responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; - Object body = super.decode(response, responseBodyType); - return new ApiResponse(response.status(), responseHeaders, body); - } else { - // The response is not encapsulated in the ApiResponse, decode the Dto as normal - return super.decode(response, type); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java new file mode 100644 index 0000000000..50f074f215 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java @@ -0,0 +1,42 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" +) +public class Configuration { + + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API instances without providing + * an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API instances without providing + * an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java deleted file mode 100644 index 5c63f8d600..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/EncodingUtils.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.algolia; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** Utilities to support Swagger encoding formats in Feign. */ -public final class EncodingUtils { - - /** Private constructor. Do not construct this class. */ - private EncodingUtils() {} - - /** - * Encodes a collection of query parameters according to the Swagger collection format. - * - *

Of the various collection formats defined by Swagger ("csv", "tsv", etc), Feign only - * natively supports "multi". This utility generates the other format types so it will be properly - * processed by Feign. - * - *

Note, as part of reformatting, it URL encodes the parameters as well. - * - * @param parameters The collection object to be formatted. This object will not be changed. - * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", "pipes"). See the OpenAPI Spec for more - * details. - * @return An object that will be correctly formatted by Feign. - */ - public static Object encodeCollection( - Collection parameters, - String collectionFormat - ) { - if (parameters == null) { - return parameters; - } - List stringValues = new ArrayList<>(parameters.size()); - for (Object parameter : parameters) { - // ignore null values (same behavior as Feign) - if (parameter != null) { - stringValues.add(encode(parameter)); - } - } - // Feign natively handles single-element lists and the "multi" format. - if (stringValues.size() < 2 || "multi".equals(collectionFormat)) { - return stringValues; - } - // Otherwise return a formatted String - String[] stringArray = stringValues.toArray(new String[0]); - switch (collectionFormat) { - case "csv": - default: - return StringUtil.join(stringArray, ","); - case "ssv": - return StringUtil.join(stringArray, " "); - case "tsv": - return StringUtil.join(stringArray, "\t"); - case "pipes": - return StringUtil.join(stringArray, "|"); - } - } - - /** - * URL encode a single query parameter. - * - * @param parameter The query parameter to encode. This object will not be changed. - * @return The URL encoded string representation of the parameter. If the parameter is null, - * returns null. - */ - public static String encode(Object parameter) { - if (parameter == null) { - return null; - } - try { - return URLEncoder - .encode(parameter.toString(), "UTF-8") - .replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java new file mode 100644 index 0000000000..adbaeed4d5 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java @@ -0,0 +1,92 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.io.IOException; +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +/** + * Encodes request bodies using gzip. + * + *

Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if ( + originalRequest.body() == null || + originalRequest.header("Content-Encoding") != null + ) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest + .newBuilder() + .header("Content-Encoding", "gzip") + .method( + originalRequest.method(), + forceContentLength(gzip(originalRequest.body())) + ) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) + throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java new file mode 100644 index 0000000000..fe28064063 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java @@ -0,0 +1,404 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import com.algolia.model.*; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.gsonfire.GsonFireBuilder; +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Map; +import okio.ByteString; + +public class JSON { + + private Gson gson; + private boolean isLenientOnJson = false; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue( + JsonElement readElement, + String discriminatorField + ) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException( + "missing discriminator field: <" + discriminatorField + ">" + ); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator + * value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator( + Map classByDiscriminatorValue, + String discriminatorValue + ) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException( + "cannot determine model class of name: <" + discriminatorValue + ">" + ); + } + return clazz; + } + + public JSON() { + gson = + createGson() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .registerTypeAdapter(byte[].class, byteArrayAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + public JSON setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + return this; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see + // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** Gson TypeAdapter for Byte Array type */ + public class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** Gson TypeAdapter for JSR310 OffsetDateTime type */ + public static class OffsetDateTimeTypeAdapter + extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length() - 5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** Gson TypeAdapter for JSR310 LocalDate type */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" format + * will be used (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date( + ISO8601Utils.parse(date, new ParsePosition(0)).getTime() + ); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java new file mode 100644 index 0000000000..752fe67775 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java @@ -0,0 +1,60 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +public class Pair { + + private String name = ""; + private String value = ""; + + public Pair(String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java deleted file mode 100644 index 62406b46b1..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ParamExpander.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia; - -import feign.Param; -import java.text.DateFormat; -import java.util.Date; - -/** Param Expander to convert {@link Date} to RFC3339 */ -public class ParamExpander implements Param.Expander { - - private static final DateFormat dateformat = new RFC3339DateFormat(); - - @Override - public String expand(Object value) { - if (value instanceof Date) { - return dateformat.format(value); - } - return value.toString(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java new file mode 100644 index 0000000000..1b84b55603 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.io.IOException; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress( + bytesWritten, + contentLength, + bytesWritten == contentLength + ); + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java new file mode 100644 index 0000000000..f85f459d87 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java @@ -0,0 +1,71 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia; + +import java.io.IOException; +import okhttp3.MediaType; +import okhttp3.ResponseBody; +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress( + totalBytesRead, + responseBody.contentLength(), + bytesRead == -1 + ); + return bytesRead; + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java deleted file mode 100644 index 1a271ed189..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/RFC3339DateFormat.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -import com.fasterxml.jackson.databind.util.StdDateFormat; -import java.text.DateFormat; -import java.text.FieldPosition; -import java.text.ParsePosition; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -public class RFC3339DateFormat extends DateFormat { - - private static final long serialVersionUID = 1L; - private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); - - private final StdDateFormat fmt = new StdDateFormat() - .withTimeZone(TIMEZONE_Z) - .withColonInTimeZone(true); - - public RFC3339DateFormat() { - this.calendar = new GregorianCalendar(); - } - - @Override - public Date parse(String source) { - return parse(source, new ParsePosition(0)); - } - - @Override - public Date parse(String source, ParsePosition pos) { - return fmt.parse(source, pos); - } - - @Override - public StringBuffer format( - Date date, - StringBuffer toAppendTo, - FieldPosition fieldPosition - ) { - return fmt.format(date, toAppendTo, fieldPosition); - } - - @Override - public Object clone() { - return this; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java index 00495e4edf..d9dcd013d6 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java @@ -1,14 +1,32 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; -import feign.RequestInterceptor; -import feign.RequestTemplate; +import com.algolia.Pair; +import java.util.List; +import java.util.Map; -public class ApiKeyAuth implements RequestInterceptor { +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" +) +public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; private String apiKey; + private String apiKeyPrefix; public ApiKeyAuth(String location, String paramName) { this.location = location; @@ -31,14 +49,35 @@ public void setApiKey(String apiKey) { this.apiKey = apiKey; } + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + @Override - public void apply(RequestTemplate template) { + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } if ("query".equals(location)) { - template.query(paramName, apiKey); + queryParams.add(new Pair(paramName, value)); } else if ("header".equals(location)) { - template.header(paramName, apiKey); + headerParams.put(paramName, value); } else if ("cookie".equals(location)) { - template.header("Cookie", String.format("%s=%s", paramName, apiKey)); + cookieParams.put(paramName, value); } } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java new file mode 100644 index 0000000000..8a2b1bcd3d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java @@ -0,0 +1,32 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; + +import com.algolia.Pair; +import java.util.List; +import java.util.Map; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java deleted file mode 100644 index 7a2151ff41..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/DefaultApi20Impl.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.algolia.auth; - -import com.github.scribejava.core.builder.api.DefaultApi20; -import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; -import com.github.scribejava.core.extractors.TokenExtractor; -import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; -import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; -import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; -import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" -) -public class DefaultApi20Impl extends DefaultApi20 { - - private final String accessTokenEndpoint; - private final String authorizationBaseUrl; - - protected DefaultApi20Impl( - String authorizationBaseUrl, - String accessTokenEndpoint - ) { - this.authorizationBaseUrl = authorizationBaseUrl; - this.accessTokenEndpoint = accessTokenEndpoint; - } - - @Override - public String getAccessTokenEndpoint() { - return accessTokenEndpoint; - } - - @Override - protected String getAuthorizationBaseUrl() { - return authorizationBaseUrl; - } - - @Override - public BearerSignature getBearerSignature() { - return BearerSignatureURIQueryParameter.instance(); - } - - @Override - public ClientAuthentication getClientAuthentication() { - return RequestBodyAuthenticationScheme.instance(); - } - - @Override - public TokenExtractor getAccessTokenExtractor() { - return OAuth2AccessTokenJsonExtractor.instance(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java index dd0bcf98d9..67c0ed175f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java @@ -1,11 +1,23 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; -import feign.RequestInterceptor; -import feign.RequestTemplate; -import feign.auth.BasicAuthRequestInterceptor; +import com.algolia.Pair; +import java.util.List; +import java.util.Map; +import okhttp3.Credentials; -/** An interceptor that adds the request header needed to use HTTP basic authentication. */ -public class HttpBasicAuth implements RequestInterceptor { +public class HttpBasicAuth implements Authentication { private String username; private String password; @@ -26,17 +38,21 @@ public void setPassword(String password) { this.password = password; } - public void setCredentials(String username, String password) { - this.username = username; - this.password = password; - } - @Override - public void apply(RequestTemplate template) { - RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor( - username, - password + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ) { + if (username == null && password == null) { + return; + } + headerParams.put( + "Authorization", + Credentials.basic( + username == null ? "" : username, + password == null ? "" : password + ) ); - requestInterceptor.apply(template); } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java index 39b75f4a93..15432efd60 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java @@ -1,10 +1,26 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.auth; -import feign.RequestInterceptor; -import feign.RequestTemplate; +import com.algolia.Pair; +import java.util.List; +import java.util.Map; -/** An interceptor that adds the request header needed to use HTTP bearer authentication. */ -public class HttpBearerAuth implements RequestInterceptor { +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" +) +public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; @@ -16,6 +32,8 @@ public HttpBearerAuth(String scheme) { /** * Gets the token, which together with the scheme, will be sent as the value of the Authorization * header. + * + * @return The bearer token */ public String getBearerToken() { return bearerToken; @@ -24,18 +42,24 @@ public String getBearerToken() { /** * Sets the token, which together with the scheme, will be sent as the value of the Authorization * header. + * + * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { this.bearerToken = bearerToken; } @Override - public void apply(RequestTemplate template) { + public void applyToParams( + List queryParams, + Map headerParams, + Map cookieParams + ) { if (bearerToken == null) { return; } - template.header( + headerParams.put( "Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken ); diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index 1f35da6ed0..9f94437545 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.HashMap; @@ -24,67 +21,74 @@ import java.util.Objects; /** BaseIndexSettings */ -@JsonPropertyOrder( - { - BaseIndexSettings.JSON_PROPERTY_REPLICAS, - BaseIndexSettings.JSON_PROPERTY_PAGINATION_LIMITED_TO, - BaseIndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS, - BaseIndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE, - BaseIndexSettings.JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES, - BaseIndexSettings.JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES, - BaseIndexSettings.JSON_PROPERTY_INDEX_LANGUAGES, - BaseIndexSettings.JSON_PROPERTY_FILTER_PROMOTES, - BaseIndexSettings.JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES, - BaseIndexSettings.JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY, - BaseIndexSettings.JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING, - BaseIndexSettings.JSON_PROPERTY_USER_DATA, - } -) -@JsonTypeName("baseIndexSettings") public class BaseIndexSettings { - public static final String JSON_PROPERTY_REPLICAS = "replicas"; + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; - public static final String JSON_PROPERTY_PAGINATION_LIMITED_TO = + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS = + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES = + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES = + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; - public static final String JSON_PROPERTY_INDEX_LANGUAGES = "indexLanguages"; + public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) private List indexLanguages = null; - public static final String JSON_PROPERTY_FILTER_PROMOTES = "filterPromotes"; + public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) private Boolean filterPromotes = false; - public static final String JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING = + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; - public static final String JSON_PROPERTY_USER_DATA = "userData"; + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; public BaseIndexSettings replicas(List replicas) { @@ -107,14 +111,10 @@ public BaseIndexSettings addReplicasItem(String replicasItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } @@ -133,14 +133,10 @@ public BaseIndexSettings paginationLimitedTo(Integer paginationLimitedTo) { @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." ) - @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } - @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } @@ -171,14 +167,10 @@ public BaseIndexSettings addDisableTypoToleranceOnWordsItem( @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." ) - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnWords( List disableTypoToleranceOnWords ) { @@ -211,14 +203,10 @@ public BaseIndexSettings addAttributesToTransliterateItem( @ApiModelProperty( value = "Specify on which attributes to apply transliteration." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToTransliterate() { return attributesToTransliterate; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToTransliterate( List attributesToTransliterate ) { @@ -251,14 +239,10 @@ public BaseIndexSettings addCamelCaseAttributesItem( @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." ) - @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCamelCaseAttributes() { return camelCaseAttributes; } - @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } @@ -292,20 +276,10 @@ public BaseIndexSettings putDecompoundedAttributesItem( value = "Specify on which attributes in your index Algolia should apply word segmentation, also" + " known as decompounding." ) - @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } - @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setDecompoundedAttributes( Map decompoundedAttributes ) { @@ -336,14 +310,10 @@ public BaseIndexSettings addIndexLanguagesItem(String indexLanguagesItem) { value = "Sets the languages at the index level for language-specific processing such as" + " tokenization and normalization." ) - @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getIndexLanguages() { return indexLanguages; } - @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } @@ -364,14 +334,10 @@ public BaseIndexSettings filterPromotes(Boolean filterPromotes) { value = "Whether promoted results should match the filters of the current search, except for" + " geographic filters." ) - @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFilterPromotes() { return filterPromotes; } - @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } @@ -402,14 +368,10 @@ public BaseIndexSettings addDisablePrefixOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." ) - @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisablePrefixOnAttributes( List disablePrefixOnAttributes ) { @@ -430,14 +392,10 @@ public BaseIndexSettings allowCompressionOfIntegerArray( */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") - @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } - @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowCompressionOfIntegerArray( Boolean allowCompressionOfIntegerArray ) { @@ -470,14 +428,10 @@ public BaseIndexSettings addNumericAttributesForFilteringItem( @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." ) - @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } - @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericAttributesForFiltering( List numericAttributesForFiltering ) { @@ -504,20 +458,10 @@ public BaseIndexSettings putUserDataItem(String key, Object userDataItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getUserData() { return userData; } - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setUserData(Map userData) { this.userData = userData; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index 09cefffd16..ad0204e342 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -12,11 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; @@ -26,154 +22,185 @@ import org.openapitools.jackson.nullable.JsonNullable; /** BaseSearchParams */ -@JsonPropertyOrder( - { - BaseSearchParams.JSON_PROPERTY_QUERY, - BaseSearchParams.JSON_PROPERTY_SIMILAR_QUERY, - BaseSearchParams.JSON_PROPERTY_FILTERS, - BaseSearchParams.JSON_PROPERTY_FACET_FILTERS, - BaseSearchParams.JSON_PROPERTY_OPTIONAL_FILTERS, - BaseSearchParams.JSON_PROPERTY_NUMERIC_FILTERS, - BaseSearchParams.JSON_PROPERTY_TAG_FILTERS, - BaseSearchParams.JSON_PROPERTY_SUM_OR_FILTERS_SCORES, - BaseSearchParams.JSON_PROPERTY_FACETS, - BaseSearchParams.JSON_PROPERTY_MAX_VALUES_PER_FACET, - BaseSearchParams.JSON_PROPERTY_FACETING_AFTER_DISTINCT, - BaseSearchParams.JSON_PROPERTY_SORT_FACET_VALUES_BY, - BaseSearchParams.JSON_PROPERTY_PAGE, - BaseSearchParams.JSON_PROPERTY_OFFSET, - BaseSearchParams.JSON_PROPERTY_LENGTH, - BaseSearchParams.JSON_PROPERTY_AROUND_LAT_LNG, - BaseSearchParams.JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P, - BaseSearchParams.JSON_PROPERTY_AROUND_RADIUS, - BaseSearchParams.JSON_PROPERTY_AROUND_PRECISION, - BaseSearchParams.JSON_PROPERTY_MINIMUM_AROUND_RADIUS, - BaseSearchParams.JSON_PROPERTY_INSIDE_BOUNDING_BOX, - BaseSearchParams.JSON_PROPERTY_INSIDE_POLYGON, - BaseSearchParams.JSON_PROPERTY_NATURAL_LANGUAGES, - BaseSearchParams.JSON_PROPERTY_RULE_CONTEXTS, - BaseSearchParams.JSON_PROPERTY_PERSONALIZATION_IMPACT, - BaseSearchParams.JSON_PROPERTY_USER_TOKEN, - BaseSearchParams.JSON_PROPERTY_GET_RANKING_INFO, - BaseSearchParams.JSON_PROPERTY_CLICK_ANALYTICS, - BaseSearchParams.JSON_PROPERTY_ANALYTICS, - BaseSearchParams.JSON_PROPERTY_ANALYTICS_TAGS, - BaseSearchParams.JSON_PROPERTY_PERCENTILE_COMPUTATION, - BaseSearchParams.JSON_PROPERTY_ENABLE_A_B_TEST, - BaseSearchParams.JSON_PROPERTY_ENABLE_RE_RANKING, - } -) -@JsonTypeName("baseSearchParams") public class BaseSearchParams { - public static final String JSON_PROPERTY_QUERY = "query"; + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String JSON_PROPERTY_SIMILAR_QUERY = "similarQuery"; + public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) private String similarQuery = ""; - public static final String JSON_PROPERTY_FILTERS = "filters"; + public static final String SERIALIZED_NAME_FILTERS = "filters"; + + @SerializedName(SERIALIZED_NAME_FILTERS) private String filters = ""; - public static final String JSON_PROPERTY_FACET_FILTERS = "facetFilters"; + public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) private List facetFilters = null; - public static final String JSON_PROPERTY_OPTIONAL_FILTERS = "optionalFilters"; + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = + "optionalFilters"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) private List optionalFilters = null; - public static final String JSON_PROPERTY_NUMERIC_FILTERS = "numericFilters"; + public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) private List numericFilters = null; - public static final String JSON_PROPERTY_TAG_FILTERS = "tagFilters"; + public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) private List tagFilters = null; - public static final String JSON_PROPERTY_SUM_OR_FILTERS_SCORES = + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; - public static final String JSON_PROPERTY_FACETS = "facets"; + public static final String SERIALIZED_NAME_FACETS = "facets"; + + @SerializedName(SERIALIZED_NAME_FACETS) private List facets = null; - public static final String JSON_PROPERTY_MAX_VALUES_PER_FACET = + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String JSON_PROPERTY_FACETING_AFTER_DISTINCT = + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String JSON_PROPERTY_SORT_FACET_VALUES_BY = + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; - public static final String JSON_PROPERTY_PAGE = "page"; + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; - public static final String JSON_PROPERTY_OFFSET = "offset"; + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) private Integer offset; - public static final String JSON_PROPERTY_LENGTH = "length"; + public static final String SERIALIZED_NAME_LENGTH = "length"; + + @SerializedName(SERIALIZED_NAME_LENGTH) private Integer length; - public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng = ""; - public static final String JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P = + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; - public static final String JSON_PROPERTY_AROUND_RADIUS = "aroundRadius"; - private JsonNullable aroundRadius = JsonNullable.undefined(); + public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) + private OneOfintegerstring aroundRadius; + + public static final String SERIALIZED_NAME_AROUND_PRECISION = + "aroundPrecision"; - public static final String JSON_PROPERTY_AROUND_PRECISION = "aroundPrecision"; + @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) private Integer aroundPrecision = 10; - public static final String JSON_PROPERTY_MINIMUM_AROUND_RADIUS = + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String JSON_PROPERTY_INSIDE_BOUNDING_BOX = + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; - public static final String JSON_PROPERTY_INSIDE_POLYGON = "insidePolygon"; + public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) private List insidePolygon = null; - public static final String JSON_PROPERTY_NATURAL_LANGUAGES = + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; - public static final String JSON_PROPERTY_RULE_CONTEXTS = "ruleContexts"; + public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) private List ruleContexts = null; - public static final String JSON_PROPERTY_PERSONALIZATION_IMPACT = + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; - public static final String JSON_PROPERTY_USER_TOKEN = "userToken"; + public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + + @SerializedName(SERIALIZED_NAME_USER_TOKEN) private String userToken; - public static final String JSON_PROPERTY_GET_RANKING_INFO = "getRankingInfo"; + public static final String SERIALIZED_NAME_GET_RANKING_INFO = + "getRankingInfo"; + + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) private Boolean getRankingInfo = false; - public static final String JSON_PROPERTY_CLICK_ANALYTICS = "clickAnalytics"; + public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) private Boolean clickAnalytics = false; - public static final String JSON_PROPERTY_ANALYTICS = "analytics"; + public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS) private Boolean analytics = true; - public static final String JSON_PROPERTY_ANALYTICS_TAGS = "analyticsTags"; + public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) private List analyticsTags = null; - public static final String JSON_PROPERTY_PERCENTILE_COMPUTATION = + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; - public static final String JSON_PROPERTY_ENABLE_A_B_TEST = "enableABTest"; + public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) private Boolean enableABTest = true; - public static final String JSON_PROPERTY_ENABLE_RE_RANKING = + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; public BaseSearchParams query(String query) { @@ -188,14 +215,10 @@ public BaseSearchParams query(String query) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -216,14 +239,10 @@ public BaseSearchParams similarQuery(String similarQuery) { value = "Overrides the query parameter and performs a more generic search that can be used to" + " find \"similar\" results." ) - @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSimilarQuery() { return similarQuery; } - @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } @@ -242,14 +261,10 @@ public BaseSearchParams filters(String filters) { @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." ) - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFilters() { return filters; } - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(String filters) { this.filters = filters; } @@ -274,14 +289,10 @@ public BaseSearchParams addFacetFiltersItem(String facetFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") - @JsonProperty(JSON_PROPERTY_FACET_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacetFilters() { return facetFilters; } - @JsonProperty(JSON_PROPERTY_FACET_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } @@ -310,14 +321,10 @@ public BaseSearchParams addOptionalFiltersItem(String optionalFiltersItem) { value = "Create filters for ranking purposes, where records that match the filter are ranked" + " higher, or lower in the case of a negative optional filter." ) - @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalFilters() { return optionalFilters; } - @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } @@ -342,14 +349,10 @@ public BaseSearchParams addNumericFiltersItem(String numericFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") - @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericFilters() { return numericFilters; } - @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } @@ -374,14 +377,10 @@ public BaseSearchParams addTagFiltersItem(String tagFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") - @JsonProperty(JSON_PROPERTY_TAG_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getTagFilters() { return tagFilters; } - @JsonProperty(JSON_PROPERTY_TAG_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } @@ -400,14 +399,10 @@ public BaseSearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { @ApiModelProperty( value = "Determines how to calculate the total score for filtering." ) - @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } - @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } @@ -432,14 +427,10 @@ public BaseSearchParams addFacetsItem(String facetsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacets() { return facets; } - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(List facets) { this.facets = facets; } @@ -458,14 +449,10 @@ public BaseSearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." ) - @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } - @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } @@ -484,14 +471,10 @@ public BaseSearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." ) - @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } - @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } @@ -508,14 +491,10 @@ public BaseSearchParams sortFacetValuesBy(String sortFacetValuesBy) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") - @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSortFacetValuesBy() { return sortFacetValuesBy; } - @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } @@ -532,14 +511,10 @@ public BaseSearchParams page(Integer page) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPage() { return page; } - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPage(Integer page) { this.page = page; } @@ -556,14 +531,10 @@ public BaseSearchParams offset(Integer offset) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") - @JsonProperty(JSON_PROPERTY_OFFSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getOffset() { return offset; } - @JsonProperty(JSON_PROPERTY_OFFSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOffset(Integer offset) { this.offset = offset; } @@ -582,14 +553,10 @@ public BaseSearchParams length(Integer length) { @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." ) - @JsonProperty(JSON_PROPERTY_LENGTH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getLength() { return length; } - @JsonProperty(JSON_PROPERTY_LENGTH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLength(Integer length) { this.length = length; } @@ -609,14 +576,10 @@ public BaseSearchParams aroundLatLng(String aroundLatLng) { value = "Search for entries around a central geolocation, enabling a geo search within a circular" + " area." ) - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -637,21 +600,16 @@ public BaseSearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { value = "Search for entries around a given location automatically computed from the requester’s" + " IP address." ) - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = JsonNullable.of(aroundRadius); - + this.aroundRadius = aroundRadius; return this; } @@ -664,26 +622,12 @@ public BaseSearchParams aroundRadius(OneOfintegerstring aroundRadius) { @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." ) - @JsonIgnore public OneOfintegerstring getAroundRadius() { - return aroundRadius.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getAroundRadius_JsonNullable() { return aroundRadius; } - @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) - public void setAroundRadius_JsonNullable( - JsonNullable aroundRadius - ) { - this.aroundRadius = aroundRadius; - } - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = JsonNullable.of(aroundRadius); + this.aroundRadius = aroundRadius; } public BaseSearchParams aroundPrecision(Integer aroundPrecision) { @@ -701,14 +645,10 @@ public BaseSearchParams aroundPrecision(Integer aroundPrecision) { value = "Precision of geo search (in meters), to add grouping by geo location to the ranking" + " formula." ) - @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAroundPrecision() { return aroundPrecision; } - @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } @@ -727,14 +667,10 @@ public BaseSearchParams minimumAroundRadius(Integer minimumAroundRadius) { @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." ) - @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } @@ -765,14 +701,10 @@ public BaseSearchParams addInsideBoundingBoxItem( @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." ) - @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsideBoundingBox() { return insideBoundingBox; } - @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } @@ -797,14 +729,10 @@ public BaseSearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") - @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsidePolygon() { return insidePolygon; } - @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } @@ -839,14 +767,10 @@ public BaseSearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { " settings work well together when the query is formatted in natural language" + " instead of keywords, for example when your user performs a voice search." ) - @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNaturalLanguages() { return naturalLanguages; } - @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } @@ -871,14 +795,10 @@ public BaseSearchParams addRuleContextsItem(String ruleContextsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") - @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRuleContexts() { return ruleContexts; } - @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } @@ -895,14 +815,10 @@ public BaseSearchParams personalizationImpact(Integer personalizationImpact) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") - @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPersonalizationImpact() { return personalizationImpact; } - @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } @@ -921,14 +837,10 @@ public BaseSearchParams userToken(String userToken) { @ApiModelProperty( value = "Associates a certain user token with the current search." ) - @JsonProperty(JSON_PROPERTY_USER_TOKEN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUserToken() { return userToken; } - @JsonProperty(JSON_PROPERTY_USER_TOKEN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserToken(String userToken) { this.userToken = userToken; } @@ -945,14 +857,10 @@ public BaseSearchParams getRankingInfo(Boolean getRankingInfo) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") - @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getGetRankingInfo() { return getRankingInfo; } - @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } @@ -969,14 +877,10 @@ public BaseSearchParams clickAnalytics(Boolean clickAnalytics) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") - @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getClickAnalytics() { return clickAnalytics; } - @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } @@ -995,14 +899,10 @@ public BaseSearchParams analytics(Boolean analytics) { @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." ) - @JsonProperty(JSON_PROPERTY_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAnalytics() { return analytics; } - @JsonProperty(JSON_PROPERTY_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalytics(Boolean analytics) { this.analytics = analytics; } @@ -1029,14 +929,10 @@ public BaseSearchParams addAnalyticsTagsItem(String analyticsTagsItem) { @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." ) - @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAnalyticsTags() { return analyticsTags; } - @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } @@ -1055,14 +951,10 @@ public BaseSearchParams percentileComputation(Boolean percentileComputation) { @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." ) - @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPercentileComputation() { return percentileComputation; } - @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } @@ -1081,14 +973,10 @@ public BaseSearchParams enableABTest(Boolean enableABTest) { @ApiModelProperty( value = "Whether this search should participate in running AB tests." ) - @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableABTest() { return enableABTest; } - @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } @@ -1105,14 +993,10 @@ public BaseSearchParams enableReRanking(Boolean enableReRanking) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") - @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableReRanking() { return enableReRanking; } - @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } @@ -1159,7 +1043,7 @@ public boolean equals(Object o) { this.aroundLatLngViaIP, baseSearchParams.aroundLatLngViaIP ) && - equalsNullable(this.aroundRadius, baseSearchParams.aroundRadius) && + Objects.equals(this.aroundRadius, baseSearchParams.aroundRadius) && Objects.equals(this.aroundPrecision, baseSearchParams.aroundPrecision) && Objects.equals( this.minimumAroundRadius, @@ -1229,7 +1113,7 @@ public int hashCode() { length, aroundLatLng, aroundLatLngViaIP, - hashCodeNullable(aroundRadius), + aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index c1ec915293..62e9c43953 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -12,122 +12,139 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** BaseSearchResponse */ -@JsonPropertyOrder( - { - BaseSearchResponse.JSON_PROPERTY_AB_TEST_I_D, - BaseSearchResponse.JSON_PROPERTY_AB_TEST_VARIANT_I_D, - BaseSearchResponse.JSON_PROPERTY_AROUND_LAT_LNG, - BaseSearchResponse.JSON_PROPERTY_AUTOMATIC_RADIUS, - BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT, - BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_NB_HITS, - BaseSearchResponse.JSON_PROPERTY_EXHAUSTIVE_TYPO, - BaseSearchResponse.JSON_PROPERTY_FACETS, - BaseSearchResponse.JSON_PROPERTY_FACETS_STATS, - BaseSearchResponse.JSON_PROPERTY_HITS_PER_PAGE, - BaseSearchResponse.JSON_PROPERTY_INDEX, - BaseSearchResponse.JSON_PROPERTY_INDEX_USED, - BaseSearchResponse.JSON_PROPERTY_MESSAGE, - BaseSearchResponse.JSON_PROPERTY_NB_HITS, - BaseSearchResponse.JSON_PROPERTY_NB_PAGES, - BaseSearchResponse.JSON_PROPERTY_NB_SORTED_HITS, - BaseSearchResponse.JSON_PROPERTY_PAGE, - BaseSearchResponse.JSON_PROPERTY_PARAMS, - BaseSearchResponse.JSON_PROPERTY_PARSED_QUERY, - BaseSearchResponse.JSON_PROPERTY_PROCESSING_TIME_M_S, - BaseSearchResponse.JSON_PROPERTY_QUERY, - BaseSearchResponse.JSON_PROPERTY_QUERY_AFTER_REMOVAL, - BaseSearchResponse.JSON_PROPERTY_SERVER_USED, - BaseSearchResponse.JSON_PROPERTY_USER_DATA, - } -) -@JsonTypeName("baseSearchResponse") public class BaseSearchResponse { - public static final String JSON_PROPERTY_AB_TEST_I_D = "abTestID"; + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) private Integer abTestID; - public static final String JSON_PROPERTY_AB_TEST_VARIANT_I_D = + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; - public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng; - public static final String JSON_PROPERTY_AUTOMATIC_RADIUS = "automaticRadius"; + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = + "automaticRadius"; + + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) private String automaticRadius; - public static final String JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT = + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String JSON_PROPERTY_EXHAUSTIVE_NB_HITS = + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; - public static final String JSON_PROPERTY_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) private Boolean exhaustiveTypo; - public static final String JSON_PROPERTY_FACETS = "facets"; + public static final String SERIALIZED_NAME_FACETS = "facets"; + + @SerializedName(SERIALIZED_NAME_FACETS) private Map> facets = null; - public static final String JSON_PROPERTY_FACETS_STATS = "facets_stats"; + public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + + @SerializedName(SERIALIZED_NAME_FACETS_STATS) private Map facetsStats = null; - public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String JSON_PROPERTY_INDEX = "index"; + public static final String SERIALIZED_NAME_INDEX = "index"; + + @SerializedName(SERIALIZED_NAME_INDEX) private String index; - public static final String JSON_PROPERTY_INDEX_USED = "indexUsed"; + public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + + @SerializedName(SERIALIZED_NAME_INDEX_USED) private String indexUsed; - public static final String JSON_PROPERTY_MESSAGE = "message"; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; - public static final String JSON_PROPERTY_NB_HITS = "nbHits"; + public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + + @SerializedName(SERIALIZED_NAME_NB_HITS) private Integer nbHits; - public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; - public static final String JSON_PROPERTY_NB_SORTED_HITS = "nbSortedHits"; + public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) private Integer nbSortedHits; - public static final String JSON_PROPERTY_PAGE = "page"; + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; - public static final String JSON_PROPERTY_PARAMS = "params"; + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; - public static final String JSON_PROPERTY_PARSED_QUERY = "parsedQuery"; + public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) private String parsedQuery; - public static final String JSON_PROPERTY_PROCESSING_TIME_M_S = + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; - public static final String JSON_PROPERTY_QUERY = "query"; + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String JSON_PROPERTY_QUERY_AFTER_REMOVAL = + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; - public static final String JSON_PROPERTY_SERVER_USED = "serverUsed"; + public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + + @SerializedName(SERIALIZED_NAME_SERVER_USED) private String serverUsed; - public static final String JSON_PROPERTY_USER_DATA = "userData"; + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; public BaseSearchResponse abTestID(Integer abTestID) { @@ -146,14 +163,10 @@ public BaseSearchResponse abTestID(Integer abTestID) { value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing" + " A/B test ID." ) - @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestID() { return abTestID; } - @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } @@ -174,14 +187,10 @@ public BaseSearchResponse abTestVariantID(Integer abTestVariantID) { value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the" + " variant ID of the index used." ) - @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestVariantID() { return abTestVariantID; } - @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } @@ -198,14 +207,10 @@ public BaseSearchResponse aroundLatLng(String aroundLatLng) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -226,14 +231,10 @@ public BaseSearchResponse automaticRadius(String automaticRadius) { value = "The automatically computed radius. For legacy reasons, this parameter is a string and" + " not an integer." ) - @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAutomaticRadius() { return automaticRadius; } - @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } @@ -254,14 +255,10 @@ public BaseSearchResponse exhaustiveFacetsCount( @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } @@ -281,14 +278,10 @@ public BaseSearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { required = true, value = "Indicate if the nbHits count was exhaustive or approximate" ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } @@ -310,14 +303,10 @@ public BaseSearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when" + " typo-tolerance is enabled)" ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } @@ -348,14 +337,10 @@ public BaseSearchResponse putFacetsItem( example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts." ) - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getFacets() { return facets; } - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(Map> facets) { this.facets = facets; } @@ -385,14 +370,10 @@ public BaseSearchResponse putFacetsStatsItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") - @JsonProperty(JSON_PROPERTY_FACETS_STATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getFacetsStats() { return facetsStats; } - @JsonProperty(JSON_PROPERTY_FACETS_STATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetsStats( Map facetsStats ) { @@ -411,14 +392,10 @@ public BaseSearchResponse hitsPerPage(Integer hitsPerPage) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getHitsPerPage() { return hitsPerPage; } - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -438,14 +415,10 @@ public BaseSearchResponse index(String index) { example = "indexName", value = "Index name used for the query." ) - @JsonProperty(JSON_PROPERTY_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndex() { return index; } - @JsonProperty(JSON_PROPERTY_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndex(String index) { this.index = index; } @@ -467,14 +440,10 @@ public BaseSearchResponse indexUsed(String indexUsed) { value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t" + " always the index used by the query." ) - @JsonProperty(JSON_PROPERTY_INDEX_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndexUsed() { return indexUsed; } - @JsonProperty(JSON_PROPERTY_INDEX_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } @@ -491,14 +460,10 @@ public BaseSearchResponse message(String message) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } @@ -519,14 +484,10 @@ public BaseSearchResponse nbHits(Integer nbHits) { required = true, value = "Number of hits that the search query matched" ) - @JsonProperty(JSON_PROPERTY_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbHits() { return nbHits; } - @JsonProperty(JSON_PROPERTY_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } @@ -547,14 +508,10 @@ public BaseSearchResponse nbPages(Integer nbPages) { required = true, value = "Number of pages available for the current query" ) - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbPages() { return nbPages; } - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } @@ -574,14 +531,10 @@ public BaseSearchResponse nbSortedHits(Integer nbSortedHits) { example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm" ) - @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbSortedHits() { return nbSortedHits; } - @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } @@ -598,14 +551,10 @@ public BaseSearchResponse page(Integer page) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getPage() { return page; } - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPage(Integer page) { this.page = page; } @@ -626,14 +575,10 @@ public BaseSearchResponse params(String params) { required = true, value = "A url-encoded string of all search parameters." ) - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getParams() { return params; } - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setParams(String params) { this.params = params; } @@ -652,14 +597,10 @@ public BaseSearchResponse parsedQuery(String parsedQuery) { @ApiModelProperty( value = "The query string that will be searched, after normalization." ) - @JsonProperty(JSON_PROPERTY_PARSED_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParsedQuery() { return parsedQuery; } - @JsonProperty(JSON_PROPERTY_PARSED_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } @@ -680,14 +621,10 @@ public BaseSearchResponse processingTimeMS(Integer processingTimeMS) { required = true, value = "Time the server took to process the request, in milliseconds." ) - @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getProcessingTimeMS() { return processingTimeMS; } - @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } @@ -704,14 +641,10 @@ public BaseSearchResponse query(String query) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -732,14 +665,10 @@ public BaseSearchResponse queryAfterRemoval(String queryAfterRemoval) { value = "A markup text indicating which parts of the original query have been removed in order to" + " retrieve a non-empty result set." ) - @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQueryAfterRemoval() { return queryAfterRemoval; } - @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } @@ -758,14 +687,10 @@ public BaseSearchResponse serverUsed(String serverUsed) { @ApiModelProperty( value = "Actual host name of the server that processed the request." ) - @JsonProperty(JSON_PROPERTY_SERVER_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getServerUsed() { return serverUsed; } - @JsonProperty(JSON_PROPERTY_SERVER_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } @@ -790,20 +715,10 @@ public BaseSearchResponse putUserDataItem(String key, Object userDataItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getUserData() { return userData; } - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setUserData(Map userData) { this.userData = userData; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java index 0cad641410..4db1e7113e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -12,35 +12,31 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; /** BaseSearchResponseFacetsStats */ -@JsonPropertyOrder( - { - BaseSearchResponseFacetsStats.JSON_PROPERTY_MIN, - BaseSearchResponseFacetsStats.JSON_PROPERTY_MAX, - BaseSearchResponseFacetsStats.JSON_PROPERTY_AVG, - BaseSearchResponseFacetsStats.JSON_PROPERTY_SUM, - } -) -@JsonTypeName("baseSearchResponse_facets_stats") public class BaseSearchResponseFacetsStats { - public static final String JSON_PROPERTY_MIN = "min"; + public static final String SERIALIZED_NAME_MIN = "min"; + + @SerializedName(SERIALIZED_NAME_MIN) private Integer min; - public static final String JSON_PROPERTY_MAX = "max"; + public static final String SERIALIZED_NAME_MAX = "max"; + + @SerializedName(SERIALIZED_NAME_MAX) private Integer max; - public static final String JSON_PROPERTY_AVG = "avg"; + public static final String SERIALIZED_NAME_AVG = "avg"; + + @SerializedName(SERIALIZED_NAME_AVG) private Integer avg; - public static final String JSON_PROPERTY_SUM = "sum"; + public static final String SERIALIZED_NAME_SUM = "sum"; + + @SerializedName(SERIALIZED_NAME_SUM) private Integer sum; public BaseSearchResponseFacetsStats min(Integer min) { @@ -55,14 +51,10 @@ public BaseSearchResponseFacetsStats min(Integer min) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The minimum value in the result set.") - @JsonProperty(JSON_PROPERTY_MIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMin() { return min; } - @JsonProperty(JSON_PROPERTY_MIN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMin(Integer min) { this.min = min; } @@ -79,14 +71,10 @@ public BaseSearchResponseFacetsStats max(Integer max) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The maximum value in the result set.") - @JsonProperty(JSON_PROPERTY_MAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMax() { return max; } - @JsonProperty(JSON_PROPERTY_MAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMax(Integer max) { this.max = max; } @@ -103,14 +91,10 @@ public BaseSearchResponseFacetsStats avg(Integer avg) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The average facet value in the result set.") - @JsonProperty(JSON_PROPERTY_AVG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAvg() { return avg; } - @JsonProperty(JSON_PROPERTY_AVG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAvg(Integer avg) { this.avg = avg; } @@ -127,14 +111,10 @@ public BaseSearchResponseFacetsStats sum(Integer sum) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The sum of all values in the result set.") - @JsonProperty(JSON_PROPERTY_SUM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getSum() { return sum; } - @JsonProperty(JSON_PROPERTY_SUM) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSum(Integer sum) { this.sum = sum; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 5647309b28..944de19b21 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; @@ -24,11 +21,11 @@ /** The `batch` requests. */ @ApiModel(description = "The `batch` requests.") -@JsonPropertyOrder({ BatchObject.JSON_PROPERTY_REQUESTS }) -@JsonTypeName("batchObject") public class BatchObject { - public static final String JSON_PROPERTY_REQUESTS = "requests"; + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + + @SerializedName(SERIALIZED_NAME_REQUESTS) private List requests = null; public BatchObject requests(List requests) { @@ -51,14 +48,10 @@ public BatchObject addRequestsItem(Operation requestsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRequests() { return requests; } - @JsonProperty(JSON_PROPERTY_REQUESTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRequests(List requests) { this.requests = requests; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index 6d17b08f37..e159080b10 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -12,29 +12,23 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** BatchResponse */ -@JsonPropertyOrder( - { - BatchResponse.JSON_PROPERTY_TASK_I_D, - BatchResponse.JSON_PROPERTY_OBJECT_I_DS, - } -) -@JsonTypeName("batchResponse") public class BatchResponse { - public static final String JSON_PROPERTY_TASK_I_D = "taskID"; + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; - public static final String JSON_PROPERTY_OBJECT_I_DS = "objectIDs"; + public static final String SERIALIZED_NAME_OBJECT_I_DS = "objectIDs"; + + @SerializedName(SERIALIZED_NAME_OBJECT_I_DS) private List objectIDs = null; public BatchResponse taskID(Integer taskID) { @@ -49,14 +43,10 @@ public BatchResponse taskID(Integer taskID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -81,14 +71,10 @@ public BatchResponse addObjectIDsItem(String objectIDsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "List of objectID.") - @JsonProperty(JSON_PROPERTY_OBJECT_I_DS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getObjectIDs() { return objectIDs; } - @JsonProperty(JSON_PROPERTY_OBJECT_I_DS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setObjectIDs(List objectIDs) { this.objectIDs = objectIDs; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index 846417f3ba..2ab2e00bfc 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -12,28 +12,22 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.util.Objects; /** DeleteIndexResponse */ -@JsonPropertyOrder( - { - DeleteIndexResponse.JSON_PROPERTY_TASK_I_D, - DeleteIndexResponse.JSON_PROPERTY_DELETE_AT, - } -) -@JsonTypeName("deleteIndexResponse") public class DeleteIndexResponse { - public static final String JSON_PROPERTY_TASK_I_D = "taskID"; + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; - public static final String JSON_PROPERTY_DELETE_AT = "deleteAt"; + public static final String SERIALIZED_NAME_DELETE_AT = "deleteAt"; + + @SerializedName(SERIALIZED_NAME_DELETE_AT) private OffsetDateTime deleteAt; public DeleteIndexResponse taskID(Integer taskID) { @@ -48,14 +42,10 @@ public DeleteIndexResponse taskID(Integer taskID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -72,14 +62,10 @@ public DeleteIndexResponse deleteAt(OffsetDateTime deleteAt) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of deletion (ISO-8601 format).") - @JsonProperty(JSON_PROPERTY_DELETE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getDeleteAt() { return deleteAt; } - @JsonProperty(JSON_PROPERTY_DELETE_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDeleteAt(OffsetDateTime deleteAt) { this.deleteAt = deleteAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java index dc621fa24d..ff7cef593d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; @@ -23,11 +20,11 @@ /** Error. */ @ApiModel(description = "Error.") -@JsonPropertyOrder({ ErrorBase.JSON_PROPERTY_MESSAGE }) -@JsonTypeName("ErrorBase") public class ErrorBase extends HashMap { - public static final String JSON_PROPERTY_MESSAGE = "message"; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; public ErrorBase message(String message) { @@ -42,14 +39,10 @@ public ErrorBase message(String message) { */ @javax.annotation.Nullable @ApiModelProperty(example = "Invalid Application-Id or API-Key", value = "") - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index 1a92468013..d4b4717b0d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -12,33 +12,27 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** HighlightResult */ -@JsonPropertyOrder( - { - HighlightResult.JSON_PROPERTY_VALUE, - HighlightResult.JSON_PROPERTY_MATCH_LEVEL, - HighlightResult.JSON_PROPERTY_MATCHED_WORDS, - HighlightResult.JSON_PROPERTY_FULLY_HIGHLIGHTED, - } -) -@JsonTypeName("highlightResult") public class HighlightResult { - public static final String JSON_PROPERTY_VALUE = "value"; + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) private String value; /** Indicates how well the attribute matched the search query. */ + @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), @@ -52,7 +46,6 @@ public enum MatchLevelEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -62,7 +55,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static MatchLevelEnum fromValue(String value) { for (MatchLevelEnum b : MatchLevelEnum.values()) { if (b.value.equals(value)) { @@ -71,16 +63,40 @@ public static MatchLevelEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final MatchLevelEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MatchLevelEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return MatchLevelEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_MATCH_LEVEL = "matchLevel"; + public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) private MatchLevelEnum matchLevel; - public static final String JSON_PROPERTY_MATCHED_WORDS = "matchedWords"; + public static final String SERIALIZED_NAME_MATCHED_WORDS = "matchedWords"; + + @SerializedName(SERIALIZED_NAME_MATCHED_WORDS) private List matchedWords = null; - public static final String JSON_PROPERTY_FULLY_HIGHLIGHTED = + public static final String SERIALIZED_NAME_FULLY_HIGHLIGHTED = "fullyHighlighted"; + + @SerializedName(SERIALIZED_NAME_FULLY_HIGHLIGHTED) private Boolean fullyHighlighted; public HighlightResult value(String value) { @@ -98,14 +114,10 @@ public HighlightResult value(String value) { example = "George Clooney", value = "Markup text with occurrences highlighted." ) - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getValue() { return value; } - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValue(String value) { this.value = value; } @@ -124,14 +136,10 @@ public HighlightResult matchLevel(MatchLevelEnum matchLevel) { @ApiModelProperty( value = "Indicates how well the attribute matched the search query." ) - @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public MatchLevelEnum getMatchLevel() { return matchLevel; } - @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } @@ -158,14 +166,10 @@ public HighlightResult addMatchedWordsItem(String matchedWordsItem) { @ApiModelProperty( value = "List of words from the query that matched the object." ) - @JsonProperty(JSON_PROPERTY_MATCHED_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getMatchedWords() { return matchedWords; } - @JsonProperty(JSON_PROPERTY_MATCHED_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchedWords(List matchedWords) { this.matchedWords = matchedWords; } @@ -184,14 +188,10 @@ public HighlightResult fullyHighlighted(Boolean fullyHighlighted) { @ApiModelProperty( value = "Whether the entire attribute value is highlighted." ) - @JsonProperty(JSON_PROPERTY_FULLY_HIGHLIGHTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFullyHighlighted() { return fullyHighlighted; } - @JsonProperty(JSON_PROPERTY_FULLY_HIGHLIGHTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFullyHighlighted(Boolean fullyHighlighted) { this.fullyHighlighted = fullyHighlighted; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index 2f35aaac62..8095d35453 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.util.ArrayList; @@ -23,56 +20,63 @@ import java.util.Objects; /** Index */ -@JsonPropertyOrder( - { - Index.JSON_PROPERTY_NAME, - Index.JSON_PROPERTY_CREATED_AT, - Index.JSON_PROPERTY_UPDATED_AT, - Index.JSON_PROPERTY_ENTRIES, - Index.JSON_PROPERTY_DATA_SIZE, - Index.JSON_PROPERTY_FILE_SIZE, - Index.JSON_PROPERTY_LAST_BUILD_TIME_S, - Index.JSON_PROPERTY_NUMBER_OF_PENDING_TASK, - Index.JSON_PROPERTY_PENDING_TASK, - Index.JSON_PROPERTY_PRIMARY, - Index.JSON_PROPERTY_REPLICAS, - } -) -@JsonTypeName("index") public class Index { - public static final String JSON_PROPERTY_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) private String name; - public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) private OffsetDateTime createdAt; - public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; - public static final String JSON_PROPERTY_ENTRIES = "entries"; + public static final String SERIALIZED_NAME_ENTRIES = "entries"; + + @SerializedName(SERIALIZED_NAME_ENTRIES) private Integer entries; - public static final String JSON_PROPERTY_DATA_SIZE = "dataSize"; + public static final String SERIALIZED_NAME_DATA_SIZE = "dataSize"; + + @SerializedName(SERIALIZED_NAME_DATA_SIZE) private Integer dataSize; - public static final String JSON_PROPERTY_FILE_SIZE = "fileSize"; + public static final String SERIALIZED_NAME_FILE_SIZE = "fileSize"; + + @SerializedName(SERIALIZED_NAME_FILE_SIZE) private Integer fileSize; - public static final String JSON_PROPERTY_LAST_BUILD_TIME_S = "lastBuildTimeS"; + public static final String SERIALIZED_NAME_LAST_BUILD_TIME_S = + "lastBuildTimeS"; + + @SerializedName(SERIALIZED_NAME_LAST_BUILD_TIME_S) private Integer lastBuildTimeS; - public static final String JSON_PROPERTY_NUMBER_OF_PENDING_TASK = + public static final String SERIALIZED_NAME_NUMBER_OF_PENDING_TASK = "numberOfPendingTask"; + + @SerializedName(SERIALIZED_NAME_NUMBER_OF_PENDING_TASK) private Integer numberOfPendingTask; - public static final String JSON_PROPERTY_PENDING_TASK = "pendingTask"; + public static final String SERIALIZED_NAME_PENDING_TASK = "pendingTask"; + + @SerializedName(SERIALIZED_NAME_PENDING_TASK) private Boolean pendingTask; - public static final String JSON_PROPERTY_PRIMARY = "primary"; + public static final String SERIALIZED_NAME_PRIMARY = "primary"; + + @SerializedName(SERIALIZED_NAME_PRIMARY) private String primary; - public static final String JSON_PROPERTY_REPLICAS = "replicas"; + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; public Index name(String name) { @@ -87,14 +91,10 @@ public Index name(String name) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Index name.") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getName() { return name; } - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setName(String name) { this.name = name; } @@ -114,14 +114,10 @@ public Index createdAt(OffsetDateTime createdAt) { required = true, value = "Index creation date. An empty string means that the index has no records." ) - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getCreatedAt() { return createdAt; } - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setCreatedAt(OffsetDateTime createdAt) { this.createdAt = createdAt; } @@ -141,14 +137,10 @@ public Index updatedAt(OffsetDateTime updatedAt) { required = true, value = "Date of last update (ISO-8601 format)." ) - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public OffsetDateTime getUpdatedAt() { return updatedAt; } - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } @@ -168,14 +160,10 @@ public Index entries(Integer entries) { required = true, value = "Number of records contained in the index." ) - @JsonProperty(JSON_PROPERTY_ENTRIES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getEntries() { return entries; } - @JsonProperty(JSON_PROPERTY_ENTRIES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setEntries(Integer entries) { this.entries = entries; } @@ -195,14 +183,10 @@ public Index dataSize(Integer dataSize) { required = true, value = "Number of bytes of the index in minified format." ) - @JsonProperty(JSON_PROPERTY_DATA_SIZE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getDataSize() { return dataSize; } - @JsonProperty(JSON_PROPERTY_DATA_SIZE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setDataSize(Integer dataSize) { this.dataSize = dataSize; } @@ -222,14 +206,10 @@ public Index fileSize(Integer fileSize) { required = true, value = "Number of bytes of the index binary file." ) - @JsonProperty(JSON_PROPERTY_FILE_SIZE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getFileSize() { return fileSize; } - @JsonProperty(JSON_PROPERTY_FILE_SIZE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setFileSize(Integer fileSize) { this.fileSize = fileSize; } @@ -246,14 +226,10 @@ public Index lastBuildTimeS(Integer lastBuildTimeS) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Last build time") - @JsonProperty(JSON_PROPERTY_LAST_BUILD_TIME_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getLastBuildTimeS() { return lastBuildTimeS; } - @JsonProperty(JSON_PROPERTY_LAST_BUILD_TIME_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setLastBuildTimeS(Integer lastBuildTimeS) { this.lastBuildTimeS = lastBuildTimeS; } @@ -272,14 +248,10 @@ public Index numberOfPendingTask(Integer numberOfPendingTask) { @ApiModelProperty( value = "Number of pending indexing operations. This value is deprecated and should not be used." ) - @JsonProperty(JSON_PROPERTY_NUMBER_OF_PENDING_TASK) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNumberOfPendingTask() { return numberOfPendingTask; } - @JsonProperty(JSON_PROPERTY_NUMBER_OF_PENDING_TASK) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumberOfPendingTask(Integer numberOfPendingTask) { this.numberOfPendingTask = numberOfPendingTask; } @@ -301,14 +273,10 @@ public Index pendingTask(Boolean pendingTask) { value = "A boolean which says whether the index has pending tasks. This value is deprecated and" + " should not be used." ) - @JsonProperty(JSON_PROPERTY_PENDING_TASK) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getPendingTask() { return pendingTask; } - @JsonProperty(JSON_PROPERTY_PENDING_TASK) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPendingTask(Boolean pendingTask) { this.pendingTask = pendingTask; } @@ -327,14 +295,10 @@ public Index primary(String primary) { @ApiModelProperty( value = "Only present if the index is a replica. Contains the name of the related primary index." ) - @JsonProperty(JSON_PROPERTY_PRIMARY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPrimary() { return primary; } - @JsonProperty(JSON_PROPERTY_PRIMARY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPrimary(String primary) { this.primary = primary; } @@ -363,14 +327,10 @@ public Index addReplicasItem(String replicasItem) { value = "Only present if the index is a primary index with replicas. Contains the names of all" + " linked replicas." ) - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index cb4bfcb52e..d5f69586d5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -12,14 +12,14 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -28,179 +28,177 @@ /** The Algolia index settings. */ @ApiModel(description = "The Algolia index settings.") -@JsonPropertyOrder( - { - IndexSettings.JSON_PROPERTY_REPLICAS, - IndexSettings.JSON_PROPERTY_PAGINATION_LIMITED_TO, - IndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS, - IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE, - IndexSettings.JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_INDEX_LANGUAGES, - IndexSettings.JSON_PROPERTY_FILTER_PROMOTES, - IndexSettings.JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY, - IndexSettings.JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING, - IndexSettings.JSON_PROPERTY_USER_DATA, - IndexSettings.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, - IndexSettings.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, - IndexSettings.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_RANKING, - IndexSettings.JSON_PROPERTY_CUSTOM_RANKING, - IndexSettings.JSON_PROPERTY_RELEVANCY_STRICTNESS, - IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, - IndexSettings.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, - IndexSettings.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, - IndexSettings.JSON_PROPERTY_HIGHLIGHT_POST_TAG, - IndexSettings.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, - IndexSettings.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, - IndexSettings.JSON_PROPERTY_HITS_PER_PAGE, - IndexSettings.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, - IndexSettings.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, - IndexSettings.JSON_PROPERTY_TYPO_TOLERANCE, - IndexSettings.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, - IndexSettings.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_SEPARATORS_TO_INDEX, - IndexSettings.JSON_PROPERTY_IGNORE_PLURALS, - IndexSettings.JSON_PROPERTY_REMOVE_STOP_WORDS, - IndexSettings.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, - IndexSettings.JSON_PROPERTY_QUERY_LANGUAGES, - IndexSettings.JSON_PROPERTY_DECOMPOUND_QUERY, - IndexSettings.JSON_PROPERTY_ENABLE_RULES, - IndexSettings.JSON_PROPERTY_ENABLE_PERSONALIZATION, - IndexSettings.JSON_PROPERTY_QUERY_TYPE, - IndexSettings.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, - IndexSettings.JSON_PROPERTY_ADVANCED_SYNTAX, - IndexSettings.JSON_PROPERTY_OPTIONAL_WORDS, - IndexSettings.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, - IndexSettings.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, - IndexSettings.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, - IndexSettings.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, - IndexSettings.JSON_PROPERTY_DISTINCT, - IndexSettings.JSON_PROPERTY_SYNONYMS, - IndexSettings.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, - IndexSettings.JSON_PROPERTY_MIN_PROXIMITY, - IndexSettings.JSON_PROPERTY_RESPONSE_FIELDS, - IndexSettings.JSON_PROPERTY_MAX_FACET_HITS, - IndexSettings.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, - IndexSettings.JSON_PROPERTY_RENDERING_CONTENT, - } -) -@JsonTypeName("indexSettings") public class IndexSettings { - public static final String JSON_PROPERTY_REPLICAS = "replicas"; + public static final String SERIALIZED_NAME_REPLICAS = "replicas"; + + @SerializedName(SERIALIZED_NAME_REPLICAS) private List replicas = null; - public static final String JSON_PROPERTY_PAGINATION_LIMITED_TO = + public static final String SERIALIZED_NAME_PAGINATION_LIMITED_TO = "paginationLimitedTo"; + + @SerializedName(SERIALIZED_NAME_PAGINATION_LIMITED_TO) private Integer paginationLimitedTo = 1000; - public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS = + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS = "disableTypoToleranceOnWords"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_WORDS) private List disableTypoToleranceOnWords = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE = "attributesToTransliterate"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_TRANSLITERATE) private List attributesToTransliterate = null; - public static final String JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES = + public static final String SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES = "camelCaseAttributes"; + + @SerializedName(SERIALIZED_NAME_CAMEL_CASE_ATTRIBUTES) private List camelCaseAttributes = null; - public static final String JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES = + public static final String SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES = "decompoundedAttributes"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUNDED_ATTRIBUTES) private Map decompoundedAttributes = null; - public static final String JSON_PROPERTY_INDEX_LANGUAGES = "indexLanguages"; + public static final String SERIALIZED_NAME_INDEX_LANGUAGES = "indexLanguages"; + + @SerializedName(SERIALIZED_NAME_INDEX_LANGUAGES) private List indexLanguages = null; - public static final String JSON_PROPERTY_FILTER_PROMOTES = "filterPromotes"; + public static final String SERIALIZED_NAME_FILTER_PROMOTES = "filterPromotes"; + + @SerializedName(SERIALIZED_NAME_FILTER_PROMOTES) private Boolean filterPromotes = false; - public static final String JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES = "disablePrefixOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_PREFIX_ON_ATTRIBUTES) private List disablePrefixOnAttributes = null; - public static final String JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = + public static final String SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY = "allowCompressionOfIntegerArray"; + + @SerializedName(SERIALIZED_NAME_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) private Boolean allowCompressionOfIntegerArray = false; - public static final String JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING = + public static final String SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING = "numericAttributesForFiltering"; + + @SerializedName(SERIALIZED_NAME_NUMERIC_ATTRIBUTES_FOR_FILTERING) private List numericAttributesForFiltering = null; - public static final String JSON_PROPERTY_USER_DATA = "userData"; + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; - public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String JSON_PROPERTY_RANKING = "ranking"; + public static final String SERIALIZED_NAME_RANKING = "ranking"; + + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; - public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** Controls whether typo tolerance is enabled and how it is applied. */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -216,7 +214,6 @@ public enum TypoToleranceEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -226,7 +223,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -235,48 +231,90 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; - public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** Controls if and how query words are interpreted as prefixes. */ + @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -290,7 +328,6 @@ public enum QueryTypeEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -300,7 +337,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -309,12 +345,33 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -330,7 +387,6 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -340,7 +396,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -349,24 +404,52 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; - public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** Controls how the exact ranking criterion is computed when the query contains only one word. */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -380,7 +463,6 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -390,7 +472,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -399,14 +480,36 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** Gets or Sets alternativesAsExact */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -420,7 +523,6 @@ public enum AlternativesAsExactEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -430,7 +532,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -439,13 +540,34 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** Gets or Sets advancedSyntaxFeatures */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -457,7 +579,6 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -467,7 +588,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -476,37 +596,74 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String JSON_PROPERTY_DISTINCT = "distinct"; + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; - public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; - public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; - public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String JSON_PROPERTY_RENDERING_CONTENT = + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public IndexSettings replicas(List replicas) { @@ -529,14 +686,10 @@ public IndexSettings addReplicasItem(String replicasItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Creates replicas, exact copies of an index.") - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getReplicas() { return replicas; } - @JsonProperty(JSON_PROPERTY_REPLICAS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplicas(List replicas) { this.replicas = replicas; } @@ -555,14 +708,10 @@ public IndexSettings paginationLimitedTo(Integer paginationLimitedTo) { @ApiModelProperty( value = "Set the maximum number of hits accessible via pagination." ) - @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPaginationLimitedTo() { return paginationLimitedTo; } - @JsonProperty(JSON_PROPERTY_PAGINATION_LIMITED_TO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPaginationLimitedTo(Integer paginationLimitedTo) { this.paginationLimitedTo = paginationLimitedTo; } @@ -593,14 +742,10 @@ public IndexSettings addDisableTypoToleranceOnWordsItem( @ApiModelProperty( value = "A list of words for which you want to turn off typo tolerance." ) - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnWords() { return disableTypoToleranceOnWords; } - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnWords( List disableTypoToleranceOnWords ) { @@ -633,14 +778,10 @@ public IndexSettings addAttributesToTransliterateItem( @ApiModelProperty( value = "Specify on which attributes to apply transliteration." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToTransliterate() { return attributesToTransliterate; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_TRANSLITERATE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToTransliterate( List attributesToTransliterate ) { @@ -671,14 +812,10 @@ public IndexSettings addCamelCaseAttributesItem( @ApiModelProperty( value = "List of attributes on which to do a decomposition of camel case words." ) - @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCamelCaseAttributes() { return camelCaseAttributes; } - @JsonProperty(JSON_PROPERTY_CAMEL_CASE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCamelCaseAttributes(List camelCaseAttributes) { this.camelCaseAttributes = camelCaseAttributes; } @@ -712,20 +849,10 @@ public IndexSettings putDecompoundedAttributesItem( value = "Specify on which attributes in your index Algolia should apply word segmentation, also" + " known as decompounding." ) - @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getDecompoundedAttributes() { return decompoundedAttributes; } - @JsonProperty(JSON_PROPERTY_DECOMPOUNDED_ATTRIBUTES) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setDecompoundedAttributes( Map decompoundedAttributes ) { @@ -756,14 +883,10 @@ public IndexSettings addIndexLanguagesItem(String indexLanguagesItem) { value = "Sets the languages at the index level for language-specific processing such as" + " tokenization and normalization." ) - @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getIndexLanguages() { return indexLanguages; } - @JsonProperty(JSON_PROPERTY_INDEX_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexLanguages(List indexLanguages) { this.indexLanguages = indexLanguages; } @@ -784,14 +907,10 @@ public IndexSettings filterPromotes(Boolean filterPromotes) { value = "Whether promoted results should match the filters of the current search, except for" + " geographic filters." ) - @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFilterPromotes() { return filterPromotes; } - @JsonProperty(JSON_PROPERTY_FILTER_PROMOTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilterPromotes(Boolean filterPromotes) { this.filterPromotes = filterPromotes; } @@ -822,14 +941,10 @@ public IndexSettings addDisablePrefixOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable prefix matching." ) - @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisablePrefixOnAttributes() { return disablePrefixOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_PREFIX_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisablePrefixOnAttributes( List disablePrefixOnAttributes ) { @@ -850,14 +965,10 @@ public IndexSettings allowCompressionOfIntegerArray( */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables compression of large integer arrays.") - @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowCompressionOfIntegerArray() { return allowCompressionOfIntegerArray; } - @JsonProperty(JSON_PROPERTY_ALLOW_COMPRESSION_OF_INTEGER_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowCompressionOfIntegerArray( Boolean allowCompressionOfIntegerArray ) { @@ -890,14 +1001,10 @@ public IndexSettings addNumericAttributesForFilteringItem( @ApiModelProperty( value = "List of numeric attributes that can be used as numerical filters." ) - @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericAttributesForFiltering() { return numericAttributesForFiltering; } - @JsonProperty(JSON_PROPERTY_NUMERIC_ATTRIBUTES_FOR_FILTERING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericAttributesForFiltering( List numericAttributesForFiltering ) { @@ -924,20 +1031,10 @@ public IndexSettings putUserDataItem(String key, Object userDataItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getUserData() { return userData; } - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setUserData(Map userData) { this.userData = userData; } @@ -966,14 +1063,10 @@ public IndexSettings addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -1004,14 +1097,10 @@ public IndexSettings addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -1042,14 +1131,10 @@ public IndexSettings addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -1078,14 +1163,10 @@ public IndexSettings addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -1116,14 +1197,10 @@ public IndexSettings addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -1150,14 +1227,10 @@ public IndexSettings addRankingItem(String rankingItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -1182,14 +1255,10 @@ public IndexSettings addCustomRankingItem(String customRankingItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -1210,14 +1279,10 @@ public IndexSettings relevancyStrictness(Integer relevancyStrictness) { value = "Controls the relevancy threshold below which less relevant results aren’t included in" + " the results." ) - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -1246,14 +1311,10 @@ public IndexSettings addAttributesToHighlightItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -1282,14 +1343,10 @@ public IndexSettings addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -1309,14 +1366,10 @@ public IndexSettings highlightPreTag(String highlightPreTag) { value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -1336,14 +1389,10 @@ public IndexSettings highlightPostTag(String highlightPostTag) { value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -1362,14 +1411,10 @@ public IndexSettings snippetEllipsisText(String snippetEllipsisText) { @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -1390,14 +1435,10 @@ public IndexSettings restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -1416,14 +1457,10 @@ public IndexSettings hitsPerPage(Integer hitsPerPage) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -1444,14 +1481,10 @@ public IndexSettings minWordSizefor1Typo(Integer minWordSizefor1Typo) { value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 1 typo." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -1472,14 +1505,10 @@ public IndexSettings minWordSizefor2Typos(Integer minWordSizefor2Typos) { value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 2 typos." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -1498,14 +1527,10 @@ public IndexSettings typoTolerance(TypoToleranceEnum typoTolerance) { @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -1526,14 +1551,10 @@ public IndexSettings allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -1566,14 +1587,10 @@ public IndexSettings addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -1592,14 +1609,10 @@ public IndexSettings separatorsToIndex(String separatorsToIndex) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -1618,14 +1631,10 @@ public IndexSettings ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -1644,14 +1653,10 @@ public IndexSettings removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -1672,14 +1677,10 @@ public IndexSettings keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -1708,14 +1709,10 @@ public IndexSettings addQueryLanguagesItem(String queryLanguagesItem) { value = "Sets the languages to be used by language-specific settings and functionalities such as" + " ignorePlurals, removeStopWords, and CJK word-detection." ) - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -1734,14 +1731,10 @@ public IndexSettings decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -1758,14 +1751,10 @@ public IndexSettings enableRules(Boolean enableRules) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -1782,14 +1771,10 @@ public IndexSettings enablePersonalization(Boolean enablePersonalization) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -1808,14 +1793,10 @@ public IndexSettings queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -1836,14 +1817,10 @@ public IndexSettings removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -1862,14 +1839,10 @@ public IndexSettings advancedSyntax(Boolean advancedSyntax) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -1896,14 +1869,10 @@ public IndexSettings addOptionalWordsItem(String optionalWordsItem) { @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -1934,14 +1903,10 @@ public IndexSettings addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -1965,14 +1930,10 @@ public IndexSettings exactOnSingleWordQuery( value = "Controls how the exact ranking criterion is computed when the query contains only one" + " word." ) - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -2006,14 +1967,10 @@ public IndexSettings addAlternativesAsExactItem( value = "List of alternatives that should be considered an exact match by the exact ranking" + " criterion." ) - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -2048,14 +2005,10 @@ public IndexSettings addAdvancedSyntaxFeaturesItem( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + " enabled." ) - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -2074,14 +2027,10 @@ public IndexSettings distinct(Integer distinct) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -2100,14 +2049,10 @@ public IndexSettings synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -2130,14 +2075,10 @@ public IndexSettings replaceSynonymsInHighlight( value = "Whether to highlight and snippet the original word that matches the synonym or the" + " synonym itself." ) - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -2156,14 +2097,10 @@ public IndexSettings minProximity(Integer minProximity) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -2192,14 +2129,10 @@ public IndexSettings addResponseFieldsItem(String responseFieldsItem) { value = "Choose which fields to return in the API response. This parameters applies to search and" + " browse queries." ) - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -2218,14 +2151,10 @@ public IndexSettings maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -2249,14 +2178,10 @@ public IndexSettings attributeCriteriaComputedByMinProximity( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + " select which searchable attribute is matched in the attribute ranking stage." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -2280,14 +2205,10 @@ public IndexSettings renderingContent(Object renderingContent) { value = "Content defining how the search interface should be rendered. Can be set via the" + " settings for a default value and can be overridden via rules." ) - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index 3b0239b29f..e816b78ae3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -12,135 +12,121 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** IndexSettingsAsSearchParams */ -@JsonPropertyOrder( - { - IndexSettingsAsSearchParams.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, - IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, - IndexSettingsAsSearchParams.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, - IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, - IndexSettingsAsSearchParams.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, - IndexSettingsAsSearchParams.JSON_PROPERTY_RANKING, - IndexSettingsAsSearchParams.JSON_PROPERTY_CUSTOM_RANKING, - IndexSettingsAsSearchParams.JSON_PROPERTY_RELEVANCY_STRICTNESS, - IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, - IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, - IndexSettingsAsSearchParams.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, - IndexSettingsAsSearchParams.JSON_PROPERTY_HIGHLIGHT_POST_TAG, - IndexSettingsAsSearchParams.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, - IndexSettingsAsSearchParams.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, - IndexSettingsAsSearchParams.JSON_PROPERTY_HITS_PER_PAGE, - IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, - IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, - IndexSettingsAsSearchParams.JSON_PROPERTY_TYPO_TOLERANCE, - IndexSettingsAsSearchParams.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, - IndexSettingsAsSearchParams.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, - IndexSettingsAsSearchParams.JSON_PROPERTY_SEPARATORS_TO_INDEX, - IndexSettingsAsSearchParams.JSON_PROPERTY_IGNORE_PLURALS, - IndexSettingsAsSearchParams.JSON_PROPERTY_REMOVE_STOP_WORDS, - IndexSettingsAsSearchParams.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, - IndexSettingsAsSearchParams.JSON_PROPERTY_QUERY_LANGUAGES, - IndexSettingsAsSearchParams.JSON_PROPERTY_DECOMPOUND_QUERY, - IndexSettingsAsSearchParams.JSON_PROPERTY_ENABLE_RULES, - IndexSettingsAsSearchParams.JSON_PROPERTY_ENABLE_PERSONALIZATION, - IndexSettingsAsSearchParams.JSON_PROPERTY_QUERY_TYPE, - IndexSettingsAsSearchParams.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, - IndexSettingsAsSearchParams.JSON_PROPERTY_ADVANCED_SYNTAX, - IndexSettingsAsSearchParams.JSON_PROPERTY_OPTIONAL_WORDS, - IndexSettingsAsSearchParams.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, - IndexSettingsAsSearchParams.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, - IndexSettingsAsSearchParams.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, - IndexSettingsAsSearchParams.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, - IndexSettingsAsSearchParams.JSON_PROPERTY_DISTINCT, - IndexSettingsAsSearchParams.JSON_PROPERTY_SYNONYMS, - IndexSettingsAsSearchParams.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, - IndexSettingsAsSearchParams.JSON_PROPERTY_MIN_PROXIMITY, - IndexSettingsAsSearchParams.JSON_PROPERTY_RESPONSE_FIELDS, - IndexSettingsAsSearchParams.JSON_PROPERTY_MAX_FACET_HITS, - IndexSettingsAsSearchParams.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, - IndexSettingsAsSearchParams.JSON_PROPERTY_RENDERING_CONTENT, - } -) -@JsonTypeName("indexSettingsAsSearchParams") public class IndexSettingsAsSearchParams { - public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String JSON_PROPERTY_RANKING = "ranking"; + public static final String SERIALIZED_NAME_RANKING = "ranking"; + + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; - public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** Controls whether typo tolerance is enabled and how it is applied. */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -156,7 +142,6 @@ public enum TypoToleranceEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -166,7 +151,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -175,48 +159,90 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; - public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** Controls if and how query words are interpreted as prefixes. */ + @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -230,7 +256,6 @@ public enum QueryTypeEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -240,7 +265,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -249,12 +273,33 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -270,7 +315,6 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -280,7 +324,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -289,24 +332,52 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; - public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** Controls how the exact ranking criterion is computed when the query contains only one word. */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -320,7 +391,6 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -330,7 +400,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -339,14 +408,36 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** Gets or Sets alternativesAsExact */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -360,7 +451,6 @@ public enum AlternativesAsExactEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -370,7 +460,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -379,13 +468,34 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** Gets or Sets advancedSyntaxFeatures */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -397,7 +507,6 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -407,7 +516,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -416,37 +524,74 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String JSON_PROPERTY_DISTINCT = "distinct"; + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; - public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; - public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; - public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String JSON_PROPERTY_RENDERING_CONTENT = + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public IndexSettingsAsSearchParams searchableAttributes( @@ -475,14 +620,10 @@ public IndexSettingsAsSearchParams addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -513,14 +654,10 @@ public IndexSettingsAsSearchParams addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -551,14 +688,10 @@ public IndexSettingsAsSearchParams addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -589,14 +722,10 @@ public IndexSettingsAsSearchParams addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -627,14 +756,10 @@ public IndexSettingsAsSearchParams addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -661,14 +786,10 @@ public IndexSettingsAsSearchParams addRankingItem(String rankingItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -695,14 +816,10 @@ public IndexSettingsAsSearchParams addCustomRankingItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -725,14 +842,10 @@ public IndexSettingsAsSearchParams relevancyStrictness( value = "Controls the relevancy threshold below which less relevant results aren’t included in" + " the results." ) - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -761,14 +874,10 @@ public IndexSettingsAsSearchParams addAttributesToHighlightItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -799,14 +908,10 @@ public IndexSettingsAsSearchParams addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -826,14 +931,10 @@ public IndexSettingsAsSearchParams highlightPreTag(String highlightPreTag) { value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -853,14 +954,10 @@ public IndexSettingsAsSearchParams highlightPostTag(String highlightPostTag) { value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -881,14 +978,10 @@ public IndexSettingsAsSearchParams snippetEllipsisText( @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -909,14 +1002,10 @@ public IndexSettingsAsSearchParams restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -935,14 +1024,10 @@ public IndexSettingsAsSearchParams hitsPerPage(Integer hitsPerPage) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -965,14 +1050,10 @@ public IndexSettingsAsSearchParams minWordSizefor1Typo( value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 1 typo." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -995,14 +1076,10 @@ public IndexSettingsAsSearchParams minWordSizefor2Typos( value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 2 typos." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -1023,14 +1100,10 @@ public IndexSettingsAsSearchParams typoTolerance( @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -1051,14 +1124,10 @@ public IndexSettingsAsSearchParams allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -1091,14 +1160,10 @@ public IndexSettingsAsSearchParams addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -1119,14 +1184,10 @@ public IndexSettingsAsSearchParams separatorsToIndex( */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -1145,14 +1206,10 @@ public IndexSettingsAsSearchParams ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -1171,14 +1228,10 @@ public IndexSettingsAsSearchParams removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -1199,14 +1252,10 @@ public IndexSettingsAsSearchParams keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -1239,14 +1288,10 @@ public IndexSettingsAsSearchParams addQueryLanguagesItem( value = "Sets the languages to be used by language-specific settings and functionalities such as" + " ignorePlurals, removeStopWords, and CJK word-detection." ) - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -1265,14 +1310,10 @@ public IndexSettingsAsSearchParams decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -1289,14 +1330,10 @@ public IndexSettingsAsSearchParams enableRules(Boolean enableRules) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -1315,14 +1352,10 @@ public IndexSettingsAsSearchParams enablePersonalization( */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -1341,14 +1374,10 @@ public IndexSettingsAsSearchParams queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -1369,14 +1398,10 @@ public IndexSettingsAsSearchParams removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -1395,14 +1420,10 @@ public IndexSettingsAsSearchParams advancedSyntax(Boolean advancedSyntax) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -1431,14 +1452,10 @@ public IndexSettingsAsSearchParams addOptionalWordsItem( @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -1469,14 +1486,10 @@ public IndexSettingsAsSearchParams addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -1500,14 +1513,10 @@ public IndexSettingsAsSearchParams exactOnSingleWordQuery( value = "Controls how the exact ranking criterion is computed when the query contains only one" + " word." ) - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -1541,14 +1550,10 @@ public IndexSettingsAsSearchParams addAlternativesAsExactItem( value = "List of alternatives that should be considered an exact match by the exact ranking" + " criterion." ) - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -1583,14 +1588,10 @@ public IndexSettingsAsSearchParams addAdvancedSyntaxFeaturesItem( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + " enabled." ) - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -1609,14 +1610,10 @@ public IndexSettingsAsSearchParams distinct(Integer distinct) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -1635,14 +1632,10 @@ public IndexSettingsAsSearchParams synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -1665,14 +1658,10 @@ public IndexSettingsAsSearchParams replaceSynonymsInHighlight( value = "Whether to highlight and snippet the original word that matches the synonym or the" + " synonym itself." ) - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -1691,14 +1680,10 @@ public IndexSettingsAsSearchParams minProximity(Integer minProximity) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -1731,14 +1716,10 @@ public IndexSettingsAsSearchParams addResponseFieldsItem( value = "Choose which fields to return in the API response. This parameters applies to search and" + " browse queries." ) - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -1757,14 +1738,10 @@ public IndexSettingsAsSearchParams maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -1788,14 +1765,10 @@ public IndexSettingsAsSearchParams attributeCriteriaComputedByMinProximity( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + " select which searchable attribute is matched in the attribute ranking stage." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -1819,14 +1792,10 @@ public IndexSettingsAsSearchParams renderingContent(Object renderingContent) { value = "Content defining how the search interface should be rendered. Can be set via the" + " settings for a default value and can be overridden via rules." ) - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index 98b642cca7..5cd95e3d43 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -12,29 +12,23 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** ListIndicesResponse */ -@JsonPropertyOrder( - { - ListIndicesResponse.JSON_PROPERTY_ITEMS, - ListIndicesResponse.JSON_PROPERTY_NB_PAGES, - } -) -@JsonTypeName("listIndicesResponse") public class ListIndicesResponse { - public static final String JSON_PROPERTY_ITEMS = "items"; + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) private List items = null; - public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; public ListIndicesResponse items(List items) { @@ -57,14 +51,10 @@ public ListIndicesResponse addItemsItem(Index itemsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "List of the fetched indices.") - @JsonProperty(JSON_PROPERTY_ITEMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getItems() { return items; } - @JsonProperty(JSON_PROPERTY_ITEMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setItems(List items) { this.items = items; } @@ -81,14 +71,10 @@ public ListIndicesResponse nbPages(Integer nbPages) { */ @javax.annotation.Nullable @ApiModelProperty(example = "100", value = "Number of pages.") - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbPages() { return nbPages; } - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java index ba993e0c9c..e68727912e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -12,38 +12,33 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.Objects; /** MultipleQueries */ -@JsonPropertyOrder( - { - MultipleQueries.JSON_PROPERTY_INDEX_NAME, - MultipleQueries.JSON_PROPERTY_QUERY, - MultipleQueries.JSON_PROPERTY_TYPE, - MultipleQueries.JSON_PROPERTY_FACET, - MultipleQueries.JSON_PROPERTY_PARAMS, - } -) -@JsonTypeName("multipleQueries") public class MultipleQueries { - public static final String JSON_PROPERTY_INDEX_NAME = "indexName"; + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + + @SerializedName(SERIALIZED_NAME_INDEX_NAME) private String indexName; - public static final String JSON_PROPERTY_QUERY = "query"; + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; /** * Perform a search query with `default`, will search for facet values if * `facet` is given. */ + @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DEFAULT("default"), @@ -55,7 +50,6 @@ public enum TypeEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -65,7 +59,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { @@ -74,15 +67,38 @@ public static TypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_TYPE = "type"; + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) private TypeEnum type = TypeEnum.DEFAULT; - public static final String JSON_PROPERTY_FACET = "facet"; + public static final String SERIALIZED_NAME_FACET = "facet"; + + @SerializedName(SERIALIZED_NAME_FACET) private String facet; - public static final String JSON_PROPERTY_PARAMS = "params"; + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; public MultipleQueries indexName(String indexName) { @@ -101,14 +117,10 @@ public MultipleQueries indexName(String indexName) { required = true, value = "The Algolia index name." ) - @JsonProperty(JSON_PROPERTY_INDEX_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getIndexName() { return indexName; } - @JsonProperty(JSON_PROPERTY_INDEX_NAME) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setIndexName(String indexName) { this.indexName = indexName; } @@ -125,14 +137,10 @@ public MultipleQueries query(String query) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The text to search in the index.") - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQuery() { return query; } - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQuery(String query) { this.query = query; } @@ -153,14 +161,10 @@ public MultipleQueries type(TypeEnum type) { value = "Perform a search query with `default`, will search for facet values if `facet` is" + " given." ) - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypeEnum getType() { return type; } - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setType(TypeEnum type) { this.type = type; } @@ -177,14 +181,10 @@ public MultipleQueries facet(String facet) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The `facet` name.") - @JsonProperty(JSON_PROPERTY_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFacet() { return facet; } - @JsonProperty(JSON_PROPERTY_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacet(String facet) { this.facet = facet; } @@ -201,14 +201,10 @@ public MultipleQueries params(String params) { */ @javax.annotation.Nullable @ApiModelProperty(value = "A query string of search parameters.") - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParams() { return params; } - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParams(String params) { this.params = params; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index 49ea4ee370..0de00f9c8a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -12,31 +12,27 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** MultipleQueriesObject */ -@JsonPropertyOrder( - { - MultipleQueriesObject.JSON_PROPERTY_REQUESTS, - MultipleQueriesObject.JSON_PROPERTY_STRATEGY, - } -) -@JsonTypeName("multipleQueriesObject") public class MultipleQueriesObject { - public static final String JSON_PROPERTY_REQUESTS = "requests"; + public static final String SERIALIZED_NAME_REQUESTS = "requests"; + + @SerializedName(SERIALIZED_NAME_REQUESTS) private List requests = new ArrayList<>(); /** Gets or Sets strategy */ + @JsonAdapter(StrategyEnum.Adapter.class) public enum StrategyEnum { NONE("none"), @@ -48,7 +44,6 @@ public enum StrategyEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -58,7 +53,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static StrategyEnum fromValue(String value) { for (StrategyEnum b : StrategyEnum.values()) { if (b.value.equals(value)) { @@ -67,9 +61,28 @@ public static StrategyEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final StrategyEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StrategyEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StrategyEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_STRATEGY = "strategy"; + public static final String SERIALIZED_NAME_STRATEGY = "strategy"; + + @SerializedName(SERIALIZED_NAME_STRATEGY) private StrategyEnum strategy; public MultipleQueriesObject requests(List requests) { @@ -89,14 +102,10 @@ public MultipleQueriesObject addRequestsItem(MultipleQueries requestsItem) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_REQUESTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getRequests() { return requests; } - @JsonProperty(JSON_PROPERTY_REQUESTS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setRequests(List requests) { this.requests = requests; } @@ -113,14 +122,10 @@ public MultipleQueriesObject strategy(StrategyEnum strategy) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_STRATEGY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public StrategyEnum getStrategy() { return strategy; } - @JsonProperty(JSON_PROPERTY_STRATEGY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setStrategy(StrategyEnum strategy) { this.strategy = strategy; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index 6024d120ed..8f25a633d0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -12,21 +12,18 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** MultipleQueriesResponse */ -@JsonPropertyOrder({ MultipleQueriesResponse.JSON_PROPERTY_RESULTS }) -@JsonTypeName("multipleQueriesResponse") public class MultipleQueriesResponse { - public static final String JSON_PROPERTY_RESULTS = "results"; + public static final String SERIALIZED_NAME_RESULTS = "results"; + + @SerializedName(SERIALIZED_NAME_RESULTS) private List results = null; public MultipleQueriesResponse results(List results) { @@ -49,14 +46,10 @@ public MultipleQueriesResponse addResultsItem(SearchResponse resultsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResults() { return results; } - @JsonProperty(JSON_PROPERTY_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResults(List results) { this.results = results; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index 862a60d1ca..6beec65203 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -12,25 +12,22 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** Operation */ -@JsonPropertyOrder( - { Operation.JSON_PROPERTY_ACTION, Operation.JSON_PROPERTY_BODY } -) -@JsonTypeName("operation") public class Operation { /** type of operation. */ + @JsonAdapter(ActionEnum.Adapter.class) public enum ActionEnum { ADDOBJECT("addObject"), @@ -52,7 +49,6 @@ public enum ActionEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -62,7 +58,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static ActionEnum fromValue(String value) { for (ActionEnum b : ActionEnum.values()) { if (b.value.equals(value)) { @@ -71,12 +66,33 @@ public static ActionEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ActionEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ACTION = "action"; + public static final String SERIALIZED_NAME_ACTION = "action"; + + @SerializedName(SERIALIZED_NAME_ACTION) private ActionEnum action; - public static final String JSON_PROPERTY_BODY = "body"; + public static final String SERIALIZED_NAME_BODY = "body"; + + @SerializedName(SERIALIZED_NAME_BODY) private Map body = null; public Operation action(ActionEnum action) { @@ -91,14 +107,10 @@ public Operation action(ActionEnum action) { */ @javax.annotation.Nullable @ApiModelProperty(value = "type of operation.") - @JsonProperty(JSON_PROPERTY_ACTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ActionEnum getAction() { return action; } - @JsonProperty(JSON_PROPERTY_ACTION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAction(ActionEnum action) { this.action = action; } @@ -125,20 +137,10 @@ public Operation putBodyItem(String key, Object bodyItem) { @ApiModelProperty( value = "arguments to the operation (depends on the type of the operation)." ) - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getBody() { return body; } - @JsonProperty(JSON_PROPERTY_BODY) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setBody(Map body) { this.body = body; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index d1212fd16f..9cb2eec001 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -12,29 +12,22 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** OperationIndexObject */ -@JsonPropertyOrder( - { - OperationIndexObject.JSON_PROPERTY_OPERATION, - OperationIndexObject.JSON_PROPERTY_DESTINATION, - OperationIndexObject.JSON_PROPERTY_SCOPE, - } -) -@JsonTypeName("operationIndexObject") public class OperationIndexObject { /** Type of operation to perform (move or copy). */ + @JsonAdapter(OperationEnum.Adapter.class) public enum OperationEnum { MOVE("move"), @@ -46,7 +39,6 @@ public enum OperationEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -56,7 +48,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static OperationEnum fromValue(String value) { for (OperationEnum b : OperationEnum.values()) { if (b.value.equals(value)) { @@ -65,15 +56,38 @@ public static OperationEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final OperationEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public OperationEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return OperationEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_OPERATION = "operation"; + public static final String SERIALIZED_NAME_OPERATION = "operation"; + + @SerializedName(SERIALIZED_NAME_OPERATION) private OperationEnum operation; - public static final String JSON_PROPERTY_DESTINATION = "destination"; + public static final String SERIALIZED_NAME_DESTINATION = "destination"; + + @SerializedName(SERIALIZED_NAME_DESTINATION) private String destination; /** Gets or Sets scope */ + @JsonAdapter(ScopeEnum.Adapter.class) public enum ScopeEnum { SETTINGS("settings"), @@ -87,7 +101,6 @@ public enum ScopeEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -97,7 +110,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static ScopeEnum fromValue(String value) { for (ScopeEnum b : ScopeEnum.values()) { if (b.value.equals(value)) { @@ -106,9 +118,28 @@ public static ScopeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ScopeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ScopeEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_SCOPE = "scope"; + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) private List scope = null; public OperationIndexObject operation(OperationEnum operation) { @@ -126,14 +157,10 @@ public OperationIndexObject operation(OperationEnum operation) { required = true, value = "Type of operation to perform (move or copy)." ) - @JsonProperty(JSON_PROPERTY_OPERATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public OperationEnum getOperation() { return operation; } - @JsonProperty(JSON_PROPERTY_OPERATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setOperation(OperationEnum operation) { this.operation = operation; } @@ -154,14 +181,10 @@ public OperationIndexObject destination(String destination) { required = true, value = "The Algolia index name." ) - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getDestination() { return destination; } - @JsonProperty(JSON_PROPERTY_DESTINATION) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setDestination(String destination) { this.destination = destination; } @@ -190,14 +213,10 @@ public OperationIndexObject addScopeItem(ScopeEnum scopeItem) { value = "Scope of the data to copy. When absent, a full copy is performed. When present, only the" + " selected scopes are copied." ) - @JsonProperty(JSON_PROPERTY_SCOPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getScope() { return scope; } - @JsonProperty(JSON_PROPERTY_SCOPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setScope(List scope) { this.scope = scope; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index c6927afbd9..13eedb8195 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -12,28 +12,22 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.util.Objects; /** OperationIndexResponse */ -@JsonPropertyOrder( - { - OperationIndexResponse.JSON_PROPERTY_TASK_I_D, - OperationIndexResponse.JSON_PROPERTY_UPDATED_AT, - } -) -@JsonTypeName("operationIndexResponse") public class OperationIndexResponse { - public static final String JSON_PROPERTY_TASK_I_D = "taskID"; + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; - public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; public OperationIndexResponse taskID(Integer taskID) { @@ -48,14 +42,10 @@ public OperationIndexResponse taskID(Integer taskID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -72,14 +62,10 @@ public OperationIndexResponse updatedAt(OffsetDateTime updatedAt) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getUpdatedAt() { return updatedAt; } - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index 121c849621..0aad4857c1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -12,68 +12,71 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** RankingInfo */ -@JsonPropertyOrder( - { - RankingInfo.JSON_PROPERTY_FILTERS, - RankingInfo.JSON_PROPERTY_FIRST_MATCHED_WORD, - RankingInfo.JSON_PROPERTY_GEO_DISTANCE, - RankingInfo.JSON_PROPERTY_GEO_PRECISION, - RankingInfo.JSON_PROPERTY_MATCHED_GEO_LOCATION, - RankingInfo.JSON_PROPERTY_NB_EXACT_WORDS, - RankingInfo.JSON_PROPERTY_NB_TYPOS, - RankingInfo.JSON_PROPERTY_PROMOTED, - RankingInfo.JSON_PROPERTY_PROXIMITY_DISTANCE, - RankingInfo.JSON_PROPERTY_USER_SCORE, - RankingInfo.JSON_PROPERTY_WORD, - } -) -@JsonTypeName("rankingInfo") public class RankingInfo { - public static final String JSON_PROPERTY_FILTERS = "filters"; + public static final String SERIALIZED_NAME_FILTERS = "filters"; + + @SerializedName(SERIALIZED_NAME_FILTERS) private Integer filters; - public static final String JSON_PROPERTY_FIRST_MATCHED_WORD = + public static final String SERIALIZED_NAME_FIRST_MATCHED_WORD = "firstMatchedWord"; + + @SerializedName(SERIALIZED_NAME_FIRST_MATCHED_WORD) private Integer firstMatchedWord; - public static final String JSON_PROPERTY_GEO_DISTANCE = "geoDistance"; + public static final String SERIALIZED_NAME_GEO_DISTANCE = "geoDistance"; + + @SerializedName(SERIALIZED_NAME_GEO_DISTANCE) private Integer geoDistance; - public static final String JSON_PROPERTY_GEO_PRECISION = "geoPrecision"; + public static final String SERIALIZED_NAME_GEO_PRECISION = "geoPrecision"; + + @SerializedName(SERIALIZED_NAME_GEO_PRECISION) private Integer geoPrecision; - public static final String JSON_PROPERTY_MATCHED_GEO_LOCATION = + public static final String SERIALIZED_NAME_MATCHED_GEO_LOCATION = "matchedGeoLocation"; + + @SerializedName(SERIALIZED_NAME_MATCHED_GEO_LOCATION) private Map matchedGeoLocation = null; - public static final String JSON_PROPERTY_NB_EXACT_WORDS = "nbExactWords"; + public static final String SERIALIZED_NAME_NB_EXACT_WORDS = "nbExactWords"; + + @SerializedName(SERIALIZED_NAME_NB_EXACT_WORDS) private Integer nbExactWords; - public static final String JSON_PROPERTY_NB_TYPOS = "nbTypos"; + public static final String SERIALIZED_NAME_NB_TYPOS = "nbTypos"; + + @SerializedName(SERIALIZED_NAME_NB_TYPOS) private Integer nbTypos; - public static final String JSON_PROPERTY_PROMOTED = "promoted"; + public static final String SERIALIZED_NAME_PROMOTED = "promoted"; + + @SerializedName(SERIALIZED_NAME_PROMOTED) private Boolean promoted; - public static final String JSON_PROPERTY_PROXIMITY_DISTANCE = + public static final String SERIALIZED_NAME_PROXIMITY_DISTANCE = "proximityDistance"; + + @SerializedName(SERIALIZED_NAME_PROXIMITY_DISTANCE) private Integer proximityDistance; - public static final String JSON_PROPERTY_USER_SCORE = "userScore"; + public static final String SERIALIZED_NAME_USER_SCORE = "userScore"; + + @SerializedName(SERIALIZED_NAME_USER_SCORE) private Integer userScore; - public static final String JSON_PROPERTY_WORD = "word"; + public static final String SERIALIZED_NAME_WORD = "word"; + + @SerializedName(SERIALIZED_NAME_WORD) private Integer word; public RankingInfo filters(Integer filters) { @@ -88,14 +91,10 @@ public RankingInfo filters(Integer filters) { */ @javax.annotation.Nullable @ApiModelProperty(value = "This field is reserved for advanced usage.") - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getFilters() { return filters; } - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(Integer filters) { this.filters = filters; } @@ -114,14 +113,10 @@ public RankingInfo firstMatchedWord(Integer firstMatchedWord) { @ApiModelProperty( value = "Position of the most important matched attribute in the attributes to index list." ) - @JsonProperty(JSON_PROPERTY_FIRST_MATCHED_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getFirstMatchedWord() { return firstMatchedWord; } - @JsonProperty(JSON_PROPERTY_FIRST_MATCHED_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFirstMatchedWord(Integer firstMatchedWord) { this.firstMatchedWord = firstMatchedWord; } @@ -142,14 +137,10 @@ public RankingInfo geoDistance(Integer geoDistance) { value = "Distance between the geo location in the search query and the best matching geo location" + " in the record, divided by the geo precision (in meters)." ) - @JsonProperty(JSON_PROPERTY_GEO_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getGeoDistance() { return geoDistance; } - @JsonProperty(JSON_PROPERTY_GEO_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGeoDistance(Integer geoDistance) { this.geoDistance = geoDistance; } @@ -168,14 +159,10 @@ public RankingInfo geoPrecision(Integer geoPrecision) { @ApiModelProperty( value = "Precision used when computing the geo distance, in meters." ) - @JsonProperty(JSON_PROPERTY_GEO_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getGeoPrecision() { return geoPrecision; } - @JsonProperty(JSON_PROPERTY_GEO_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGeoPrecision(Integer geoPrecision) { this.geoPrecision = geoPrecision; } @@ -205,14 +192,10 @@ public RankingInfo putMatchedGeoLocationItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MATCHED_GEO_LOCATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getMatchedGeoLocation() { return matchedGeoLocation; } - @JsonProperty(JSON_PROPERTY_MATCHED_GEO_LOCATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchedGeoLocation( Map matchedGeoLocation ) { @@ -231,14 +214,10 @@ public RankingInfo nbExactWords(Integer nbExactWords) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Number of exactly matched words.") - @JsonProperty(JSON_PROPERTY_NB_EXACT_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbExactWords() { return nbExactWords; } - @JsonProperty(JSON_PROPERTY_NB_EXACT_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbExactWords(Integer nbExactWords) { this.nbExactWords = nbExactWords; } @@ -257,14 +236,10 @@ public RankingInfo nbTypos(Integer nbTypos) { @ApiModelProperty( value = "Number of typos encountered when matching the record." ) - @JsonProperty(JSON_PROPERTY_NB_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbTypos() { return nbTypos; } - @JsonProperty(JSON_PROPERTY_NB_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbTypos(Integer nbTypos) { this.nbTypos = nbTypos; } @@ -283,14 +258,10 @@ public RankingInfo promoted(Boolean promoted) { @ApiModelProperty( value = "Present and set to true if a Rule promoted the hit." ) - @JsonProperty(JSON_PROPERTY_PROMOTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPromoted() { return promoted; } - @JsonProperty(JSON_PROPERTY_PROMOTED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPromoted(Boolean promoted) { this.promoted = promoted; } @@ -311,14 +282,10 @@ public RankingInfo proximityDistance(Integer proximityDistance) { value = "When the query contains more than one word, the sum of the distances between matched" + " words (in meters)." ) - @JsonProperty(JSON_PROPERTY_PROXIMITY_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getProximityDistance() { return proximityDistance; } - @JsonProperty(JSON_PROPERTY_PROXIMITY_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setProximityDistance(Integer proximityDistance) { this.proximityDistance = proximityDistance; } @@ -337,14 +304,10 @@ public RankingInfo userScore(Integer userScore) { @ApiModelProperty( value = "Custom ranking for the object, expressed as a single integer value." ) - @JsonProperty(JSON_PROPERTY_USER_SCORE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getUserScore() { return userScore; } - @JsonProperty(JSON_PROPERTY_USER_SCORE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserScore(Integer userScore) { this.userScore = userScore; } @@ -363,14 +326,10 @@ public RankingInfo word(Integer word) { @ApiModelProperty( value = "Number of matched words, including prefixes and typos." ) - @JsonProperty(JSON_PROPERTY_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getWord() { return word; } - @JsonProperty(JSON_PROPERTY_WORD) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setWord(Integer word) { this.word = word; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java index 637a09d04e..e8e5abdc4d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -12,31 +12,26 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; /** RankingInfoMatchedGeoLocation */ -@JsonPropertyOrder( - { - RankingInfoMatchedGeoLocation.JSON_PROPERTY_LAT, - RankingInfoMatchedGeoLocation.JSON_PROPERTY_LNG, - RankingInfoMatchedGeoLocation.JSON_PROPERTY_DISTANCE, - } -) -@JsonTypeName("rankingInfo_matchedGeoLocation") public class RankingInfoMatchedGeoLocation { - public static final String JSON_PROPERTY_LAT = "lat"; + public static final String SERIALIZED_NAME_LAT = "lat"; + + @SerializedName(SERIALIZED_NAME_LAT) private Double lat; - public static final String JSON_PROPERTY_LNG = "lng"; + public static final String SERIALIZED_NAME_LNG = "lng"; + + @SerializedName(SERIALIZED_NAME_LNG) private Double lng; - public static final String JSON_PROPERTY_DISTANCE = "distance"; + public static final String SERIALIZED_NAME_DISTANCE = "distance"; + + @SerializedName(SERIALIZED_NAME_DISTANCE) private Integer distance; public RankingInfoMatchedGeoLocation lat(Double lat) { @@ -51,14 +46,10 @@ public RankingInfoMatchedGeoLocation lat(Double lat) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Latitude of the matched location.") - @JsonProperty(JSON_PROPERTY_LAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Double getLat() { return lat; } - @JsonProperty(JSON_PROPERTY_LAT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLat(Double lat) { this.lat = lat; } @@ -75,14 +66,10 @@ public RankingInfoMatchedGeoLocation lng(Double lng) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Longitude of the matched location.") - @JsonProperty(JSON_PROPERTY_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Double getLng() { return lng; } - @JsonProperty(JSON_PROPERTY_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLng(Double lng) { this.lng = lng; } @@ -101,14 +88,10 @@ public RankingInfoMatchedGeoLocation distance(Integer distance) { @ApiModelProperty( value = "Distance between the matched location and the search location (in meters)." ) - @JsonProperty(JSON_PROPERTY_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistance() { return distance; } - @JsonProperty(JSON_PROPERTY_DISTANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistance(Integer distance) { this.distance = distance; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java index f8e67c7e1c..dd7e996fab 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; @@ -23,32 +20,33 @@ /** A single record. */ @ApiModel(description = "A single record.") -@JsonPropertyOrder( - { - Record.JSON_PROPERTY_OBJECT_I_D, - Record.JSON_PROPERTY_HIGHLIGHT_RESULT, - Record.JSON_PROPERTY_SNIPPET_RESULT, - Record.JSON_PROPERTY_RANKING_INFO, - Record.JSON_PROPERTY_DISTINCT_SEQ_I_D, - } -) -@JsonTypeName("record") public class Record extends HashMap { - public static final String JSON_PROPERTY_OBJECT_I_D = "objectID"; + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) private String objectID; - public static final String JSON_PROPERTY_HIGHLIGHT_RESULT = + public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = "_highlightResult"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_RESULT) private HighlightResult highlightResult; - public static final String JSON_PROPERTY_SNIPPET_RESULT = "_snippetResult"; + public static final String SERIALIZED_NAME_SNIPPET_RESULT = "_snippetResult"; + + @SerializedName(SERIALIZED_NAME_SNIPPET_RESULT) private SnippetResult snippetResult; - public static final String JSON_PROPERTY_RANKING_INFO = "_rankingInfo"; + public static final String SERIALIZED_NAME_RANKING_INFO = "_rankingInfo"; + + @SerializedName(SERIALIZED_NAME_RANKING_INFO) private RankingInfo rankingInfo; - public static final String JSON_PROPERTY_DISTINCT_SEQ_I_D = "_distinctSeqID"; + public static final String SERIALIZED_NAME_DISTINCT_SEQ_I_D = + "_distinctSeqID"; + + @SerializedName(SERIALIZED_NAME_DISTINCT_SEQ_I_D) private Integer distinctSeqID; public Record objectID(String objectID) { @@ -63,14 +61,10 @@ public Record objectID(String objectID) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Unique identifier of the object.") - @JsonProperty(JSON_PROPERTY_OBJECT_I_D) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getObjectID() { return objectID; } - @JsonProperty(JSON_PROPERTY_OBJECT_I_D) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setObjectID(String objectID) { this.objectID = objectID; } @@ -87,14 +81,10 @@ public Record highlightResult(HighlightResult highlightResult) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public HighlightResult getHighlightResult() { return highlightResult; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightResult(HighlightResult highlightResult) { this.highlightResult = highlightResult; } @@ -111,14 +101,10 @@ public Record snippetResult(SnippetResult snippetResult) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_SNIPPET_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public SnippetResult getSnippetResult() { return snippetResult; } - @JsonProperty(JSON_PROPERTY_SNIPPET_RESULT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetResult(SnippetResult snippetResult) { this.snippetResult = snippetResult; } @@ -135,14 +121,10 @@ public Record rankingInfo(RankingInfo rankingInfo) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RankingInfo getRankingInfo() { return rankingInfo; } - @JsonProperty(JSON_PROPERTY_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRankingInfo(RankingInfo rankingInfo) { this.rankingInfo = rankingInfo; } @@ -159,14 +141,10 @@ public Record distinctSeqID(Integer distinctSeqID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_DISTINCT_SEQ_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinctSeqID() { return distinctSeqID; } - @JsonProperty(JSON_PROPERTY_DISTINCT_SEQ_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinctSeqID(Integer distinctSeqID) { this.distinctSeqID = distinctSeqID; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index 6c31c24f10..de0ecdfe20 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -12,31 +12,26 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; /** SaveObjectResponse */ -@JsonPropertyOrder( - { - SaveObjectResponse.JSON_PROPERTY_CREATED_AT, - SaveObjectResponse.JSON_PROPERTY_TASK_I_D, - SaveObjectResponse.JSON_PROPERTY_OBJECT_I_D, - } -) -@JsonTypeName("saveObjectResponse") public class SaveObjectResponse { - public static final String JSON_PROPERTY_CREATED_AT = "createdAt"; + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) private String createdAt; - public static final String JSON_PROPERTY_TASK_I_D = "taskID"; + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; - public static final String JSON_PROPERTY_OBJECT_I_D = "objectID"; + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) private String objectID; public SaveObjectResponse createdAt(String createdAt) { @@ -51,14 +46,10 @@ public SaveObjectResponse createdAt(String createdAt) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getCreatedAt() { return createdAt; } - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } @@ -75,14 +66,10 @@ public SaveObjectResponse taskID(Integer taskID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -99,14 +86,10 @@ public SaveObjectResponse objectID(String objectID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Unique identifier of the object.") - @JsonProperty(JSON_PROPERTY_OBJECT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getObjectID() { return objectID; } - @JsonProperty(JSON_PROPERTY_OBJECT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setObjectID(String objectID) { this.objectID = objectID; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index 6a28d1f9e9..4465288b9b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -12,21 +12,18 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** SearchHits */ -@JsonPropertyOrder({ SearchHits.JSON_PROPERTY_HITS }) -@JsonTypeName("searchHits") public class SearchHits { - public static final String JSON_PROPERTY_HITS = "hits"; + public static final String SERIALIZED_NAME_HITS = "hits"; + + @SerializedName(SERIALIZED_NAME_HITS) private List hits = null; public SearchHits hits(List hits) { @@ -49,14 +46,10 @@ public SearchHits addHitsItem(Record hitsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getHits() { return hits; } - @JsonProperty(JSON_PROPERTY_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHits(List hits) { this.hits = hits; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index fc0257dc09..306a90701c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -12,14 +12,13 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; @@ -28,266 +27,288 @@ import org.openapitools.jackson.nullable.JsonNullable; /** SearchParams */ -@JsonPropertyOrder( - { - SearchParams.JSON_PROPERTY_QUERY, - SearchParams.JSON_PROPERTY_SIMILAR_QUERY, - SearchParams.JSON_PROPERTY_FILTERS, - SearchParams.JSON_PROPERTY_FACET_FILTERS, - SearchParams.JSON_PROPERTY_OPTIONAL_FILTERS, - SearchParams.JSON_PROPERTY_NUMERIC_FILTERS, - SearchParams.JSON_PROPERTY_TAG_FILTERS, - SearchParams.JSON_PROPERTY_SUM_OR_FILTERS_SCORES, - SearchParams.JSON_PROPERTY_FACETS, - SearchParams.JSON_PROPERTY_MAX_VALUES_PER_FACET, - SearchParams.JSON_PROPERTY_FACETING_AFTER_DISTINCT, - SearchParams.JSON_PROPERTY_SORT_FACET_VALUES_BY, - SearchParams.JSON_PROPERTY_PAGE, - SearchParams.JSON_PROPERTY_OFFSET, - SearchParams.JSON_PROPERTY_LENGTH, - SearchParams.JSON_PROPERTY_AROUND_LAT_LNG, - SearchParams.JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P, - SearchParams.JSON_PROPERTY_AROUND_RADIUS, - SearchParams.JSON_PROPERTY_AROUND_PRECISION, - SearchParams.JSON_PROPERTY_MINIMUM_AROUND_RADIUS, - SearchParams.JSON_PROPERTY_INSIDE_BOUNDING_BOX, - SearchParams.JSON_PROPERTY_INSIDE_POLYGON, - SearchParams.JSON_PROPERTY_NATURAL_LANGUAGES, - SearchParams.JSON_PROPERTY_RULE_CONTEXTS, - SearchParams.JSON_PROPERTY_PERSONALIZATION_IMPACT, - SearchParams.JSON_PROPERTY_USER_TOKEN, - SearchParams.JSON_PROPERTY_GET_RANKING_INFO, - SearchParams.JSON_PROPERTY_CLICK_ANALYTICS, - SearchParams.JSON_PROPERTY_ANALYTICS, - SearchParams.JSON_PROPERTY_ANALYTICS_TAGS, - SearchParams.JSON_PROPERTY_PERCENTILE_COMPUTATION, - SearchParams.JSON_PROPERTY_ENABLE_A_B_TEST, - SearchParams.JSON_PROPERTY_ENABLE_RE_RANKING, - SearchParams.JSON_PROPERTY_SEARCHABLE_ATTRIBUTES, - SearchParams.JSON_PROPERTY_ATTRIBUTES_FOR_FACETING, - SearchParams.JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES, - SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE, - SearchParams.JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES, - SearchParams.JSON_PROPERTY_RANKING, - SearchParams.JSON_PROPERTY_CUSTOM_RANKING, - SearchParams.JSON_PROPERTY_RELEVANCY_STRICTNESS, - SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT, - SearchParams.JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET, - SearchParams.JSON_PROPERTY_HIGHLIGHT_PRE_TAG, - SearchParams.JSON_PROPERTY_HIGHLIGHT_POST_TAG, - SearchParams.JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT, - SearchParams.JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS, - SearchParams.JSON_PROPERTY_HITS_PER_PAGE, - SearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO, - SearchParams.JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS, - SearchParams.JSON_PROPERTY_TYPO_TOLERANCE, - SearchParams.JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS, - SearchParams.JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES, - SearchParams.JSON_PROPERTY_SEPARATORS_TO_INDEX, - SearchParams.JSON_PROPERTY_IGNORE_PLURALS, - SearchParams.JSON_PROPERTY_REMOVE_STOP_WORDS, - SearchParams.JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS, - SearchParams.JSON_PROPERTY_QUERY_LANGUAGES, - SearchParams.JSON_PROPERTY_DECOMPOUND_QUERY, - SearchParams.JSON_PROPERTY_ENABLE_RULES, - SearchParams.JSON_PROPERTY_ENABLE_PERSONALIZATION, - SearchParams.JSON_PROPERTY_QUERY_TYPE, - SearchParams.JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS, - SearchParams.JSON_PROPERTY_ADVANCED_SYNTAX, - SearchParams.JSON_PROPERTY_OPTIONAL_WORDS, - SearchParams.JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES, - SearchParams.JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY, - SearchParams.JSON_PROPERTY_ALTERNATIVES_AS_EXACT, - SearchParams.JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES, - SearchParams.JSON_PROPERTY_DISTINCT, - SearchParams.JSON_PROPERTY_SYNONYMS, - SearchParams.JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT, - SearchParams.JSON_PROPERTY_MIN_PROXIMITY, - SearchParams.JSON_PROPERTY_RESPONSE_FIELDS, - SearchParams.JSON_PROPERTY_MAX_FACET_HITS, - SearchParams.JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY, - SearchParams.JSON_PROPERTY_RENDERING_CONTENT, - } -) -@JsonTypeName("searchParams") public class SearchParams { - public static final String JSON_PROPERTY_QUERY = "query"; + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String JSON_PROPERTY_SIMILAR_QUERY = "similarQuery"; + public static final String SERIALIZED_NAME_SIMILAR_QUERY = "similarQuery"; + + @SerializedName(SERIALIZED_NAME_SIMILAR_QUERY) private String similarQuery = ""; - public static final String JSON_PROPERTY_FILTERS = "filters"; + public static final String SERIALIZED_NAME_FILTERS = "filters"; + + @SerializedName(SERIALIZED_NAME_FILTERS) private String filters = ""; - public static final String JSON_PROPERTY_FACET_FILTERS = "facetFilters"; + public static final String SERIALIZED_NAME_FACET_FILTERS = "facetFilters"; + + @SerializedName(SERIALIZED_NAME_FACET_FILTERS) private List facetFilters = null; - public static final String JSON_PROPERTY_OPTIONAL_FILTERS = "optionalFilters"; + public static final String SERIALIZED_NAME_OPTIONAL_FILTERS = + "optionalFilters"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_FILTERS) private List optionalFilters = null; - public static final String JSON_PROPERTY_NUMERIC_FILTERS = "numericFilters"; + public static final String SERIALIZED_NAME_NUMERIC_FILTERS = "numericFilters"; + + @SerializedName(SERIALIZED_NAME_NUMERIC_FILTERS) private List numericFilters = null; - public static final String JSON_PROPERTY_TAG_FILTERS = "tagFilters"; + public static final String SERIALIZED_NAME_TAG_FILTERS = "tagFilters"; + + @SerializedName(SERIALIZED_NAME_TAG_FILTERS) private List tagFilters = null; - public static final String JSON_PROPERTY_SUM_OR_FILTERS_SCORES = + public static final String SERIALIZED_NAME_SUM_OR_FILTERS_SCORES = "sumOrFiltersScores"; + + @SerializedName(SERIALIZED_NAME_SUM_OR_FILTERS_SCORES) private Boolean sumOrFiltersScores = false; - public static final String JSON_PROPERTY_FACETS = "facets"; + public static final String SERIALIZED_NAME_FACETS = "facets"; + + @SerializedName(SERIALIZED_NAME_FACETS) private List facets = null; - public static final String JSON_PROPERTY_MAX_VALUES_PER_FACET = + public static final String SERIALIZED_NAME_MAX_VALUES_PER_FACET = "maxValuesPerFacet"; + + @SerializedName(SERIALIZED_NAME_MAX_VALUES_PER_FACET) private Integer maxValuesPerFacet = 100; - public static final String JSON_PROPERTY_FACETING_AFTER_DISTINCT = + public static final String SERIALIZED_NAME_FACETING_AFTER_DISTINCT = "facetingAfterDistinct"; + + @SerializedName(SERIALIZED_NAME_FACETING_AFTER_DISTINCT) private Boolean facetingAfterDistinct = false; - public static final String JSON_PROPERTY_SORT_FACET_VALUES_BY = + public static final String SERIALIZED_NAME_SORT_FACET_VALUES_BY = "sortFacetValuesBy"; + + @SerializedName(SERIALIZED_NAME_SORT_FACET_VALUES_BY) private String sortFacetValuesBy = "count"; - public static final String JSON_PROPERTY_PAGE = "page"; + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; - public static final String JSON_PROPERTY_OFFSET = "offset"; + public static final String SERIALIZED_NAME_OFFSET = "offset"; + + @SerializedName(SERIALIZED_NAME_OFFSET) private Integer offset; - public static final String JSON_PROPERTY_LENGTH = "length"; + public static final String SERIALIZED_NAME_LENGTH = "length"; + + @SerializedName(SERIALIZED_NAME_LENGTH) private Integer length; - public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng = ""; - public static final String JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P = + public static final String SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P = "aroundLatLngViaIP"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG_VIA_I_P) private Boolean aroundLatLngViaIP = false; - public static final String JSON_PROPERTY_AROUND_RADIUS = "aroundRadius"; - private JsonNullable aroundRadius = JsonNullable.undefined(); + public static final String SERIALIZED_NAME_AROUND_RADIUS = "aroundRadius"; + + @SerializedName(SERIALIZED_NAME_AROUND_RADIUS) + private OneOfintegerstring aroundRadius; - public static final String JSON_PROPERTY_AROUND_PRECISION = "aroundPrecision"; + public static final String SERIALIZED_NAME_AROUND_PRECISION = + "aroundPrecision"; + + @SerializedName(SERIALIZED_NAME_AROUND_PRECISION) private Integer aroundPrecision = 10; - public static final String JSON_PROPERTY_MINIMUM_AROUND_RADIUS = + public static final String SERIALIZED_NAME_MINIMUM_AROUND_RADIUS = "minimumAroundRadius"; + + @SerializedName(SERIALIZED_NAME_MINIMUM_AROUND_RADIUS) private Integer minimumAroundRadius; - public static final String JSON_PROPERTY_INSIDE_BOUNDING_BOX = + public static final String SERIALIZED_NAME_INSIDE_BOUNDING_BOX = "insideBoundingBox"; + + @SerializedName(SERIALIZED_NAME_INSIDE_BOUNDING_BOX) private List insideBoundingBox = null; - public static final String JSON_PROPERTY_INSIDE_POLYGON = "insidePolygon"; + public static final String SERIALIZED_NAME_INSIDE_POLYGON = "insidePolygon"; + + @SerializedName(SERIALIZED_NAME_INSIDE_POLYGON) private List insidePolygon = null; - public static final String JSON_PROPERTY_NATURAL_LANGUAGES = + public static final String SERIALIZED_NAME_NATURAL_LANGUAGES = "naturalLanguages"; + + @SerializedName(SERIALIZED_NAME_NATURAL_LANGUAGES) private List naturalLanguages = null; - public static final String JSON_PROPERTY_RULE_CONTEXTS = "ruleContexts"; + public static final String SERIALIZED_NAME_RULE_CONTEXTS = "ruleContexts"; + + @SerializedName(SERIALIZED_NAME_RULE_CONTEXTS) private List ruleContexts = null; - public static final String JSON_PROPERTY_PERSONALIZATION_IMPACT = + public static final String SERIALIZED_NAME_PERSONALIZATION_IMPACT = "personalizationImpact"; + + @SerializedName(SERIALIZED_NAME_PERSONALIZATION_IMPACT) private Integer personalizationImpact = 100; - public static final String JSON_PROPERTY_USER_TOKEN = "userToken"; + public static final String SERIALIZED_NAME_USER_TOKEN = "userToken"; + + @SerializedName(SERIALIZED_NAME_USER_TOKEN) private String userToken; - public static final String JSON_PROPERTY_GET_RANKING_INFO = "getRankingInfo"; + public static final String SERIALIZED_NAME_GET_RANKING_INFO = + "getRankingInfo"; + + @SerializedName(SERIALIZED_NAME_GET_RANKING_INFO) private Boolean getRankingInfo = false; - public static final String JSON_PROPERTY_CLICK_ANALYTICS = "clickAnalytics"; + public static final String SERIALIZED_NAME_CLICK_ANALYTICS = "clickAnalytics"; + + @SerializedName(SERIALIZED_NAME_CLICK_ANALYTICS) private Boolean clickAnalytics = false; - public static final String JSON_PROPERTY_ANALYTICS = "analytics"; + public static final String SERIALIZED_NAME_ANALYTICS = "analytics"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS) private Boolean analytics = true; - public static final String JSON_PROPERTY_ANALYTICS_TAGS = "analyticsTags"; + public static final String SERIALIZED_NAME_ANALYTICS_TAGS = "analyticsTags"; + + @SerializedName(SERIALIZED_NAME_ANALYTICS_TAGS) private List analyticsTags = null; - public static final String JSON_PROPERTY_PERCENTILE_COMPUTATION = + public static final String SERIALIZED_NAME_PERCENTILE_COMPUTATION = "percentileComputation"; + + @SerializedName(SERIALIZED_NAME_PERCENTILE_COMPUTATION) private Boolean percentileComputation = true; - public static final String JSON_PROPERTY_ENABLE_A_B_TEST = "enableABTest"; + public static final String SERIALIZED_NAME_ENABLE_A_B_TEST = "enableABTest"; + + @SerializedName(SERIALIZED_NAME_ENABLE_A_B_TEST) private Boolean enableABTest = true; - public static final String JSON_PROPERTY_ENABLE_RE_RANKING = + public static final String SERIALIZED_NAME_ENABLE_RE_RANKING = "enableReRanking"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RE_RANKING) private Boolean enableReRanking = true; - public static final String JSON_PROPERTY_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES = "searchableAttributes"; + + @SerializedName(SERIALIZED_NAME_SEARCHABLE_ATTRIBUTES) private List searchableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_FOR_FACETING = + public static final String SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING = "attributesForFaceting"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_FOR_FACETING) private List attributesForFaceting = null; - public static final String JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES = "unretrievableAttributes"; + + @SerializedName(SERIALIZED_NAME_UNRETRIEVABLE_ATTRIBUTES) private List unretrievableAttributes = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE = "attributesToRetrieve"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_RETRIEVE) private List attributesToRetrieve = null; - public static final String JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES = + public static final String SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES = "restrictSearchableAttributes"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_SEARCHABLE_ATTRIBUTES) private List restrictSearchableAttributes = null; - public static final String JSON_PROPERTY_RANKING = "ranking"; + public static final String SERIALIZED_NAME_RANKING = "ranking"; + + @SerializedName(SERIALIZED_NAME_RANKING) private List ranking = null; - public static final String JSON_PROPERTY_CUSTOM_RANKING = "customRanking"; + public static final String SERIALIZED_NAME_CUSTOM_RANKING = "customRanking"; + + @SerializedName(SERIALIZED_NAME_CUSTOM_RANKING) private List customRanking = null; - public static final String JSON_PROPERTY_RELEVANCY_STRICTNESS = + public static final String SERIALIZED_NAME_RELEVANCY_STRICTNESS = "relevancyStrictness"; + + @SerializedName(SERIALIZED_NAME_RELEVANCY_STRICTNESS) private Integer relevancyStrictness = 100; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT = "attributesToHighlight"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_HIGHLIGHT) private List attributesToHighlight = null; - public static final String JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET = + public static final String SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET = "attributesToSnippet"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTES_TO_SNIPPET) private List attributesToSnippet = null; - public static final String JSON_PROPERTY_HIGHLIGHT_PRE_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_PRE_TAG = "highlightPreTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_PRE_TAG) private String highlightPreTag = ""; - public static final String JSON_PROPERTY_HIGHLIGHT_POST_TAG = + public static final String SERIALIZED_NAME_HIGHLIGHT_POST_TAG = "highlightPostTag"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_POST_TAG) private String highlightPostTag = ""; - public static final String JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT = + public static final String SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT = "snippetEllipsisText"; + + @SerializedName(SERIALIZED_NAME_SNIPPET_ELLIPSIS_TEXT) private String snippetEllipsisText = "…"; - public static final String JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = + public static final String SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS = "restrictHighlightAndSnippetArrays"; + + @SerializedName(SERIALIZED_NAME_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) private Boolean restrictHighlightAndSnippetArrays = false; - public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO = "minWordSizefor1Typo"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR1_TYPO) private Integer minWordSizefor1Typo = 4; - public static final String JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS = + public static final String SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS = "minWordSizefor2Typos"; + + @SerializedName(SERIALIZED_NAME_MIN_WORD_SIZEFOR2_TYPOS) private Integer minWordSizefor2Typos = 8; /** Controls whether typo tolerance is enabled and how it is applied. */ + @JsonAdapter(TypoToleranceEnum.Adapter.class) public enum TypoToleranceEnum { TRUE("true"), @@ -303,7 +324,6 @@ public enum TypoToleranceEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -313,7 +333,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static TypoToleranceEnum fromValue(String value) { for (TypoToleranceEnum b : TypoToleranceEnum.values()) { if (b.value.equals(value)) { @@ -322,48 +341,90 @@ public static TypoToleranceEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypoToleranceEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypoToleranceEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return TypoToleranceEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_TYPO_TOLERANCE = "typoTolerance"; + public static final String SERIALIZED_NAME_TYPO_TOLERANCE = "typoTolerance"; + + @SerializedName(SERIALIZED_NAME_TYPO_TOLERANCE) private TypoToleranceEnum typoTolerance = TypoToleranceEnum.TRUE; - public static final String JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS = + public static final String SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS = "allowTyposOnNumericTokens"; + + @SerializedName(SERIALIZED_NAME_ALLOW_TYPOS_ON_NUMERIC_TOKENS) private Boolean allowTyposOnNumericTokens = true; - public static final String JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES = "disableTypoToleranceOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) private List disableTypoToleranceOnAttributes = null; - public static final String JSON_PROPERTY_SEPARATORS_TO_INDEX = + public static final String SERIALIZED_NAME_SEPARATORS_TO_INDEX = "separatorsToIndex"; + + @SerializedName(SERIALIZED_NAME_SEPARATORS_TO_INDEX) private String separatorsToIndex = ""; - public static final String JSON_PROPERTY_IGNORE_PLURALS = "ignorePlurals"; + public static final String SERIALIZED_NAME_IGNORE_PLURALS = "ignorePlurals"; + + @SerializedName(SERIALIZED_NAME_IGNORE_PLURALS) private String ignorePlurals = "false"; - public static final String JSON_PROPERTY_REMOVE_STOP_WORDS = + public static final String SERIALIZED_NAME_REMOVE_STOP_WORDS = "removeStopWords"; + + @SerializedName(SERIALIZED_NAME_REMOVE_STOP_WORDS) private String removeStopWords = "false"; - public static final String JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS = + public static final String SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS = "keepDiacriticsOnCharacters"; + + @SerializedName(SERIALIZED_NAME_KEEP_DIACRITICS_ON_CHARACTERS) private String keepDiacriticsOnCharacters = ""; - public static final String JSON_PROPERTY_QUERY_LANGUAGES = "queryLanguages"; + public static final String SERIALIZED_NAME_QUERY_LANGUAGES = "queryLanguages"; + + @SerializedName(SERIALIZED_NAME_QUERY_LANGUAGES) private List queryLanguages = null; - public static final String JSON_PROPERTY_DECOMPOUND_QUERY = "decompoundQuery"; + public static final String SERIALIZED_NAME_DECOMPOUND_QUERY = + "decompoundQuery"; + + @SerializedName(SERIALIZED_NAME_DECOMPOUND_QUERY) private Boolean decompoundQuery = true; - public static final String JSON_PROPERTY_ENABLE_RULES = "enableRules"; + public static final String SERIALIZED_NAME_ENABLE_RULES = "enableRules"; + + @SerializedName(SERIALIZED_NAME_ENABLE_RULES) private Boolean enableRules = true; - public static final String JSON_PROPERTY_ENABLE_PERSONALIZATION = + public static final String SERIALIZED_NAME_ENABLE_PERSONALIZATION = "enablePersonalization"; + + @SerializedName(SERIALIZED_NAME_ENABLE_PERSONALIZATION) private Boolean enablePersonalization = false; /** Controls if and how query words are interpreted as prefixes. */ + @JsonAdapter(QueryTypeEnum.Adapter.class) public enum QueryTypeEnum { PREFIXLAST("prefixLast"), @@ -377,7 +438,6 @@ public enum QueryTypeEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -387,7 +447,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static QueryTypeEnum fromValue(String value) { for (QueryTypeEnum b : QueryTypeEnum.values()) { if (b.value.equals(value)) { @@ -396,12 +455,33 @@ public static QueryTypeEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final QueryTypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public QueryTypeEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return QueryTypeEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_QUERY_TYPE = "queryType"; + public static final String SERIALIZED_NAME_QUERY_TYPE = "queryType"; + + @SerializedName(SERIALIZED_NAME_QUERY_TYPE) private QueryTypeEnum queryType = QueryTypeEnum.PREFIXLAST; /** Selects a strategy to remove words from the query when it doesn’t match any hits. */ + @JsonAdapter(RemoveWordsIfNoResultsEnum.Adapter.class) public enum RemoveWordsIfNoResultsEnum { NONE("none"), @@ -417,7 +497,6 @@ public enum RemoveWordsIfNoResultsEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -427,7 +506,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static RemoveWordsIfNoResultsEnum fromValue(String value) { for (RemoveWordsIfNoResultsEnum b : RemoveWordsIfNoResultsEnum.values()) { if (b.value.equals(value)) { @@ -436,24 +514,52 @@ public static RemoveWordsIfNoResultsEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final RemoveWordsIfNoResultsEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RemoveWordsIfNoResultsEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return RemoveWordsIfNoResultsEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS = + public static final String SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS = "removeWordsIfNoResults"; + + @SerializedName(SERIALIZED_NAME_REMOVE_WORDS_IF_NO_RESULTS) private RemoveWordsIfNoResultsEnum removeWordsIfNoResults = RemoveWordsIfNoResultsEnum.NONE; - public static final String JSON_PROPERTY_ADVANCED_SYNTAX = "advancedSyntax"; + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX = "advancedSyntax"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX) private Boolean advancedSyntax = false; - public static final String JSON_PROPERTY_OPTIONAL_WORDS = "optionalWords"; + public static final String SERIALIZED_NAME_OPTIONAL_WORDS = "optionalWords"; + + @SerializedName(SERIALIZED_NAME_OPTIONAL_WORDS) private List optionalWords = null; - public static final String JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES = + public static final String SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES = "disableExactOnAttributes"; + + @SerializedName(SERIALIZED_NAME_DISABLE_EXACT_ON_ATTRIBUTES) private List disableExactOnAttributes = null; /** Controls how the exact ranking criterion is computed when the query contains only one word. */ + @JsonAdapter(ExactOnSingleWordQueryEnum.Adapter.class) public enum ExactOnSingleWordQueryEnum { ATTRIBUTE("attribute"), @@ -467,7 +573,6 @@ public enum ExactOnSingleWordQueryEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -477,7 +582,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static ExactOnSingleWordQueryEnum fromValue(String value) { for (ExactOnSingleWordQueryEnum b : ExactOnSingleWordQueryEnum.values()) { if (b.value.equals(value)) { @@ -486,14 +590,36 @@ public static ExactOnSingleWordQueryEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ExactOnSingleWordQueryEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ExactOnSingleWordQueryEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return ExactOnSingleWordQueryEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY = + public static final String SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY = "exactOnSingleWordQuery"; + + @SerializedName(SERIALIZED_NAME_EXACT_ON_SINGLE_WORD_QUERY) private ExactOnSingleWordQueryEnum exactOnSingleWordQuery = ExactOnSingleWordQueryEnum.ATTRIBUTE; /** Gets or Sets alternativesAsExact */ + @JsonAdapter(AlternativesAsExactEnum.Adapter.class) public enum AlternativesAsExactEnum { IGNOREPLURALS("ignorePlurals"), @@ -507,7 +633,6 @@ public enum AlternativesAsExactEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -517,7 +642,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AlternativesAsExactEnum fromValue(String value) { for (AlternativesAsExactEnum b : AlternativesAsExactEnum.values()) { if (b.value.equals(value)) { @@ -526,13 +650,34 @@ public static AlternativesAsExactEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AlternativesAsExactEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AlternativesAsExactEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AlternativesAsExactEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ALTERNATIVES_AS_EXACT = + public static final String SERIALIZED_NAME_ALTERNATIVES_AS_EXACT = "alternativesAsExact"; + + @SerializedName(SERIALIZED_NAME_ALTERNATIVES_AS_EXACT) private List alternativesAsExact = null; /** Gets or Sets advancedSyntaxFeatures */ + @JsonAdapter(AdvancedSyntaxFeaturesEnum.Adapter.class) public enum AdvancedSyntaxFeaturesEnum { EXACTPHRASE("exactPhrase"), @@ -544,7 +689,6 @@ public enum AdvancedSyntaxFeaturesEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -554,7 +698,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static AdvancedSyntaxFeaturesEnum fromValue(String value) { for (AdvancedSyntaxFeaturesEnum b : AdvancedSyntaxFeaturesEnum.values()) { if (b.value.equals(value)) { @@ -563,37 +706,74 @@ public static AdvancedSyntaxFeaturesEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter + extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final AdvancedSyntaxFeaturesEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AdvancedSyntaxFeaturesEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return AdvancedSyntaxFeaturesEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES = + public static final String SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES = "advancedSyntaxFeatures"; + + @SerializedName(SERIALIZED_NAME_ADVANCED_SYNTAX_FEATURES) private List advancedSyntaxFeatures = null; - public static final String JSON_PROPERTY_DISTINCT = "distinct"; + public static final String SERIALIZED_NAME_DISTINCT = "distinct"; + + @SerializedName(SERIALIZED_NAME_DISTINCT) private Integer distinct = 0; - public static final String JSON_PROPERTY_SYNONYMS = "synonyms"; + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) private Boolean synonyms = true; - public static final String JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT = + public static final String SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT = "replaceSynonymsInHighlight"; + + @SerializedName(SERIALIZED_NAME_REPLACE_SYNONYMS_IN_HIGHLIGHT) private Boolean replaceSynonymsInHighlight = false; - public static final String JSON_PROPERTY_MIN_PROXIMITY = "minProximity"; + public static final String SERIALIZED_NAME_MIN_PROXIMITY = "minProximity"; + + @SerializedName(SERIALIZED_NAME_MIN_PROXIMITY) private Integer minProximity = 1; - public static final String JSON_PROPERTY_RESPONSE_FIELDS = "responseFields"; + public static final String SERIALIZED_NAME_RESPONSE_FIELDS = "responseFields"; + + @SerializedName(SERIALIZED_NAME_RESPONSE_FIELDS) private List responseFields = null; - public static final String JSON_PROPERTY_MAX_FACET_HITS = "maxFacetHits"; + public static final String SERIALIZED_NAME_MAX_FACET_HITS = "maxFacetHits"; + + @SerializedName(SERIALIZED_NAME_MAX_FACET_HITS) private Integer maxFacetHits = 10; - public static final String JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = + public static final String SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY = "attributeCriteriaComputedByMinProximity"; + + @SerializedName(SERIALIZED_NAME_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) private Boolean attributeCriteriaComputedByMinProximity = false; - public static final String JSON_PROPERTY_RENDERING_CONTENT = + public static final String SERIALIZED_NAME_RENDERING_CONTENT = "renderingContent"; + + @SerializedName(SERIALIZED_NAME_RENDERING_CONTENT) private Object renderingContent = new Object(); public SearchParams query(String query) { @@ -608,14 +788,10 @@ public SearchParams query(String query) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -636,14 +812,10 @@ public SearchParams similarQuery(String similarQuery) { value = "Overrides the query parameter and performs a more generic search that can be used to" + " find \"similar\" results." ) - @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSimilarQuery() { return similarQuery; } - @JsonProperty(JSON_PROPERTY_SIMILAR_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSimilarQuery(String similarQuery) { this.similarQuery = similarQuery; } @@ -662,14 +834,10 @@ public SearchParams filters(String filters) { @ApiModelProperty( value = "Filter the query with numeric, facet and/or tag filters." ) - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getFilters() { return filters; } - @JsonProperty(JSON_PROPERTY_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFilters(String filters) { this.filters = filters; } @@ -694,14 +862,10 @@ public SearchParams addFacetFiltersItem(String facetFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by facet value.") - @JsonProperty(JSON_PROPERTY_FACET_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacetFilters() { return facetFilters; } - @JsonProperty(JSON_PROPERTY_FACET_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetFilters(List facetFilters) { this.facetFilters = facetFilters; } @@ -730,14 +894,10 @@ public SearchParams addOptionalFiltersItem(String optionalFiltersItem) { value = "Create filters for ranking purposes, where records that match the filter are ranked" + " higher, or lower in the case of a negative optional filter." ) - @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalFilters() { return optionalFilters; } - @JsonProperty(JSON_PROPERTY_OPTIONAL_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalFilters(List optionalFilters) { this.optionalFilters = optionalFilters; } @@ -762,14 +922,10 @@ public SearchParams addNumericFiltersItem(String numericFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter on numeric attributes.") - @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNumericFilters() { return numericFilters; } - @JsonProperty(JSON_PROPERTY_NUMERIC_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNumericFilters(List numericFilters) { this.numericFilters = numericFilters; } @@ -794,14 +950,10 @@ public SearchParams addTagFiltersItem(String tagFiltersItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Filter hits by tags.") - @JsonProperty(JSON_PROPERTY_TAG_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getTagFilters() { return tagFilters; } - @JsonProperty(JSON_PROPERTY_TAG_FILTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTagFilters(List tagFilters) { this.tagFilters = tagFilters; } @@ -820,14 +972,10 @@ public SearchParams sumOrFiltersScores(Boolean sumOrFiltersScores) { @ApiModelProperty( value = "Determines how to calculate the total score for filtering." ) - @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSumOrFiltersScores() { return sumOrFiltersScores; } - @JsonProperty(JSON_PROPERTY_SUM_OR_FILTERS_SCORES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSumOrFiltersScores(Boolean sumOrFiltersScores) { this.sumOrFiltersScores = sumOrFiltersScores; } @@ -852,14 +1000,10 @@ public SearchParams addFacetsItem(String facetsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve facets and their facet values.") - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getFacets() { return facets; } - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(List facets) { this.facets = facets; } @@ -878,14 +1022,10 @@ public SearchParams maxValuesPerFacet(Integer maxValuesPerFacet) { @ApiModelProperty( value = "Maximum number of facet values to return for each facet during a regular search." ) - @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxValuesPerFacet() { return maxValuesPerFacet; } - @JsonProperty(JSON_PROPERTY_MAX_VALUES_PER_FACET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxValuesPerFacet(Integer maxValuesPerFacet) { this.maxValuesPerFacet = maxValuesPerFacet; } @@ -904,14 +1044,10 @@ public SearchParams facetingAfterDistinct(Boolean facetingAfterDistinct) { @ApiModelProperty( value = "Force faceting to be applied after de-duplication (via the Distinct setting)." ) - @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getFacetingAfterDistinct() { return facetingAfterDistinct; } - @JsonProperty(JSON_PROPERTY_FACETING_AFTER_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetingAfterDistinct(Boolean facetingAfterDistinct) { this.facetingAfterDistinct = facetingAfterDistinct; } @@ -928,14 +1064,10 @@ public SearchParams sortFacetValuesBy(String sortFacetValuesBy) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how facet values are fetched.") - @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSortFacetValuesBy() { return sortFacetValuesBy; } - @JsonProperty(JSON_PROPERTY_SORT_FACET_VALUES_BY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSortFacetValuesBy(String sortFacetValuesBy) { this.sortFacetValuesBy = sortFacetValuesBy; } @@ -952,14 +1084,10 @@ public SearchParams page(Integer page) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the page to retrieve.") - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPage() { return page; } - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPage(Integer page) { this.page = page; } @@ -976,14 +1104,10 @@ public SearchParams offset(Integer offset) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specify the offset of the first hit to return.") - @JsonProperty(JSON_PROPERTY_OFFSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getOffset() { return offset; } - @JsonProperty(JSON_PROPERTY_OFFSET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOffset(Integer offset) { this.offset = offset; } @@ -1002,14 +1126,10 @@ public SearchParams length(Integer length) { @ApiModelProperty( value = "Set the number of hits to retrieve (used only with offset)." ) - @JsonProperty(JSON_PROPERTY_LENGTH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getLength() { return length; } - @JsonProperty(JSON_PROPERTY_LENGTH) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setLength(Integer length) { this.length = length; } @@ -1029,14 +1149,10 @@ public SearchParams aroundLatLng(String aroundLatLng) { value = "Search for entries around a central geolocation, enabling a geo search within a circular" + " area." ) - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -1057,21 +1173,16 @@ public SearchParams aroundLatLngViaIP(Boolean aroundLatLngViaIP) { value = "Search for entries around a given location automatically computed from the requester’s" + " IP address." ) - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAroundLatLngViaIP() { return aroundLatLngViaIP; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG_VIA_I_P) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { this.aroundLatLngViaIP = aroundLatLngViaIP; } public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = JsonNullable.of(aroundRadius); - + this.aroundRadius = aroundRadius; return this; } @@ -1084,26 +1195,12 @@ public SearchParams aroundRadius(OneOfintegerstring aroundRadius) { @ApiModelProperty( value = "Define the maximum radius for a geo search (in meters)." ) - @JsonIgnore public OneOfintegerstring getAroundRadius() { - return aroundRadius.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public JsonNullable getAroundRadius_JsonNullable() { return aroundRadius; } - @JsonProperty(JSON_PROPERTY_AROUND_RADIUS) - public void setAroundRadius_JsonNullable( - JsonNullable aroundRadius - ) { - this.aroundRadius = aroundRadius; - } - public void setAroundRadius(OneOfintegerstring aroundRadius) { - this.aroundRadius = JsonNullable.of(aroundRadius); + this.aroundRadius = aroundRadius; } public SearchParams aroundPrecision(Integer aroundPrecision) { @@ -1121,14 +1218,10 @@ public SearchParams aroundPrecision(Integer aroundPrecision) { value = "Precision of geo search (in meters), to add grouping by geo location to the ranking" + " formula." ) - @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAroundPrecision() { return aroundPrecision; } - @JsonProperty(JSON_PROPERTY_AROUND_PRECISION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundPrecision(Integer aroundPrecision) { this.aroundPrecision = aroundPrecision; } @@ -1147,14 +1240,10 @@ public SearchParams minimumAroundRadius(Integer minimumAroundRadius) { @ApiModelProperty( value = "Minimum radius (in meters) used for a geo search when aroundRadius is not set." ) - @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinimumAroundRadius() { return minimumAroundRadius; } - @JsonProperty(JSON_PROPERTY_MINIMUM_AROUND_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinimumAroundRadius(Integer minimumAroundRadius) { this.minimumAroundRadius = minimumAroundRadius; } @@ -1183,14 +1272,10 @@ public SearchParams addInsideBoundingBoxItem( @ApiModelProperty( value = "Search inside a rectangular area (in geo coordinates)." ) - @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsideBoundingBox() { return insideBoundingBox; } - @JsonProperty(JSON_PROPERTY_INSIDE_BOUNDING_BOX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsideBoundingBox(List insideBoundingBox) { this.insideBoundingBox = insideBoundingBox; } @@ -1215,14 +1300,10 @@ public SearchParams addInsidePolygonItem(BigDecimal insidePolygonItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Search inside a polygon (in geo coordinates).") - @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getInsidePolygon() { return insidePolygon; } - @JsonProperty(JSON_PROPERTY_INSIDE_POLYGON) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setInsidePolygon(List insidePolygon) { this.insidePolygon = insidePolygon; } @@ -1257,14 +1338,10 @@ public SearchParams addNaturalLanguagesItem(String naturalLanguagesItem) { " settings work well together when the query is formatted in natural language" + " instead of keywords, for example when your user performs a voice search." ) - @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getNaturalLanguages() { return naturalLanguages; } - @JsonProperty(JSON_PROPERTY_NATURAL_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNaturalLanguages(List naturalLanguages) { this.naturalLanguages = naturalLanguages; } @@ -1289,14 +1366,10 @@ public SearchParams addRuleContextsItem(String ruleContextsItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables contextual rules.") - @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRuleContexts() { return ruleContexts; } - @JsonProperty(JSON_PROPERTY_RULE_CONTEXTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRuleContexts(List ruleContexts) { this.ruleContexts = ruleContexts; } @@ -1313,14 +1386,10 @@ public SearchParams personalizationImpact(Integer personalizationImpact) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Define the impact of the Personalization feature.") - @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getPersonalizationImpact() { return personalizationImpact; } - @JsonProperty(JSON_PROPERTY_PERSONALIZATION_IMPACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPersonalizationImpact(Integer personalizationImpact) { this.personalizationImpact = personalizationImpact; } @@ -1339,14 +1408,10 @@ public SearchParams userToken(String userToken) { @ApiModelProperty( value = "Associates a certain user token with the current search." ) - @JsonProperty(JSON_PROPERTY_USER_TOKEN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getUserToken() { return userToken; } - @JsonProperty(JSON_PROPERTY_USER_TOKEN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUserToken(String userToken) { this.userToken = userToken; } @@ -1363,14 +1428,10 @@ public SearchParams getRankingInfo(Boolean getRankingInfo) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Retrieve detailed ranking information.") - @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getGetRankingInfo() { return getRankingInfo; } - @JsonProperty(JSON_PROPERTY_GET_RANKING_INFO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setGetRankingInfo(Boolean getRankingInfo) { this.getRankingInfo = getRankingInfo; } @@ -1387,14 +1448,10 @@ public SearchParams clickAnalytics(Boolean clickAnalytics) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Click Analytics feature.") - @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getClickAnalytics() { return clickAnalytics; } - @JsonProperty(JSON_PROPERTY_CLICK_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setClickAnalytics(Boolean clickAnalytics) { this.clickAnalytics = clickAnalytics; } @@ -1413,14 +1470,10 @@ public SearchParams analytics(Boolean analytics) { @ApiModelProperty( value = "Whether the current query will be taken into account in the Analytics." ) - @JsonProperty(JSON_PROPERTY_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAnalytics() { return analytics; } - @JsonProperty(JSON_PROPERTY_ANALYTICS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalytics(Boolean analytics) { this.analytics = analytics; } @@ -1447,14 +1500,10 @@ public SearchParams addAnalyticsTagsItem(String analyticsTagsItem) { @ApiModelProperty( value = "List of tags to apply to the query for analytics purposes." ) - @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAnalyticsTags() { return analyticsTags; } - @JsonProperty(JSON_PROPERTY_ANALYTICS_TAGS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAnalyticsTags(List analyticsTags) { this.analyticsTags = analyticsTags; } @@ -1473,14 +1522,10 @@ public SearchParams percentileComputation(Boolean percentileComputation) { @ApiModelProperty( value = "Whether to include or exclude a query from the processing-time percentile computation." ) - @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getPercentileComputation() { return percentileComputation; } - @JsonProperty(JSON_PROPERTY_PERCENTILE_COMPUTATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setPercentileComputation(Boolean percentileComputation) { this.percentileComputation = percentileComputation; } @@ -1499,14 +1544,10 @@ public SearchParams enableABTest(Boolean enableABTest) { @ApiModelProperty( value = "Whether this search should participate in running AB tests." ) - @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableABTest() { return enableABTest; } - @JsonProperty(JSON_PROPERTY_ENABLE_A_B_TEST) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableABTest(Boolean enableABTest) { this.enableABTest = enableABTest; } @@ -1523,14 +1564,10 @@ public SearchParams enableReRanking(Boolean enableReRanking) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether this search should use AI Re-Ranking.") - @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableReRanking() { return enableReRanking; } - @JsonProperty(JSON_PROPERTY_ENABLE_RE_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableReRanking(Boolean enableReRanking) { this.enableReRanking = enableReRanking; } @@ -1559,14 +1596,10 @@ public SearchParams addSearchableAttributesItem( @ApiModelProperty( value = "The complete list of attributes used for searching." ) - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getSearchableAttributes() { return searchableAttributes; } - @JsonProperty(JSON_PROPERTY_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSearchableAttributes(List searchableAttributes) { this.searchableAttributes = searchableAttributes; } @@ -1597,14 +1630,10 @@ public SearchParams addAttributesForFacetingItem( @ApiModelProperty( value = "The complete list of attributes that will be used for faceting." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesForFaceting() { return attributesForFaceting; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_FOR_FACETING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesForFaceting(List attributesForFaceting) { this.attributesForFaceting = attributesForFaceting; } @@ -1635,14 +1664,10 @@ public SearchParams addUnretrievableAttributesItem( @ApiModelProperty( value = "List of attributes that can’t be retrieved at query time." ) - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getUnretrievableAttributes() { return unretrievableAttributes; } - @JsonProperty(JSON_PROPERTY_UNRETRIEVABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUnretrievableAttributes(List unretrievableAttributes) { this.unretrievableAttributes = unretrievableAttributes; } @@ -1671,14 +1696,10 @@ public SearchParams addAttributesToRetrieveItem( @ApiModelProperty( value = "This parameter controls which attributes to retrieve and which not to retrieve." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToRetrieve() { return attributesToRetrieve; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_RETRIEVE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToRetrieve(List attributesToRetrieve) { this.attributesToRetrieve = attributesToRetrieve; } @@ -1709,14 +1730,10 @@ public SearchParams addRestrictSearchableAttributesItem( @ApiModelProperty( value = "Restricts a given query to look in only a subset of your searchable attributes." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRestrictSearchableAttributes() { return restrictSearchableAttributes; } - @JsonProperty(JSON_PROPERTY_RESTRICT_SEARCHABLE_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictSearchableAttributes( List restrictSearchableAttributes ) { @@ -1743,14 +1760,10 @@ public SearchParams addRankingItem(String rankingItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Controls how Algolia should sort your results.") - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getRanking() { return ranking; } - @JsonProperty(JSON_PROPERTY_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRanking(List ranking) { this.ranking = ranking; } @@ -1775,14 +1788,10 @@ public SearchParams addCustomRankingItem(String customRankingItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Specifies the custom ranking criterion.") - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getCustomRanking() { return customRanking; } - @JsonProperty(JSON_PROPERTY_CUSTOM_RANKING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setCustomRanking(List customRanking) { this.customRanking = customRanking; } @@ -1803,14 +1812,10 @@ public SearchParams relevancyStrictness(Integer relevancyStrictness) { value = "Controls the relevancy threshold below which less relevant results aren’t included in" + " the results." ) - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getRelevancyStrictness() { return relevancyStrictness; } - @JsonProperty(JSON_PROPERTY_RELEVANCY_STRICTNESS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRelevancyStrictness(Integer relevancyStrictness) { this.relevancyStrictness = relevancyStrictness; } @@ -1839,14 +1844,10 @@ public SearchParams addAttributesToHighlightItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "List of attributes to highlight.") - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToHighlight() { return attributesToHighlight; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToHighlight(List attributesToHighlight) { this.attributesToHighlight = attributesToHighlight; } @@ -1875,14 +1876,10 @@ public SearchParams addAttributesToSnippetItem( @ApiModelProperty( value = "List of attributes to snippet, with an optional maximum number of words to snippet." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAttributesToSnippet() { return attributesToSnippet; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTES_TO_SNIPPET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributesToSnippet(List attributesToSnippet) { this.attributesToSnippet = attributesToSnippet; } @@ -1902,14 +1899,10 @@ public SearchParams highlightPreTag(String highlightPreTag) { value = "The HTML string to insert before the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPreTag() { return highlightPreTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_PRE_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPreTag(String highlightPreTag) { this.highlightPreTag = highlightPreTag; } @@ -1929,14 +1922,10 @@ public SearchParams highlightPostTag(String highlightPostTag) { value = "The HTML string to insert after the highlighted parts in all highlight and snippet" + " results." ) - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getHighlightPostTag() { return highlightPostTag; } - @JsonProperty(JSON_PROPERTY_HIGHLIGHT_POST_TAG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHighlightPostTag(String highlightPostTag) { this.highlightPostTag = highlightPostTag; } @@ -1955,14 +1944,10 @@ public SearchParams snippetEllipsisText(String snippetEllipsisText) { @ApiModelProperty( value = "String used as an ellipsis indicator when a snippet is truncated." ) - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSnippetEllipsisText() { return snippetEllipsisText; } - @JsonProperty(JSON_PROPERTY_SNIPPET_ELLIPSIS_TEXT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSnippetEllipsisText(String snippetEllipsisText) { this.snippetEllipsisText = snippetEllipsisText; } @@ -1983,14 +1968,10 @@ public SearchParams restrictHighlightAndSnippetArrays( @ApiModelProperty( value = "Restrict highlighting and snippeting to items that matched the query." ) - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getRestrictHighlightAndSnippetArrays() { return restrictHighlightAndSnippetArrays; } - @JsonProperty(JSON_PROPERTY_RESTRICT_HIGHLIGHT_AND_SNIPPET_ARRAYS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRestrictHighlightAndSnippetArrays( Boolean restrictHighlightAndSnippetArrays ) { @@ -2009,14 +1990,10 @@ public SearchParams hitsPerPage(Integer hitsPerPage) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Set the number of hits per page.") - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getHitsPerPage() { return hitsPerPage; } - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -2037,14 +2014,10 @@ public SearchParams minWordSizefor1Typo(Integer minWordSizefor1Typo) { value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 1 typo." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor1Typo() { return minWordSizefor1Typo; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR1_TYPO) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor1Typo(Integer minWordSizefor1Typo) { this.minWordSizefor1Typo = minWordSizefor1Typo; } @@ -2065,14 +2038,10 @@ public SearchParams minWordSizefor2Typos(Integer minWordSizefor2Typos) { value = "Minimum number of characters a word in the query string must contain to accept matches" + " with 2 typos." ) - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinWordSizefor2Typos() { return minWordSizefor2Typos; } - @JsonProperty(JSON_PROPERTY_MIN_WORD_SIZEFOR2_TYPOS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinWordSizefor2Typos(Integer minWordSizefor2Typos) { this.minWordSizefor2Typos = minWordSizefor2Typos; } @@ -2091,14 +2060,10 @@ public SearchParams typoTolerance(TypoToleranceEnum typoTolerance) { @ApiModelProperty( value = "Controls whether typo tolerance is enabled and how it is applied." ) - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TypoToleranceEnum getTypoTolerance() { return typoTolerance; } - @JsonProperty(JSON_PROPERTY_TYPO_TOLERANCE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTypoTolerance(TypoToleranceEnum typoTolerance) { this.typoTolerance = typoTolerance; } @@ -2119,14 +2084,10 @@ public SearchParams allowTyposOnNumericTokens( @ApiModelProperty( value = "Whether to allow typos on numbers (“numeric tokens”) in the query string." ) - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAllowTyposOnNumericTokens() { return allowTyposOnNumericTokens; } - @JsonProperty(JSON_PROPERTY_ALLOW_TYPOS_ON_NUMERIC_TOKENS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAllowTyposOnNumericTokens(Boolean allowTyposOnNumericTokens) { this.allowTyposOnNumericTokens = allowTyposOnNumericTokens; } @@ -2159,14 +2120,10 @@ public SearchParams addDisableTypoToleranceOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable typo tolerance." ) - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableTypoToleranceOnAttributes() { return disableTypoToleranceOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_TYPO_TOLERANCE_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableTypoToleranceOnAttributes( List disableTypoToleranceOnAttributes ) { @@ -2185,14 +2142,10 @@ public SearchParams separatorsToIndex(String separatorsToIndex) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Control which separators are indexed.") - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getSeparatorsToIndex() { return separatorsToIndex; } - @JsonProperty(JSON_PROPERTY_SEPARATORS_TO_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSeparatorsToIndex(String separatorsToIndex) { this.separatorsToIndex = separatorsToIndex; } @@ -2211,14 +2164,10 @@ public SearchParams ignorePlurals(String ignorePlurals) { @ApiModelProperty( value = "Treats singular, plurals, and other forms of declensions as matching terms." ) - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIgnorePlurals() { return ignorePlurals; } - @JsonProperty(JSON_PROPERTY_IGNORE_PLURALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIgnorePlurals(String ignorePlurals) { this.ignorePlurals = ignorePlurals; } @@ -2237,14 +2186,10 @@ public SearchParams removeStopWords(String removeStopWords) { @ApiModelProperty( value = "Removes stop (common) words from the query before executing it." ) - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getRemoveStopWords() { return removeStopWords; } - @JsonProperty(JSON_PROPERTY_REMOVE_STOP_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveStopWords(String removeStopWords) { this.removeStopWords = removeStopWords; } @@ -2265,14 +2210,10 @@ public SearchParams keepDiacriticsOnCharacters( @ApiModelProperty( value = "List of characters that the engine shouldn’t automatically normalize." ) - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getKeepDiacriticsOnCharacters() { return keepDiacriticsOnCharacters; } - @JsonProperty(JSON_PROPERTY_KEEP_DIACRITICS_ON_CHARACTERS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setKeepDiacriticsOnCharacters(String keepDiacriticsOnCharacters) { this.keepDiacriticsOnCharacters = keepDiacriticsOnCharacters; } @@ -2301,14 +2242,10 @@ public SearchParams addQueryLanguagesItem(String queryLanguagesItem) { value = "Sets the languages to be used by language-specific settings and functionalities such as" + " ignorePlurals, removeStopWords, and CJK word-detection." ) - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getQueryLanguages() { return queryLanguages; } - @JsonProperty(JSON_PROPERTY_QUERY_LANGUAGES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryLanguages(List queryLanguages) { this.queryLanguages = queryLanguages; } @@ -2327,14 +2264,10 @@ public SearchParams decompoundQuery(Boolean decompoundQuery) { @ApiModelProperty( value = "Splits compound words into their composing atoms in the query." ) - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getDecompoundQuery() { return decompoundQuery; } - @JsonProperty(JSON_PROPERTY_DECOMPOUND_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDecompoundQuery(Boolean decompoundQuery) { this.decompoundQuery = decompoundQuery; } @@ -2351,14 +2284,10 @@ public SearchParams enableRules(Boolean enableRules) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Whether Rules should be globally enabled.") - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnableRules() { return enableRules; } - @JsonProperty(JSON_PROPERTY_ENABLE_RULES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnableRules(Boolean enableRules) { this.enableRules = enableRules; } @@ -2375,14 +2304,10 @@ public SearchParams enablePersonalization(Boolean enablePersonalization) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enable the Personalization feature.") - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getEnablePersonalization() { return enablePersonalization; } - @JsonProperty(JSON_PROPERTY_ENABLE_PERSONALIZATION) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setEnablePersonalization(Boolean enablePersonalization) { this.enablePersonalization = enablePersonalization; } @@ -2401,14 +2326,10 @@ public SearchParams queryType(QueryTypeEnum queryType) { @ApiModelProperty( value = "Controls if and how query words are interpreted as prefixes." ) - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public QueryTypeEnum getQueryType() { return queryType; } - @JsonProperty(JSON_PROPERTY_QUERY_TYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryType(QueryTypeEnum queryType) { this.queryType = queryType; } @@ -2429,14 +2350,10 @@ public SearchParams removeWordsIfNoResults( @ApiModelProperty( value = "Selects a strategy to remove words from the query when it doesn’t match any hits." ) - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RemoveWordsIfNoResultsEnum getRemoveWordsIfNoResults() { return removeWordsIfNoResults; } - @JsonProperty(JSON_PROPERTY_REMOVE_WORDS_IF_NO_RESULTS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRemoveWordsIfNoResults( RemoveWordsIfNoResultsEnum removeWordsIfNoResults ) { @@ -2455,14 +2372,10 @@ public SearchParams advancedSyntax(Boolean advancedSyntax) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables the advanced query syntax.") - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAdvancedSyntax() { return advancedSyntax; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntax(Boolean advancedSyntax) { this.advancedSyntax = advancedSyntax; } @@ -2489,14 +2402,10 @@ public SearchParams addOptionalWordsItem(String optionalWordsItem) { @ApiModelProperty( value = "A list of words that should be considered as optional when found in the query." ) - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getOptionalWords() { return optionalWords; } - @JsonProperty(JSON_PROPERTY_OPTIONAL_WORDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setOptionalWords(List optionalWords) { this.optionalWords = optionalWords; } @@ -2527,14 +2436,10 @@ public SearchParams addDisableExactOnAttributesItem( @ApiModelProperty( value = "List of attributes on which you want to disable the exact ranking criterion." ) - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getDisableExactOnAttributes() { return disableExactOnAttributes; } - @JsonProperty(JSON_PROPERTY_DISABLE_EXACT_ON_ATTRIBUTES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDisableExactOnAttributes( List disableExactOnAttributes ) { @@ -2558,14 +2463,10 @@ public SearchParams exactOnSingleWordQuery( value = "Controls how the exact ranking criterion is computed when the query contains only one" + " word." ) - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExactOnSingleWordQueryEnum getExactOnSingleWordQuery() { return exactOnSingleWordQuery; } - @JsonProperty(JSON_PROPERTY_EXACT_ON_SINGLE_WORD_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExactOnSingleWordQuery( ExactOnSingleWordQueryEnum exactOnSingleWordQuery ) { @@ -2599,14 +2500,10 @@ public SearchParams addAlternativesAsExactItem( value = "List of alternatives that should be considered an exact match by the exact ranking" + " criterion." ) - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAlternativesAsExact() { return alternativesAsExact; } - @JsonProperty(JSON_PROPERTY_ALTERNATIVES_AS_EXACT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAlternativesAsExact( List alternativesAsExact ) { @@ -2641,14 +2538,10 @@ public SearchParams addAdvancedSyntaxFeaturesItem( value = "Allows you to specify which advanced syntax features are active when ‘advancedSyntax’ is" + " enabled." ) - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getAdvancedSyntaxFeatures() { return advancedSyntaxFeatures; } - @JsonProperty(JSON_PROPERTY_ADVANCED_SYNTAX_FEATURES) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAdvancedSyntaxFeatures( List advancedSyntaxFeatures ) { @@ -2667,14 +2560,10 @@ public SearchParams distinct(Integer distinct) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Enables de-duplication or grouping of results.") - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getDistinct() { return distinct; } - @JsonProperty(JSON_PROPERTY_DISTINCT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setDistinct(Integer distinct) { this.distinct = distinct; } @@ -2693,14 +2582,10 @@ public SearchParams synonyms(Boolean synonyms) { @ApiModelProperty( value = "Whether to take into account an index’s synonyms for a particular search." ) - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getSynonyms() { return synonyms; } - @JsonProperty(JSON_PROPERTY_SYNONYMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setSynonyms(Boolean synonyms) { this.synonyms = synonyms; } @@ -2723,14 +2608,10 @@ public SearchParams replaceSynonymsInHighlight( value = "Whether to highlight and snippet the original word that matches the synonym or the" + " synonym itself." ) - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReplaceSynonymsInHighlight() { return replaceSynonymsInHighlight; } - @JsonProperty(JSON_PROPERTY_REPLACE_SYNONYMS_IN_HIGHLIGHT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setReplaceSynonymsInHighlight( Boolean replaceSynonymsInHighlight ) { @@ -2749,14 +2630,10 @@ public SearchParams minProximity(Integer minProximity) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Precision of the proximity ranking criterion.") - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMinProximity() { return minProximity; } - @JsonProperty(JSON_PROPERTY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMinProximity(Integer minProximity) { this.minProximity = minProximity; } @@ -2785,14 +2662,10 @@ public SearchParams addResponseFieldsItem(String responseFieldsItem) { value = "Choose which fields to return in the API response. This parameters applies to search and" + " browse queries." ) - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public List getResponseFields() { return responseFields; } - @JsonProperty(JSON_PROPERTY_RESPONSE_FIELDS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setResponseFields(List responseFields) { this.responseFields = responseFields; } @@ -2811,14 +2684,10 @@ public SearchParams maxFacetHits(Integer maxFacetHits) { @ApiModelProperty( value = "Maximum number of facet hits to return during a search for facet values." ) - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMaxFacetHits() { return maxFacetHits; } - @JsonProperty(JSON_PROPERTY_MAX_FACET_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMaxFacetHits(Integer maxFacetHits) { this.maxFacetHits = maxFacetHits; } @@ -2842,14 +2711,10 @@ public SearchParams attributeCriteriaComputedByMinProximity( value = "When attribute is ranked above proximity in your ranking formula, proximity is used to" + " select which searchable attribute is matched in the attribute ranking stage." ) - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getAttributeCriteriaComputedByMinProximity() { return attributeCriteriaComputedByMinProximity; } - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_CRITERIA_COMPUTED_BY_MIN_PROXIMITY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAttributeCriteriaComputedByMinProximity( Boolean attributeCriteriaComputedByMinProximity ) { @@ -2873,14 +2738,10 @@ public SearchParams renderingContent(Object renderingContent) { value = "Content defining how the search interface should be rendered. Can be set via the" + " settings for a default value and can be overridden via rules." ) - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Object getRenderingContent() { return renderingContent; } - @JsonProperty(JSON_PROPERTY_RENDERING_CONTENT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setRenderingContent(Object renderingContent) { this.renderingContent = renderingContent; } @@ -2918,7 +2779,7 @@ public boolean equals(Object o) { Objects.equals(this.length, searchParams.length) && Objects.equals(this.aroundLatLng, searchParams.aroundLatLng) && Objects.equals(this.aroundLatLngViaIP, searchParams.aroundLatLngViaIP) && - equalsNullable(this.aroundRadius, searchParams.aroundRadius) && + Objects.equals(this.aroundRadius, searchParams.aroundRadius) && Objects.equals(this.aroundPrecision, searchParams.aroundPrecision) && Objects.equals( this.minimumAroundRadius, @@ -3095,7 +2956,7 @@ public int hashCode() { length, aroundLatLng, aroundLatLngViaIP, - hashCodeNullable(aroundRadius), + aroundRadius, aroundPrecision, minimumAroundRadius, insideBoundingBox, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java index 32fb03c62e..543d50161c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java @@ -12,19 +12,16 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.Objects; /** SearchParamsAsString */ -@JsonPropertyOrder({ SearchParamsAsString.JSON_PROPERTY_PARAMS }) -@JsonTypeName("searchParamsAsString") public class SearchParamsAsString { - public static final String JSON_PROPERTY_PARAMS = "params"; + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; public SearchParamsAsString params(String params) { @@ -39,14 +36,10 @@ public SearchParamsAsString params(String params) { */ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParams() { return params; } - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParams(String params) { this.params = params; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index d3007a3dfe..5f33adae73 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -12,10 +12,7 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.HashMap; @@ -24,116 +21,137 @@ import java.util.Objects; /** SearchResponse */ -@JsonPropertyOrder( - { - SearchResponse.JSON_PROPERTY_AB_TEST_I_D, - SearchResponse.JSON_PROPERTY_AB_TEST_VARIANT_I_D, - SearchResponse.JSON_PROPERTY_AROUND_LAT_LNG, - SearchResponse.JSON_PROPERTY_AUTOMATIC_RADIUS, - SearchResponse.JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT, - SearchResponse.JSON_PROPERTY_EXHAUSTIVE_NB_HITS, - SearchResponse.JSON_PROPERTY_EXHAUSTIVE_TYPO, - SearchResponse.JSON_PROPERTY_FACETS, - SearchResponse.JSON_PROPERTY_FACETS_STATS, - SearchResponse.JSON_PROPERTY_HITS_PER_PAGE, - SearchResponse.JSON_PROPERTY_INDEX, - SearchResponse.JSON_PROPERTY_INDEX_USED, - SearchResponse.JSON_PROPERTY_MESSAGE, - SearchResponse.JSON_PROPERTY_NB_HITS, - SearchResponse.JSON_PROPERTY_NB_PAGES, - SearchResponse.JSON_PROPERTY_NB_SORTED_HITS, - SearchResponse.JSON_PROPERTY_PAGE, - SearchResponse.JSON_PROPERTY_PARAMS, - SearchResponse.JSON_PROPERTY_PARSED_QUERY, - SearchResponse.JSON_PROPERTY_PROCESSING_TIME_M_S, - SearchResponse.JSON_PROPERTY_QUERY, - SearchResponse.JSON_PROPERTY_QUERY_AFTER_REMOVAL, - SearchResponse.JSON_PROPERTY_SERVER_USED, - SearchResponse.JSON_PROPERTY_USER_DATA, - SearchResponse.JSON_PROPERTY_HITS, - } -) -@JsonTypeName("searchResponse") public class SearchResponse { - public static final String JSON_PROPERTY_AB_TEST_I_D = "abTestID"; + public static final String SERIALIZED_NAME_AB_TEST_I_D = "abTestID"; + + @SerializedName(SERIALIZED_NAME_AB_TEST_I_D) private Integer abTestID; - public static final String JSON_PROPERTY_AB_TEST_VARIANT_I_D = + public static final String SERIALIZED_NAME_AB_TEST_VARIANT_I_D = "abTestVariantID"; + + @SerializedName(SERIALIZED_NAME_AB_TEST_VARIANT_I_D) private Integer abTestVariantID; - public static final String JSON_PROPERTY_AROUND_LAT_LNG = "aroundLatLng"; + public static final String SERIALIZED_NAME_AROUND_LAT_LNG = "aroundLatLng"; + + @SerializedName(SERIALIZED_NAME_AROUND_LAT_LNG) private String aroundLatLng; - public static final String JSON_PROPERTY_AUTOMATIC_RADIUS = "automaticRadius"; + public static final String SERIALIZED_NAME_AUTOMATIC_RADIUS = + "automaticRadius"; + + @SerializedName(SERIALIZED_NAME_AUTOMATIC_RADIUS) private String automaticRadius; - public static final String JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT = + public static final String SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT = "exhaustiveFacetsCount"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_FACETS_COUNT) private Boolean exhaustiveFacetsCount; - public static final String JSON_PROPERTY_EXHAUSTIVE_NB_HITS = + public static final String SERIALIZED_NAME_EXHAUSTIVE_NB_HITS = "exhaustiveNbHits"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_NB_HITS) private Boolean exhaustiveNbHits; - public static final String JSON_PROPERTY_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + public static final String SERIALIZED_NAME_EXHAUSTIVE_TYPO = "exhaustiveTypo"; + + @SerializedName(SERIALIZED_NAME_EXHAUSTIVE_TYPO) private Boolean exhaustiveTypo; - public static final String JSON_PROPERTY_FACETS = "facets"; + public static final String SERIALIZED_NAME_FACETS = "facets"; + + @SerializedName(SERIALIZED_NAME_FACETS) private Map> facets = null; - public static final String JSON_PROPERTY_FACETS_STATS = "facets_stats"; + public static final String SERIALIZED_NAME_FACETS_STATS = "facets_stats"; + + @SerializedName(SERIALIZED_NAME_FACETS_STATS) private Map facetsStats = null; - public static final String JSON_PROPERTY_HITS_PER_PAGE = "hitsPerPage"; + public static final String SERIALIZED_NAME_HITS_PER_PAGE = "hitsPerPage"; + + @SerializedName(SERIALIZED_NAME_HITS_PER_PAGE) private Integer hitsPerPage = 20; - public static final String JSON_PROPERTY_INDEX = "index"; + public static final String SERIALIZED_NAME_INDEX = "index"; + + @SerializedName(SERIALIZED_NAME_INDEX) private String index; - public static final String JSON_PROPERTY_INDEX_USED = "indexUsed"; + public static final String SERIALIZED_NAME_INDEX_USED = "indexUsed"; + + @SerializedName(SERIALIZED_NAME_INDEX_USED) private String indexUsed; - public static final String JSON_PROPERTY_MESSAGE = "message"; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + + @SerializedName(SERIALIZED_NAME_MESSAGE) private String message; - public static final String JSON_PROPERTY_NB_HITS = "nbHits"; + public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + + @SerializedName(SERIALIZED_NAME_NB_HITS) private Integer nbHits; - public static final String JSON_PROPERTY_NB_PAGES = "nbPages"; + public static final String SERIALIZED_NAME_NB_PAGES = "nbPages"; + + @SerializedName(SERIALIZED_NAME_NB_PAGES) private Integer nbPages; - public static final String JSON_PROPERTY_NB_SORTED_HITS = "nbSortedHits"; + public static final String SERIALIZED_NAME_NB_SORTED_HITS = "nbSortedHits"; + + @SerializedName(SERIALIZED_NAME_NB_SORTED_HITS) private Integer nbSortedHits; - public static final String JSON_PROPERTY_PAGE = "page"; + public static final String SERIALIZED_NAME_PAGE = "page"; + + @SerializedName(SERIALIZED_NAME_PAGE) private Integer page = 0; - public static final String JSON_PROPERTY_PARAMS = "params"; + public static final String SERIALIZED_NAME_PARAMS = "params"; + + @SerializedName(SERIALIZED_NAME_PARAMS) private String params; - public static final String JSON_PROPERTY_PARSED_QUERY = "parsedQuery"; + public static final String SERIALIZED_NAME_PARSED_QUERY = "parsedQuery"; + + @SerializedName(SERIALIZED_NAME_PARSED_QUERY) private String parsedQuery; - public static final String JSON_PROPERTY_PROCESSING_TIME_M_S = + public static final String SERIALIZED_NAME_PROCESSING_TIME_M_S = "processingTimeMS"; + + @SerializedName(SERIALIZED_NAME_PROCESSING_TIME_M_S) private Integer processingTimeMS; - public static final String JSON_PROPERTY_QUERY = "query"; + public static final String SERIALIZED_NAME_QUERY = "query"; + + @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - public static final String JSON_PROPERTY_QUERY_AFTER_REMOVAL = + public static final String SERIALIZED_NAME_QUERY_AFTER_REMOVAL = "queryAfterRemoval"; + + @SerializedName(SERIALIZED_NAME_QUERY_AFTER_REMOVAL) private String queryAfterRemoval; - public static final String JSON_PROPERTY_SERVER_USED = "serverUsed"; + public static final String SERIALIZED_NAME_SERVER_USED = "serverUsed"; + + @SerializedName(SERIALIZED_NAME_SERVER_USED) private String serverUsed; - public static final String JSON_PROPERTY_USER_DATA = "userData"; + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) private Map userData = null; - public static final String JSON_PROPERTY_HITS = "hits"; + public static final String SERIALIZED_NAME_HITS = "hits"; + + @SerializedName(SERIALIZED_NAME_HITS) private List hits = new ArrayList<>(); public SearchResponse abTestID(Integer abTestID) { @@ -152,14 +170,10 @@ public SearchResponse abTestID(Integer abTestID) { value = "If a search encounters an index that is being A/B tested, abTestID reports the ongoing" + " A/B test ID." ) - @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestID() { return abTestID; } - @JsonProperty(JSON_PROPERTY_AB_TEST_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestID(Integer abTestID) { this.abTestID = abTestID; } @@ -180,14 +194,10 @@ public SearchResponse abTestVariantID(Integer abTestVariantID) { value = "If a search encounters an index that is being A/B tested, abTestVariantID reports the" + " variant ID of the index used." ) - @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getAbTestVariantID() { return abTestVariantID; } - @JsonProperty(JSON_PROPERTY_AB_TEST_VARIANT_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAbTestVariantID(Integer abTestVariantID) { this.abTestVariantID = abTestVariantID; } @@ -204,14 +214,10 @@ public SearchResponse aroundLatLng(String aroundLatLng) { */ @javax.annotation.Nullable @ApiModelProperty(value = "The computed geo location.") - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAroundLatLng() { return aroundLatLng; } - @JsonProperty(JSON_PROPERTY_AROUND_LAT_LNG) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAroundLatLng(String aroundLatLng) { this.aroundLatLng = aroundLatLng; } @@ -232,14 +238,10 @@ public SearchResponse automaticRadius(String automaticRadius) { value = "The automatically computed radius. For legacy reasons, this parameter is a string and" + " not an integer." ) - @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getAutomaticRadius() { return automaticRadius; } - @JsonProperty(JSON_PROPERTY_AUTOMATIC_RADIUS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setAutomaticRadius(String automaticRadius) { this.automaticRadius = automaticRadius; } @@ -258,14 +260,10 @@ public SearchResponse exhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { @ApiModelProperty( value = "Whether the facet count is exhaustive or approximate." ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getExhaustiveFacetsCount() { return exhaustiveFacetsCount; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_FACETS_COUNT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { this.exhaustiveFacetsCount = exhaustiveFacetsCount; } @@ -285,14 +283,10 @@ public SearchResponse exhaustiveNbHits(Boolean exhaustiveNbHits) { required = true, value = "Indicate if the nbHits count was exhaustive or approximate" ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveNbHits() { return exhaustiveNbHits; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveNbHits(Boolean exhaustiveNbHits) { this.exhaustiveNbHits = exhaustiveNbHits; } @@ -314,14 +308,10 @@ public SearchResponse exhaustiveTypo(Boolean exhaustiveTypo) { value = "Indicate if the typo-tolerence search was exhaustive or approximate (only included when" + " typo-tolerance is enabled)" ) - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getExhaustiveTypo() { return exhaustiveTypo; } - @JsonProperty(JSON_PROPERTY_EXHAUSTIVE_TYPO) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExhaustiveTypo(Boolean exhaustiveTypo) { this.exhaustiveTypo = exhaustiveTypo; } @@ -352,14 +342,10 @@ public SearchResponse putFacetsItem( example = "{\"category\":{\"food\":1,\"tech\":42}}", value = "A mapping of each facet name to the corresponding facet counts." ) - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map> getFacets() { return facets; } - @JsonProperty(JSON_PROPERTY_FACETS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacets(Map> facets) { this.facets = facets; } @@ -389,14 +375,10 @@ public SearchResponse putFacetsStatsItem( */ @javax.annotation.Nullable @ApiModelProperty(value = "Statistics for numerical facets.") - @JsonProperty(JSON_PROPERTY_FACETS_STATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Map getFacetsStats() { return facetsStats; } - @JsonProperty(JSON_PROPERTY_FACETS_STATS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setFacetsStats( Map facetsStats ) { @@ -415,14 +397,10 @@ public SearchResponse hitsPerPage(Integer hitsPerPage) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Set the number of hits per page.") - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getHitsPerPage() { return hitsPerPage; } - @JsonProperty(JSON_PROPERTY_HITS_PER_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHitsPerPage(Integer hitsPerPage) { this.hitsPerPage = hitsPerPage; } @@ -442,14 +420,10 @@ public SearchResponse index(String index) { example = "indexName", value = "Index name used for the query." ) - @JsonProperty(JSON_PROPERTY_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndex() { return index; } - @JsonProperty(JSON_PROPERTY_INDEX) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndex(String index) { this.index = index; } @@ -471,14 +445,10 @@ public SearchResponse indexUsed(String indexUsed) { value = "Index name used for the query. In the case of an A/B test, the targeted index isn’t" + " always the index used by the query." ) - @JsonProperty(JSON_PROPERTY_INDEX_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getIndexUsed() { return indexUsed; } - @JsonProperty(JSON_PROPERTY_INDEX_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setIndexUsed(String indexUsed) { this.indexUsed = indexUsed; } @@ -495,14 +465,10 @@ public SearchResponse message(String message) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Used to return warnings about the query.") - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getMessage() { return message; } - @JsonProperty(JSON_PROPERTY_MESSAGE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMessage(String message) { this.message = message; } @@ -523,14 +489,10 @@ public SearchResponse nbHits(Integer nbHits) { required = true, value = "Number of hits that the search query matched" ) - @JsonProperty(JSON_PROPERTY_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbHits() { return nbHits; } - @JsonProperty(JSON_PROPERTY_NB_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbHits(Integer nbHits) { this.nbHits = nbHits; } @@ -551,14 +513,10 @@ public SearchResponse nbPages(Integer nbPages) { required = true, value = "Number of pages available for the current query" ) - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getNbPages() { return nbPages; } - @JsonProperty(JSON_PROPERTY_NB_PAGES) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setNbPages(Integer nbPages) { this.nbPages = nbPages; } @@ -578,14 +536,10 @@ public SearchResponse nbSortedHits(Integer nbSortedHits) { example = "20", value = "The number of hits selected and sorted by the relevant sort algorithm" ) - @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getNbSortedHits() { return nbSortedHits; } - @JsonProperty(JSON_PROPERTY_NB_SORTED_HITS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setNbSortedHits(Integer nbSortedHits) { this.nbSortedHits = nbSortedHits; } @@ -602,14 +556,10 @@ public SearchResponse page(Integer page) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "Specify the page to retrieve.") - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getPage() { return page; } - @JsonProperty(JSON_PROPERTY_PAGE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setPage(Integer page) { this.page = page; } @@ -630,14 +580,10 @@ public SearchResponse params(String params) { required = true, value = "A url-encoded string of all search parameters." ) - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getParams() { return params; } - @JsonProperty(JSON_PROPERTY_PARAMS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setParams(String params) { this.params = params; } @@ -656,14 +602,10 @@ public SearchResponse parsedQuery(String parsedQuery) { @ApiModelProperty( value = "The query string that will be searched, after normalization." ) - @JsonProperty(JSON_PROPERTY_PARSED_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getParsedQuery() { return parsedQuery; } - @JsonProperty(JSON_PROPERTY_PARSED_QUERY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setParsedQuery(String parsedQuery) { this.parsedQuery = parsedQuery; } @@ -684,14 +626,10 @@ public SearchResponse processingTimeMS(Integer processingTimeMS) { required = true, value = "Time the server took to process the request, in milliseconds." ) - @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getProcessingTimeMS() { return processingTimeMS; } - @JsonProperty(JSON_PROPERTY_PROCESSING_TIME_M_S) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setProcessingTimeMS(Integer processingTimeMS) { this.processingTimeMS = processingTimeMS; } @@ -708,14 +646,10 @@ public SearchResponse query(String query) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "The text to search in the index.") - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getQuery() { return query; } - @JsonProperty(JSON_PROPERTY_QUERY) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setQuery(String query) { this.query = query; } @@ -736,14 +670,10 @@ public SearchResponse queryAfterRemoval(String queryAfterRemoval) { value = "A markup text indicating which parts of the original query have been removed in order to" + " retrieve a non-empty result set." ) - @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getQueryAfterRemoval() { return queryAfterRemoval; } - @JsonProperty(JSON_PROPERTY_QUERY_AFTER_REMOVAL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setQueryAfterRemoval(String queryAfterRemoval) { this.queryAfterRemoval = queryAfterRemoval; } @@ -762,14 +692,10 @@ public SearchResponse serverUsed(String serverUsed) { @ApiModelProperty( value = "Actual host name of the server that processed the request." ) - @JsonProperty(JSON_PROPERTY_SERVER_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getServerUsed() { return serverUsed; } - @JsonProperty(JSON_PROPERTY_SERVER_USED) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setServerUsed(String serverUsed) { this.serverUsed = serverUsed; } @@ -794,20 +720,10 @@ public SearchResponse putUserDataItem(String key, Object userDataItem) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Lets you store custom data in your indices.") - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public Map getUserData() { return userData; } - @JsonProperty(JSON_PROPERTY_USER_DATA) - @JsonInclude( - content = JsonInclude.Include.ALWAYS, - value = JsonInclude.Include.USE_DEFAULTS - ) public void setUserData(Map userData) { this.userData = userData; } @@ -829,14 +745,10 @@ public SearchResponse addHitsItem(Record hitsItem) { */ @javax.annotation.Nonnull @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getHits() { return hits; } - @JsonProperty(JSON_PROPERTY_HITS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setHits(List hits) { this.hits = hits; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 822c1e1d56..4564cffef4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -12,28 +12,22 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.util.Objects; /** SetSettingsResponse */ -@JsonPropertyOrder( - { - SetSettingsResponse.JSON_PROPERTY_TASK_I_D, - SetSettingsResponse.JSON_PROPERTY_UPDATED_AT, - } -) -@JsonTypeName("setSettingsResponse") public class SetSettingsResponse { - public static final String JSON_PROPERTY_TASK_I_D = "taskID"; + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) private Integer taskID; - public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt"; + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) private OffsetDateTime updatedAt; public SetSettingsResponse taskID(Integer taskID) { @@ -48,14 +42,10 @@ public SetSettingsResponse taskID(Integer taskID) { */ @javax.annotation.Nullable @ApiModelProperty(value = "taskID of the indexing task to wait for.") - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTaskID() { return taskID; } - @JsonProperty(JSON_PROPERTY_TASK_I_D) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setTaskID(Integer taskID) { this.taskID = taskID; } @@ -72,14 +62,10 @@ public SetSettingsResponse updatedAt(OffsetDateTime updatedAt) { */ @javax.annotation.Nullable @ApiModelProperty(value = "Date of last update (ISO-8601 format).") - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public OffsetDateTime getUpdatedAt() { return updatedAt; } - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setUpdatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java index 796d1ab3f0..d8a19e3233 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -12,26 +12,25 @@ package com.algolia.model; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonValue; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; import java.util.Objects; /** SnippetResult */ -@JsonPropertyOrder( - { SnippetResult.JSON_PROPERTY_VALUE, SnippetResult.JSON_PROPERTY_MATCH_LEVEL } -) -@JsonTypeName("snippetResult") public class SnippetResult { - public static final String JSON_PROPERTY_VALUE = "value"; + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) private String value; /** Indicates how well the attribute matched the search query. */ + @JsonAdapter(MatchLevelEnum.Adapter.class) public enum MatchLevelEnum { NONE("none"), @@ -45,7 +44,6 @@ public enum MatchLevelEnum { this.value = value; } - @JsonValue public String getValue() { return value; } @@ -55,7 +53,6 @@ public String toString() { return String.valueOf(value); } - @JsonCreator public static MatchLevelEnum fromValue(String value) { for (MatchLevelEnum b : MatchLevelEnum.values()) { if (b.value.equals(value)) { @@ -64,9 +61,29 @@ public static MatchLevelEnum fromValue(String value) { } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final MatchLevelEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MatchLevelEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return MatchLevelEnum.fromValue(value); + } + } } - public static final String JSON_PROPERTY_MATCH_LEVEL = "matchLevel"; + public static final String SERIALIZED_NAME_MATCH_LEVEL = "matchLevel"; + + @SerializedName(SERIALIZED_NAME_MATCH_LEVEL) private MatchLevelEnum matchLevel; public SnippetResult value(String value) { @@ -84,14 +101,10 @@ public SnippetResult value(String value) { example = "George Clooney...", value = "Markup text with occurrences highlighted." ) - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getValue() { return value; } - @JsonProperty(JSON_PROPERTY_VALUE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setValue(String value) { this.value = value; } @@ -110,14 +123,10 @@ public SnippetResult matchLevel(MatchLevelEnum matchLevel) { @ApiModelProperty( value = "Indicates how well the attribute matched the search query." ) - @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public MatchLevelEnum getMatchLevel() { return matchLevel; } - @JsonProperty(JSON_PROPERTY_MATCH_LEVEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public void setMatchLevel(MatchLevelEnum matchLevel) { this.matchLevel = matchLevel; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 8bedb140d4..c17687a086 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -1,8 +1,23 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.search; +import com.algolia.ApiCallback; import com.algolia.ApiClient; -import com.algolia.EncodingUtils; -import com.algolia.model.ApiResponse; +import com.algolia.ApiException; +import com.algolia.ApiResponse; +import com.algolia.Configuration; +import com.algolia.Pair; import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; import com.algolia.model.DeleteIndexResponse; @@ -13,174 +28,778 @@ import com.algolia.model.OperationIndexObject; import com.algolia.model.OperationIndexResponse; import com.algolia.model.SaveObjectResponse; +import com.algolia.model.SearchParams; import com.algolia.model.SearchResponse; import com.algolia.model.SetSettingsResponse; -import com.algolia.model.UNKNOWN_BASE_TYPE; -import feign.*; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-09T15:52:44.533542+01:00[Europe/Paris]" -) -public interface SearchApi extends ApiClient.Api { +public class SearchApi { + + private ApiClient localVarApiClient; + + public SearchApi() { + this(Configuration.getDefaultApiClient()); + } + + public SearchApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + /** + * Build call for batch + * + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call batchCall( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = batchObject; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/batch".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call batchValidateBeforeCall( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling batch(Async)" + ); + } + + // verify the required parameter 'batchObject' is set + if (batchObject == null) { + throw new ApiException( + "Missing the required parameter 'batchObject' when calling batch(Async)" + ); + } + + okhttp3.Call localVarCall = batchCall(indexName, batchObject, _callback); + return localVarCall; + } + /** * Performs multiple write operations in a single API call. * * @param indexName The index in which to perform the request. (required) * @param batchObject (required) * @return BatchResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/batch") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - BatchResponse batch( - @Param("indexName") String indexName, - BatchObject batchObject - ); + public BatchResponse batch(String indexName, BatchObject batchObject) + throws ApiException { + ApiResponse localVarResp = batchWithHttpInfo( + indexName, + batchObject + ); + return localVarResp.getData(); + } /** - * Similar to batch but it also returns the http response headers . Performs multiple - * write operations in a single API call. + * Performs multiple write operations in a single API call. * * @param indexName The index in which to perform the request. (required) * @param batchObject (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ApiResponse<BatchResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/batch") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse batchWithHttpInfo( - @Param("indexName") String indexName, + public ApiResponse batchWithHttpInfo( + String indexName, BatchObject batchObject - ); + ) throws ApiException { + okhttp3.Call localVarCall = batchValidateBeforeCall( + indexName, + batchObject, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Performs multiple write operations in a single API call. + * + * @param indexName The index in which to perform the request. (required) + * @param batchObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call batchAsync( + String indexName, + BatchObject batchObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = batchValidateBeforeCall( + indexName, + batchObject, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteIndex + * + * @param indexName The index in which to perform the request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call deleteIndexCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteIndexValidateBeforeCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling deleteIndex(Async)" + ); + } + + okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); + return localVarCall; + } /** * Delete index. Delete an existing index. * * @param indexName The index in which to perform the request. (required) * @return DeleteIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { + ApiResponse localVarResp = deleteIndexWithHttpInfo( + indexName + ); + return localVarResp.getData(); + } + + /** + * Delete index. Delete an existing index. + * + * @param indexName The index in which to perform the request. (required) + * @return ApiResponse<DeleteIndexResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse deleteIndexWithHttpInfo( + String indexName + ) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete index. (asynchronously) Delete an existing index. + * + * @param indexName The index in which to perform the request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("DELETE /1/indexes/{indexName}") - @Headers({ "Accept: application/json" }) - DeleteIndexResponse deleteIndex(@Param("indexName") String indexName); + public okhttp3.Call deleteIndexAsync( + String indexName, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall( + indexName, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** - * Delete index. Similar to deleteIndex but it also returns the http response headers - * . Delete an existing index. + * Build call for getSettings * * @param indexName The index in which to perform the request. (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("DELETE /1/indexes/{indexName}") - @Headers({ "Accept: application/json" }) - ApiResponse deleteIndexWithHttpInfo( - @Param("indexName") String indexName - ); + public okhttp3.Call getSettingsCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/settings".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSettingsValidateBeforeCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling getSettings(Async)" + ); + } + + okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); + return localVarCall; + } /** * Retrieve settings of a given indexName. * * @param indexName The index in which to perform the request. (required) * @return IndexSettings + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes/{indexName}/settings") - @Headers({ "Accept: application/json" }) - IndexSettings getSettings(@Param("indexName") String indexName); + public IndexSettings getSettings(String indexName) throws ApiException { + ApiResponse localVarResp = getSettingsWithHttpInfo( + indexName + ); + return localVarResp.getData(); + } /** - * Similar to getSettings but it also returns the http response headers . Retrieve - * settings of a given indexName. + * Retrieve settings of a given indexName. * * @param indexName The index in which to perform the request. (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ApiResponse<IndexSettings> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes/{indexName}/settings") - @Headers({ "Accept: application/json" }) - ApiResponse getSettingsWithHttpInfo( - @Param("indexName") String indexName - ); + public ApiResponse getSettingsWithHttpInfo(String indexName) + throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } /** - * List existing indexes. List existing indexes from an application. + * (asynchronously) Retrieve settings of a given indexName. + * + * @param indexName The index in which to perform the request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSettingsAsync( + String indexName, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall( + indexName, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listIndices * * @param page Requested page (zero-based). When specified, will retrieve a specific page; the * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * (optional) - * @return ListIndicesResponse + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes?Page={page}") - @Headers({ "Accept: application/json" }) - ListIndicesResponse listIndices(@Param("page") Integer page); + public okhttp3.Call listIndicesCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("Page", page) + ); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listIndicesValidateBeforeCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesCall(page, _callback); + return localVarCall; + } /** - * List existing indexes. Similar to listIndices but it also returns the http - * response headers . List existing indexes from an application. + * List existing indexes. List existing indexes from an application. * * @param page Requested page (zero-based). When specified, will retrieve a specific page; the * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * (optional) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ListIndicesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes?Page={page}") - @Headers({ "Accept: application/json" }) - ApiResponse listIndicesWithHttpInfo( - @Param("page") Integer page - ); + public ListIndicesResponse listIndices(Integer page) throws ApiException { + ApiResponse localVarResp = listIndicesWithHttpInfo( + page + ); + return localVarResp.getData(); + } /** - * List existing indexes. List existing indexes from an application. Note, this is equivalent to - * the other listIndices method, but with the query parameters collected into a - * single Map parameter. This is convenient for services with optional query parameters, - * especially when used with the {@link ListIndicesQueryParams} class that allows for building up - * this map in a fluent style. - * - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map: - *

    - *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; - * the page size is implicitly set to 100. When null, will retrieve all indices (no - * pagination). (optional) - *
+ * List existing indexes. List existing indexes from an application. * - * @return ListIndicesResponse + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @return ApiResponse<ListIndicesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes?Page={page}") - @Headers({ "Accept: application/json" }) - ListIndicesResponse listIndices( - @QueryMap(encoded = true) Map queryParams - ); + public ApiResponse listIndicesWithHttpInfo(Integer page) + throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } /** - * List existing indexes. List existing indexes from an application. Note, this is equivalent to - * the other listIndices that receives the query parameters as a map, but this one - * also exposes the Http response headers - * - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map: - *

    - *
  • page - Requested page (zero-based). When specified, will retrieve a specific page; - * the page size is implicitly set to 100. When null, will retrieve all indices (no - * pagination). (optional) - *
+ * List existing indexes. (asynchronously) List existing indexes from an application. * - * @return ListIndicesResponse + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("GET /1/indexes?Page={page}") - @Headers({ "Accept: application/json" }) - ApiResponse listIndicesWithHttpInfo( - @QueryMap(encoded = true) Map queryParams - ); + public okhttp3.Call listIndicesAsync( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** - * A convenience class for generating query parameters for the listIndices method in - * a fluent style. + * Build call for multipleQueries + * + * @param multipleQueriesObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - public static class ListIndicesQueryParams extends HashMap { + public okhttp3.Call multipleQueriesCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = multipleQueriesObject; + + // create path and map variables + String localVarPath = "/1/indexes/*/queries"; - public ListIndicesQueryParams page(final Integer value) { - put("Page", EncodingUtils.encode(value)); - return this; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call multipleQueriesValidateBeforeCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'multipleQueriesObject' is set + if (multipleQueriesObject == null) { + throw new ApiException( + "Missing the required parameter 'multipleQueriesObject' when calling" + + " multipleQueries(Async)" + ); + } + + okhttp3.Call localVarCall = multipleQueriesCall( + multipleQueriesObject, + _callback + ); + return localVarCall; } /** @@ -188,25 +807,182 @@ public ListIndicesQueryParams page(final Integer value) { * * @param multipleQueriesObject (required) * @return MultipleQueriesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/*/queries") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - MultipleQueriesResponse multipleQueries( + public MultipleQueriesResponse multipleQueries( MultipleQueriesObject multipleQueriesObject - ); + ) throws ApiException { + ApiResponse localVarResp = multipleQueriesWithHttpInfo( + multipleQueriesObject + ); + return localVarResp.getData(); + } /** - * Similar to multipleQueries but it also returns the http response headers . Get - * search results for the given requests. + * Get search results for the given requests. * * @param multipleQueriesObject (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ApiResponse<MultipleQueriesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/*/queries") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse multipleQueriesWithHttpInfo( + public ApiResponse multipleQueriesWithHttpInfo( MultipleQueriesObject multipleQueriesObject - ); + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Get search results for the given requests. + * + * @param multipleQueriesObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call multipleQueriesAsync( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for operationIndex + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = operationIndexObject; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/operation".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call operationIndexValidateBeforeCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling operationIndex(Async)" + ); + } + + // verify the required parameter 'operationIndexObject' is set + if (operationIndexObject == null) { + throw new ApiException( + "Missing the required parameter 'operationIndexObject' when calling" + + " operationIndex(Async)" + ); + } + + okhttp3.Call localVarCall = operationIndexCall( + indexName, + operationIndexObject, + _callback + ); + return localVarCall; + } /** * Copy/move index. Peforms a copy or a move operation on a index. @@ -214,28 +990,189 @@ ApiResponse multipleQueriesWithHttpInfo( * @param indexName The index in which to perform the request. (required) * @param operationIndexObject (required) * @return OperationIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/operation") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - OperationIndexResponse operationIndex( - @Param("indexName") String indexName, + public OperationIndexResponse operationIndex( + String indexName, OperationIndexObject operationIndexObject - ); + ) throws ApiException { + ApiResponse localVarResp = operationIndexWithHttpInfo( + indexName, + operationIndexObject + ); + return localVarResp.getData(); + } /** - * Copy/move index. Similar to operationIndex but it also returns the http response - * headers . Peforms a copy or a move operation on a index. + * Copy/move index. Peforms a copy or a move operation on a index. * * @param indexName The index in which to perform the request. (required) * @param operationIndexObject (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ApiResponse<OperationIndexResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/operation") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse operationIndexWithHttpInfo( - @Param("indexName") String indexName, + public ApiResponse operationIndexWithHttpInfo( + String indexName, OperationIndexObject operationIndexObject - ); + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Copy/move index. (asynchronously) Peforms a copy or a move operation on a index. + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexAsync( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for saveObject + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call saveObjectValidateBeforeCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling saveObject(Async)" + ); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException( + "Missing the required parameter 'requestBody' when calling saveObject(Async)" + ); + } + + okhttp3.Call localVarCall = saveObjectCall( + indexName, + requestBody, + _callback + ); + return localVarCall; + } /** * Add an object to the index, automatically assigning it an object ID. @@ -243,164 +1180,490 @@ ApiResponse operationIndexWithHttpInfo( * @param indexName The index in which to perform the request. (required) * @param requestBody The Algolia object. (required) * @return SaveObjectResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - SaveObjectResponse saveObject( - @Param("indexName") String indexName, + public SaveObjectResponse saveObject( + String indexName, Map requestBody - ); + ) throws ApiException { + ApiResponse localVarResp = saveObjectWithHttpInfo( + indexName, + requestBody + ); + return localVarResp.getData(); + } /** - * Similar to saveObject but it also returns the http response headers . Add an - * object to the index, automatically assigning it an object ID. + * Add an object to the index, automatically assigning it an object ID. * * @param indexName The index in which to perform the request. (required) * @param requestBody The Algolia object. (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @return ApiResponse<SaveObjectResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse saveObjectWithHttpInfo( - @Param("indexName") String indexName, + public ApiResponse saveObjectWithHttpInfo( + String indexName, Map requestBody - ); + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Add an object to the index, automatically assigning it an object ID. + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectAsync( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for search + * + * @param indexName The index in which to perform the request. (required) + * @param searchParams (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call searchCall( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = searchParams; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/query".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchValidateBeforeCall( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling search(Async)" + ); + } + + // verify the required parameter 'searchParams' is set + if (searchParams == null) { + throw new ApiException( + "Missing the required parameter 'searchParams' when calling search(Async)" + ); + } + + okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); + return localVarCall; + } /** * Get search results. * * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) + * @param searchParams (required) * @return SearchResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/query") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - SearchResponse search( - @Param("indexName") String indexName, - UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE - ); + public SearchResponse search(String indexName, SearchParams searchParams) + throws ApiException { + ApiResponse localVarResp = searchWithHttpInfo( + indexName, + searchParams + ); + return localVarResp.getData(); + } /** - * Similar to search but it also returns the http response headers . Get search - * results. + * Get search results. * * @param indexName The index in which to perform the request. (required) - * @param UNKNOWN_BASE_TYPE (required) - * @return A ApiResponse that wraps the response boyd and the http headers. + * @param searchParams (required) + * @return ApiResponse<SearchResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine("POST /1/indexes/{indexName}/query") - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse searchWithHttpInfo( - @Param("indexName") String indexName, - UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE - ); + public ApiResponse searchWithHttpInfo( + String indexName, + SearchParams searchParams + ) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall( + indexName, + searchParams, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } /** - * Update settings of a given indexName. Only specified settings are overridden; unspecified - * settings are left unchanged. Specifying null for a setting resets it to its default value. + * (asynchronously) Get search results. * * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @return SetSettingsResponse + * @param searchParams (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine( - "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" - ) - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - SetSettingsResponse setSettings( - @Param("indexName") String indexName, - IndexSettings indexSettings, - @Param("forwardToReplicas") Boolean forwardToReplicas - ); + public okhttp3.Call searchAsync( + String indexName, + SearchParams searchParams, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = searchValidateBeforeCall( + indexName, + searchParams, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** - * Similar to setSettings but it also returns the http response headers . Update - * settings of a given indexName. Only specified settings are overridden; unspecified settings are - * left unchanged. Specifying null for a setting resets it to its default value. + * Build call for setSettings * * @param indexName The index in which to perform the request. (required) * @param indexSettings (required) * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) - * @return A ApiResponse that wraps the response boyd and the http headers. - */ - @RequestLine( - "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" - ) - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse setSettingsWithHttpInfo( - @Param("indexName") String indexName, + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call setSettingsCall( + String indexName, IndexSettings indexSettings, - @Param("forwardToReplicas") Boolean forwardToReplicas - ); + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = indexSettings; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/settings".replaceAll( + "\\{" + "indexName" + "\\}", + localVarApiClient.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair( + "forwardToReplicas", + forwardToReplicas + ) + ); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = localVarApiClient.selectHeaderAccept( + localVarAccepts + ); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = localVarApiClient.selectHeaderContentType( + localVarContentTypes + ); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return localVarApiClient.buildCall( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call setSettingsValidateBeforeCall( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling setSettings(Async)" + ); + } + + // verify the required parameter 'indexSettings' is set + if (indexSettings == null) { + throw new ApiException( + "Missing the required parameter 'indexSettings' when calling setSettings(Async)" + ); + } + + okhttp3.Call localVarCall = setSettingsCall( + indexName, + indexSettings, + forwardToReplicas, + _callback + ); + return localVarCall; + } /** * Update settings of a given indexName. Only specified settings are overridden; unspecified * settings are left unchanged. Specifying null for a setting resets it to its default value. - * Note, this is equivalent to the other setSettings method, but with the query - * parameters collected into a single Map parameter. This is convenient for services with optional - * query parameters, especially when used with the {@link SetSettingsQueryParams} class that - * allows for building up this map in a fluent style. * * @param indexName The index in which to perform the request. (required) * @param indexSettings (required) - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map: - *

    - *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given - * indexName. (optional) - *
- * + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @return SetSettingsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine( - "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" - ) - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - SetSettingsResponse setSettings( - @Param("indexName") String indexName, + public SetSettingsResponse setSettings( + String indexName, IndexSettings indexSettings, - @QueryMap(encoded = true) Map queryParams - ); + Boolean forwardToReplicas + ) throws ApiException { + ApiResponse localVarResp = setSettingsWithHttpInfo( + indexName, + indexSettings, + forwardToReplicas + ); + return localVarResp.getData(); + } /** * Update settings of a given indexName. Only specified settings are overridden; unspecified * settings are left unchanged. Specifying null for a setting resets it to its default value. - * Note, this is equivalent to the other setSettings that receives the query - * parameters as a map, but this one also exposes the Http response headers * * @param indexName The index in which to perform the request. (required) * @param indexSettings (required) - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map: - *

    - *
  • forwardToReplicas - When true, changes are also propagated to replicas of the given - * indexName. (optional) - *
- * - * @return SetSettingsResponse + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return ApiResponse<SetSettingsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - @RequestLine( - "PUT /1/indexes/{indexName}/settings?forwardToReplicas={forwardToReplicas}" - ) - @Headers({ "Content-Type: application/json", "Accept: application/json" }) - ApiResponse setSettingsWithHttpInfo( - @Param("indexName") String indexName, + public ApiResponse setSettingsWithHttpInfo( + String indexName, IndexSettings indexSettings, - @QueryMap(encoded = true) Map queryParams - ); + Boolean forwardToReplicas + ) throws ApiException { + okhttp3.Call localVarCall = setSettingsValidateBeforeCall( + indexName, + indexSettings, + forwardToReplicas, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } /** - * A convenience class for generating query parameters for the setSettings method in - * a fluent style. + * (asynchronously) Update settings of a given indexName. Only specified settings are overridden; + * unspecified settings are left unchanged. Specifying null for a setting resets it to its default + * value. + * + * @param indexName The index in which to perform the request. (required) + * @param indexSettings (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
*/ - public static class SetSettingsQueryParams extends HashMap { - - public SetSettingsQueryParams forwardToReplicas(final Boolean value) { - put("forwardToReplicas", EncodingUtils.encode(value)); - return this; - } + public okhttp3.Call setSettingsAsync( + String indexName, + IndexSettings indexSettings, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = setSettingsValidateBeforeCall( + indexName, + indexSettings, + forwardToReplicas, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; } } diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml index c56b3916f6..1db6bd5da5 100644 --- a/clients/algoliasearch-client-java-2/pom.xml +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -33,6 +33,20 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + org.apache.maven.plugins maven-enforcer-plugin @@ -84,7 +98,6 @@ - org.apache.maven.plugins maven-jar-plugin @@ -117,36 +130,8 @@ - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - @@ -178,73 +163,38 @@ io.swagger swagger-annotations - ${swagger-annotations-version} + ${swagger-core-version} - com.google.code.findbugs jsr305 3.0.2 - - - - io.github.openfeign - feign-core - ${feign-version} - - - io.github.openfeign - feign-jackson - ${feign-version} - - - io.github.openfeign - feign-slf4j - ${feign-version} - - - io.github.openfeign.form - feign-form - ${feign-form-version} - - io.github.openfeign - feign-okhttp - ${feign-version} + com.squareup.okhttp3 + okhttp + ${okhttp-version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} + com.google.code.gson + gson + ${gson-version} - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind-version} + io.gsonfire + gson-fire + ${gson-fire-version} - org.openapitools - jackson-databind-nullable - ${jackson-databind-nullable-version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - - com.github.scribejava - scribejava-core - ${scribejava-version} + org.apache.commons + commons-lang3 + ${commons-lang3-version} jakarta.annotation @@ -252,59 +202,37 @@ ${jakarta-annotation-version} provided - - - - ch.qos.logback - logback-classic - 1.2.3 - test - - org.junit.jupiter - junit-jupiter - ${junit-version} - test + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + - org.junit.jupiter - junit-jupiter-params + junit + junit ${junit-version} test - org.hamcrest - hamcrest - 2.2 - test - - - com.github.tomakehurst - wiremock-jre8 - 2.27.2 - test - - - commons-io - commons-io - 2.8.0 + org.mockito + mockito-core + 3.11.2 test - UTF-8 1.8 ${java.version} ${java.version} - 1.5.24 - 10.11 - 3.8.0 - 2.10.3 + 1.8.5 + 1.6.2 + 4.9.1 + 2.8.6 + 3.11 0.2.1 - 2.10.3 1.3.5 - 5.7.0 - 1.0.0 - 8.0.0 + 4.13.1 + UTF-8 diff --git a/openapitools.json b/openapitools.json index 16995792a9..7f81565763 100644 --- a/openapitools.json +++ b/openapitools.json @@ -69,8 +69,7 @@ "apiPackage": "com.algolia.search", "invokerPackage": "com.algolia", "modelPackage": "com.algolia.model", - "library": "feign", - "legacyDiscriminatorBehavior": false, + "library": "okhttp-gson", "glob": "specs/search/spec.yml", "gitHost": "algolia", "gitUserId": "algolia", diff --git a/scripts/multiplexer.sh b/scripts/multiplexer.sh index bf36ec37e2..96aa2ff7d8 100755 --- a/scripts/multiplexer.sh +++ b/scripts/multiplexer.sh @@ -13,7 +13,7 @@ CMD=$1 LANGUAGE=$2 CLIENT=$3 -LANGUAGES=(javascript) +LANGUAGES=(javascript java) CLIENTS=(search recommend personalization) if [[ $LANGUAGE == "all" ]]; then diff --git a/scripts/post-gen-java.sh b/scripts/post-gen-java.sh deleted file mode 100644 index a8b8f0073d..0000000000 --- a/scripts/post-gen-java.sh +++ /dev/null @@ -1,16 +0,0 @@ -CLIENT_FOLDER=$1 - - -find $CLIENT_FOLDER -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' - -echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT_FOLDER/algoliasearch-core/com/algolia/model/OneOfintegerstring.java - -# Download the formatter if not present -javaFormatter="google-java-format-1.13.0-all-deps.jar" -if [[ ! -f "dist/$javaFormatter" ]]; then - mkdir dist - curl -L "https://github.com/google/google-java-format/releases/download/v1.13.0/$javaFormatter" > dist/$javaFormatter -fi -find $CLIENT_FOLDER -type f -name "*.java" | xargs java -jar dist/$javaFormatter -r - -yarn prettier --write $CLIENT_FOLDER/**/*.java diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh new file mode 100755 index 0000000000..ad432c2fe9 --- /dev/null +++ b/scripts/post-gen/java.sh @@ -0,0 +1,20 @@ +client=$1 +export CLIENT=$(cat openapitools.json | yarn json "generator-cli.generators.java-${client}.output" | sed 's/#{cwd}\///g') + +# Restore the oneOf spec +mv ./specs/search/paths/search/search.yml.bak ./specs/search/paths/search/search.yml + +find $CLIENT -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' + +echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfintegerstring.java + +# Download the formatter if not present +javaFormatter="google-java-format-1.13.0-all-deps.jar" +if [[ ! -f "dist/$javaFormatter" ]]; then + echo "Downloading formatter dependency" + mkdir dist + curl -L "https://github.com/google/google-java-format/releases/download/v1.13.0/$javaFormatter" > dist/$javaFormatter +fi +find $CLIENT -type f -name "*.java" | xargs java -jar dist/$javaFormatter -r + +yarn prettier --write $CLIENT/**/*.java diff --git a/scripts/pre-gen/java.sh b/scripts/pre-gen/java.sh new file mode 100755 index 0000000000..778aa662a3 --- /dev/null +++ b/scripts/pre-gen/java.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Remove the oneOf in the spec until it's supported (https://github.com/OpenAPITools/openapi-generator/issues/10880). + +# Remove the oneOf and only keep the last $ref +perl -0777 -i.bak -pe "s/oneOf[\s\S]*- \$ref(?!.*- \$ref)//g" ./specs/search/paths/search/search.yml diff --git a/templates/java/api.mustache b/templates/java/api.mustache deleted file mode 100644 index 815887eaea..0000000000 --- a/templates/java/api.mustache +++ /dev/null @@ -1,121 +0,0 @@ -{{>licenseInfo}} -package {{package}}; - -import com.sun.jersey.api.client.GenericType; - -import {{invokerPackage}}.ApiException; -import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.Configuration; -import {{modelPackage}}.*; -import {{invokerPackage}}.Pair; - -{{#imports}}import {{import}}; -{{/imports}} - - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -{{#operations}} -public class {{classname}} { - private ApiClient apiClient; - - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - - public {{classname}}(ApiClient apiClient) { - this.apiClient = apiClient; - } - - public ApiClient getApiClient() { - return apiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.apiClient = apiClient; - } - - {{#operation}} - /** - * {{summary}} - * {{notes}} - {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} - {{/allParams}} - {{#returnType}} - * @return {{.}} - {{/returnType}} - * @throws ApiException if fails to make API call - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{operationId}}"); - } - {{/required}}{{/allParams}} - // create path and map variables - String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; - - // query params - {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); - {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); - - {{#queryParams}} - {{#collectionFormat}}localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); - {{/queryParams}} - - {{#headerParams}}if ({{paramName}} != null) - localVarHeaderParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); - {{/headerParams}} - - {{#cookieParams}}if ({{paramName}} != null) - localVarCookieParams.put("{{baseName}}", apiClient.parameterToString({{paramName}})); - {{/cookieParams}} - - {{#formParams}}if ({{paramName}} != null) - localVarFormParams.put("{{baseName}}", {{paramName}}); - {{/formParams}} - - final String[] localVarAccepts = { - {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} - }; - final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - - final String[] localVarContentTypes = { - {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} - }; - final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - - String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - - {{#returnType}} - GenericType<{{{returnType}}}> localVarReturnType = new GenericType<{{{returnType}}}>() {}; - return apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); - {{/returnType}}{{^returnType}} - apiClient.invokeAPI(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null); - {{/returnType}} - } - {{/operation}} -} -{{/operations}} diff --git a/templates/java/libraries/feign/ApiClient.mustache b/templates/java/libraries/feign/ApiClient.mustache deleted file mode 100644 index 5c4e78970e..0000000000 --- a/templates/java/libraries/feign/ApiClient.mustache +++ /dev/null @@ -1,354 +0,0 @@ -package {{invokerPackage}}; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -{{#threetenbp}} -import org.threeten.bp.*; -{{/threetenbp}} -import feign.okhttp.OkHttpClient; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -{{#openApiNullable}} -import org.openapitools.jackson.nullable.JsonNullableModule; -{{/openApiNullable}} -{{#joda}} -import com.fasterxml.jackson.datatype.joda.JodaModule; -{{/joda}} -{{#java8}} -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -{{/java8}} -{{#threetenbp}} -import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; -{{/threetenbp}} - -import feign.Feign; -import feign.RequestInterceptor; -import feign.form.FormEncoder; -import feign.jackson.JacksonDecoder; -import feign.jackson.JacksonEncoder; -import feign.slf4j.Slf4jLogger; -import {{invokerPackage}}.auth.HttpBasicAuth; -import {{invokerPackage}}.auth.HttpBearerAuth; -import {{invokerPackage}}.auth.ApiKeyAuth; -import {{invokerPackage}}.ApiResponseDecoder; - -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.ApiErrorDecoder; -import {{invokerPackage}}.auth.OAuth; -import {{invokerPackage}}.auth.OAuth.AccessTokenListener; -import {{invokerPackage}}.auth.OAuthFlow; -import {{invokerPackage}}.auth.OauthPasswordGrant; -import {{invokerPackage}}.auth.OauthClientCredentialsGrant; -import feign.Retryer; -{{/hasOAuthMethods}} - -{{>generatedAnnotation}} -public class ApiClient { - private static final Logger log = Logger.getLogger(ApiClient.class.getName()); - - public interface Api {} - - protected ObjectMapper objectMapper; - private String basePath = "{{{basePath}}}"; - private Map apiAuthorizations; - private Feign.Builder feignBuilder; - - public ApiClient() { - objectMapper = createObjectMapper(); - apiAuthorizations = new LinkedHashMap(); - feignBuilder = Feign.builder() - .client(new OkHttpClient()) - .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) - .decoder(new ApiResponseDecoder(objectMapper)) - {{#hasOAuthMethods}} - .errorDecoder(new ApiErrorDecoder()) - .retryer(new Retryer.Default(0, 0, 2)) - {{/hasOAuthMethods}} - .logger(new Slf4jLogger()); - } - - public ApiClient(String[] authNames) { - this(); - for(String authName : authNames) { - log.log(Level.FINE, "Creating authentication {0}", authName); - {{#hasAuthMethods}} - RequestInterceptor auth; - {{#authMethods}}if ("{{name}}".equals(authName)) { - {{#isBasic}} - {{#isBasicBasic}} - auth = new HttpBasicAuth(); - {{/isBasicBasic}} - {{^isBasicBasic}} - auth = new HttpBearerAuth("{{scheme}}"); - {{/isBasicBasic}} - {{/isBasic}} - {{#isApiKey}} - auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}"); - {{/isApiKey}} - {{#isOAuth}} - auth = buildOauthRequestInterceptor(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}"); - {{/isOAuth}} - } else {{/authMethods}}{ - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); - } - addAuthorization(authName, auth); - {{/hasAuthMethods}} - {{^hasAuthMethods}} - throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); - {{/hasAuthMethods}} - } - } - - /** - * Basic constructor for single auth name - * @param authName - */ - public ApiClient(String authName) { - this(new String[]{authName}); - } - - /** - * Helper constructor for single api key - * @param authName - * @param apiKey - */ - public ApiClient(String authName, String apiKey) { - this(authName); - this.setApiKey(apiKey); - } - - public String getBasePath() { - return basePath; - } - - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - return this; - } - - public Map getApiAuthorizations() { - return apiAuthorizations; - } - - public void setApiAuthorizations(Map apiAuthorizations) { - this.apiAuthorizations = apiAuthorizations; - } - - public Feign.Builder getFeignBuilder() { - return feignBuilder; - } - - public ApiClient setFeignBuilder(Feign.Builder feignBuilder) { - this.feignBuilder = feignBuilder; - return this; - } - - private ObjectMapper createObjectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); - objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.setDateFormat(new RFC3339DateFormat()); - {{#joda}} - objectMapper.registerModule(new JodaModule()); - {{/joda}} - {{#java8}} - objectMapper.registerModule(new JavaTimeModule()); - {{/java8}} - {{#threetenbp}} - ThreeTenModule module = new ThreeTenModule(); - module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); - module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); - module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); - objectMapper.registerModule(module); - {{/threetenbp}} - {{#openApiNullable}} - JsonNullableModule jnm = new JsonNullableModule(); - objectMapper.registerModule(jnm); - {{/openApiNullable}} - return objectMapper; - } - - {{#hasOAuthMethods}} - private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { - switch (flow) { - case password: - return new OauthPasswordGrant(tokenUrl, scopes); - case application: - return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes); - default: - throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented"); - } - } - - {{/hasOAuthMethods}} - public ObjectMapper getObjectMapper(){ - return objectMapper; - } - - public void setObjectMapper(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - - /** - * Creates a feign client for given API interface. - * - * Usage: - * ApiClient apiClient = new ApiClient(); - * apiClient.setBasePath("http://localhost:8080"); - * XYZApi api = apiClient.buildClient(XYZApi.class); - * XYZResponse response = api.someMethod(...); - * @param Type - * @param clientClass Client class - * @return The Client - */ - public T buildClient(Class clientClass) { - return feignBuilder.target(clientClass, basePath); - } - - /** - * Select the Accept header's value from the given accepts array: - * if JSON exists in the given array, use it; - * otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, - * null will be returned (not to set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) return null; - if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json"; - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: - * if JSON exists in the given array, use it; - * otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, - * JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) return "application/json"; - if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json"; - return contentTypes[0]; - } - - /** - * Helper method to configure the bearer token. - * @param bearerToken the bearer token. - */ - public void setBearerToken(String bearerToken) { - HttpBearerAuth apiAuthorization = getAuthorization(HttpBearerAuth.class); - apiAuthorization.setBearerToken(bearerToken); - } - - /** - * Helper method to configure the first api key found - * @param apiKey API key - */ - public void setApiKey(String apiKey) { - ApiKeyAuth apiAuthorization = getAuthorization(ApiKeyAuth.class); - apiAuthorization.setApiKey(apiKey); - } - - /** - * Helper method to configure the username/password for basic auth - * @param username Username - * @param password Password - */ - public void setCredentials(String username, String password) { - HttpBasicAuth apiAuthorization = getAuthorization(HttpBasicAuth.class); - apiAuthorization.setCredentials(username, password); - } - - {{#hasOAuthMethods}} - /** - * Helper method to configure the client credentials for Oauth - * @param username Username - * @param password Password - */ - public void setClientCredentials(String clientId, String clientSecret) { - OauthClientCredentialsGrant authorization = getAuthorization(OauthClientCredentialsGrant.class); - authorization.configure(clientId, clientSecret); - } - - /** - * Helper method to configure the username/password for Oauth password grant - * @param username Username - * @param password Password - */ - public void setOauthPassword(String username, String password, String clientId, String clientSecret) { - OauthPasswordGrant apiAuthorization = getAuthorization(OauthPasswordGrant.class); - apiAuthorization.configure(username, password, clientId, clientSecret); - } - - /** - * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) - * @param accessToken Access Token - * @param expiresIn Validity period in seconds - */ - public void setAccessToken(String accessToken, Integer expiresIn) { - OAuth apiAuthorization = getAuthorization(OAuth.class); - apiAuthorization.setAccessToken(accessToken, expiresIn); - } - - /** - * Helper method to configure the oauth accessCode/implicit flow parameters - * @param clientId Client ID - * @param clientSecret Client secret - * @param redirectURI Redirect URI - */ - public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { - throw new RuntimeException("Not implemented"); - } - - /** - * Configures a listener which is notified when a new access token is received. - * @param accessTokenListener Acesss token listener - */ - public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - OAuth apiAuthorization = getAuthorization(OAuth.class); - apiAuthorization.registerAccessTokenListener(accessTokenListener); - } - - {{/hasOAuthMethods}} - /** - * Gets request interceptor based on authentication name - * @param authName Authentication name - * @return Request Interceptor - */ - public RequestInterceptor getAuthorization(String authName) { - return apiAuthorizations.get(authName); - } - - /** - * Adds an authorization to be used by the client - * @param authName Authentication name - * @param authorization Request interceptor - */ - public void addAuthorization(String authName, RequestInterceptor authorization) { - if (apiAuthorizations.containsKey(authName)) { - throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations"); - } - apiAuthorizations.put(authName, authorization); - feignBuilder.requestInterceptor(authorization); - } - - private T getAuthorization(Class type) { - return (T) apiAuthorizations.values() - .stream() - .filter(requestInterceptor -> type.isAssignableFrom(requestInterceptor.getClass())) - .findFirst() - .orElseThrow(() -> new RuntimeException("No Oauth authentication or OAuth configured!")); - } -} diff --git a/templates/java/libraries/feign/ApiResponseDecoder.mustache b/templates/java/libraries/feign/ApiResponseDecoder.mustache deleted file mode 100644 index ef171de943..0000000000 --- a/templates/java/libraries/feign/ApiResponseDecoder.mustache +++ /dev/null @@ -1,38 +0,0 @@ -package {{invokerPackage}}; - -import com.fasterxml.jackson.databind.ObjectMapper; -import feign.Response; -import feign.Types; -import feign.jackson.JacksonDecoder; - -import java.io.IOException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -import {{modelPackage}}.ApiResponse; - -public class ApiResponseDecoder extends JacksonDecoder { - - public ApiResponseDecoder(ObjectMapper mapper) { - super(mapper); - } - - @Override - public Object decode(Response response, Type type) throws IOException { - Map> responseHeaders = Collections.unmodifiableMap(response.headers()); - //Detects if the type is an instance of the parameterized class ApiResponse - Type responseBodyType; - if (Types.getRawType(type).isAssignableFrom(ApiResponse.class)) { - //The ApiResponse class has a single type parameter, the Dto class itself - responseBodyType = ((ParameterizedType) type).getActualTypeArguments()[0]; - Object body = super.decode(response, responseBodyType); - return new ApiResponse(response.status(), responseHeaders, body); - } else { - //The response is not encapsulated in the ApiResponse, decode the Dto as normal - return super.decode(response, type); - } - } -} \ No newline at end of file diff --git a/templates/java/libraries/feign/EncodingUtils.mustache b/templates/java/libraries/feign/EncodingUtils.mustache deleted file mode 100644 index 705eb6aa9d..0000000000 --- a/templates/java/libraries/feign/EncodingUtils.mustache +++ /dev/null @@ -1,86 +0,0 @@ -package {{invokerPackage}}; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** -* Utilities to support Swagger encoding formats in Feign. -*/ -public final class EncodingUtils { - - /** - * Private constructor. Do not construct this class. - */ - private EncodingUtils() {} - - /** - *

Encodes a collection of query parameters according to the Swagger - * collection format.

- * - *

Of the various collection formats defined by Swagger ("csv", "tsv", - * etc), Feign only natively supports "multi". This utility generates the - * other format types so it will be properly processed by Feign.

- * - *

Note, as part of reformatting, it URL encodes the parameters as - * well.

- * @param parameters The collection object to be formatted. This object will - * not be changed. - * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", - * "pipes"). See the - * - * OpenAPI Spec for more details. - * @return An object that will be correctly formatted by Feign. - */ - public static Object encodeCollection(Collection parameters, - String collectionFormat) { - if (parameters == null) { - return parameters; - } - List stringValues = new ArrayList<>(parameters.size()); - for (Object parameter : parameters) { - // ignore null values (same behavior as Feign) - if (parameter != null) { - stringValues.add(encode(parameter)); - } - } - // Feign natively handles single-element lists and the "multi" format. - if (stringValues.size() < 2 || "multi".equals(collectionFormat)) { - return stringValues; - } - // Otherwise return a formatted String - String[] stringArray = stringValues.toArray(new String[0]); - switch (collectionFormat) { - case "csv": - default: - return StringUtil.join(stringArray, ","); - case "ssv": - return StringUtil.join(stringArray, " "); - case "tsv": - return StringUtil.join(stringArray, "\t"); - case "pipes": - return StringUtil.join(stringArray, "|"); - } - } - - /** - * URL encode a single query parameter. - * @param parameter The query parameter to encode. This object will not be - * changed. - * @return The URL encoded string representation of the parameter. If the - * parameter is null, returns null. - */ - public static String encode(Object parameter) { - if (parameter == null) { - return null; - } - try { - return URLEncoder.encode(parameter.toString(), "UTF-8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - // Should never happen, UTF-8 is always supported - throw new RuntimeException(e); - } - } -} diff --git a/templates/java/libraries/feign/ParamExpander.mustache b/templates/java/libraries/feign/ParamExpander.mustache deleted file mode 100644 index 2f5095d00f..0000000000 --- a/templates/java/libraries/feign/ParamExpander.mustache +++ /dev/null @@ -1,22 +0,0 @@ -package {{invokerPackage}}; - -import feign.Param; - -import java.text.DateFormat; -import java.util.Date; - -/** - * Param Expander to convert {@link Date} to RFC3339 - */ -public class ParamExpander implements Param.Expander { - - private static final DateFormat dateformat = new RFC3339DateFormat(); - - @Override - public String expand(Object value) { - if (value instanceof Date) { - return dateformat.format(value); - } - return value.toString(); - } -} diff --git a/templates/java/libraries/feign/README.mustache b/templates/java/libraries/feign/README.mustache deleted file mode 100644 index fed3cbebd5..0000000000 --- a/templates/java/libraries/feign/README.mustache +++ /dev/null @@ -1,77 +0,0 @@ -# {{artifactId}} - -## Requirements - -Building the API client library requires [Maven](https://maven.apache.org/) to be installed. - -## Installation & Usage - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn deploy -``` - -Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. - -After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: - -```xml - - {{groupId}} - {{artifactId}} - {{artifactVersion}} - compile - - -``` - -And to use the api you can follow the examples bellow: - -```java - - //Set bearer token manually - ApiClient apiClient = new ApiClient("petstore_auth_client"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setAccessToken("TOKEN", 10000); - - //Use api key - ApiClient apiClient = new ApiClient("api_key", "API KEY"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - - //Use http basic authentication - ApiClient apiClient = new ApiClient("basicAuth"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setCredentials("username", "password"); - - //Oauth password - ApiClient apiClient = new ApiClient("oauth_password"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setOauthPassword("username", "password", "client_id", "client_secret"); - - //Oauth client credentials flow - ApiClient apiClient = new ApiClient("oauth_client_credentials"); - apiClient.setBasePath("https://localhost:8243/petstore/1/"); - apiClient.setClientCredentials("client_id", "client_secret"); - - PetApi petApi = apiClient.buildClient(PetApi.class); - Pet petById = petApi.getPetById(12345L); - - System.out.println(petById); - } -``` - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/java/libraries/feign/api.mustache b/templates/java/libraries/feign/api.mustache deleted file mode 100644 index c494070002..0000000000 --- a/templates/java/libraries/feign/api.mustache +++ /dev/null @@ -1,190 +0,0 @@ -package {{package}}; - -import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.EncodingUtils; -{{#legacyDates}} -import {{invokerPackage}}.ParamExpander; -{{/legacyDates}} -import {{modelPackage}}.ApiResponse; - -{{#imports}}import {{import}}; -{{/imports}} - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} -import feign.*; - -{{>generatedAnnotation}} -public interface {{classname}} extends ApiClient.Api { - -{{#operations}}{{#operation}} - /** - * {{summary}} - * {{notes}} -{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} -{{/allParams}} -{{#returnType}} - * @return {{.}} -{{/returnType}} -{{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation -{{/externalDocs}} -{{#isDeprecated}} - * @deprecated -{{/isDeprecated}} - */ -{{#isDeprecated}} - @Deprecated -{{/isDeprecated}} - @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") - @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, - {{/-last}}{{/headerParams}} - }) - {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - - /** - * {{summary}} - * Similar to {{operationId}} but it also returns the http response headers . - * {{notes}} -{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} -{{/allParams}} -{{#returnType}} - * @return A ApiResponse that wraps the response boyd and the http headers. -{{/returnType}} -{{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation -{{/externalDocs}} -{{#isDeprecated}} - * @deprecated -{{/isDeprecated}} - */ -{{#isDeprecated}} - @Deprecated -{{/isDeprecated}} - @RequestLine("{{httpMethod}} {{{path}}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") - @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, - {{/-last}}{{/headerParams}} - }) - ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - - - {{#hasQueryParams}} - /** - * {{summary}} - * {{notes}} - * Note, this is equivalent to the other {{operationId}} method, - * but with the query parameters collected into a single Map parameter. This - * is convenient for services with optional query parameters, especially when - * used with the {@link {{operationIdCamelCase}}QueryParams} class that allows for - * building up this map in a fluent style. - {{#allParams}} - {{^isQueryParam}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} - {{/isQueryParam}} - {{/allParams}} - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - {{#queryParams}} - *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • - {{/queryParams}} - *
- {{#returnType}} - * @return {{.}} - {{/returnType}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") - @Headers({ -{{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", -{{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, - {{/-last}}{{/headerParams}} - }) - {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{nickname}}({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); - - /** - * {{summary}} - * {{notes}} - * Note, this is equivalent to the other {{operationId}} that receives the query parameters as a map, - * but this one also exposes the Http response headers - {{#allParams}} - {{^isQueryParam}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} - {{/isQueryParam}} - {{/allParams}} - * @param queryParams Map of query parameters as name-value pairs - *

The following elements may be specified in the query map:

- *
    - {{#queryParams}} - *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • - {{/queryParams}} - *
- {{#returnType}} - * @return {{.}} - {{/returnType}} - {{#externalDocs}} - * {{description}} - * @see {{summary}} Documentation - {{/externalDocs}} - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - @RequestLine("{{httpMethod}} {{{path}}}?{{#queryParams}}{{baseName}}={{=<% %>=}}{<%paramName%>}<%={{ }}=%>{{^-last}}&{{/-last}}{{/queryParams}}") - @Headers({ - {{#vendorExtensions.x-contentType}} "Content-Type: {{vendorExtensions.x-contentType}}", - {{/vendorExtensions.x-contentType}} "Accept: {{vendorExtensions.x-accepts}}",{{#headerParams}} - "{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{^-last}}, - {{/-last}}{{/headerParams}} - }) - ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{nickname}}WithHttpInfo({{#allParams}}{{^isQueryParam}}{{^isBodyParam}}{{^legacyDates}}@Param("{{paramName}}") {{/legacyDates}}{{#legacyDates}}@Param(value="{{paramName}}", expander=ParamExpander.class) {{/legacyDates}}{{/isBodyParam}}{{{dataType}}} {{paramName}}, {{/isQueryParam}}{{/allParams}}@QueryMap(encoded=true) Map queryParams); - - - /** - * A convenience class for generating query parameters for the - * {{operationId}} method in a fluent style. - */ - public static class {{operationIdCamelCase}}QueryParams extends HashMap { - {{#queryParams}} - public {{operationIdCamelCase}}QueryParams {{paramName}}(final {{{dataType}}} value) { - {{#collectionFormat}} - put("{{baseName}}", EncodingUtils.encodeCollection(value, "{{collectionFormat}}")); - {{/collectionFormat}} - {{^collectionFormat}} - put("{{baseName}}", EncodingUtils.encode(value)); - {{/collectionFormat}} - return this; - } - {{/queryParams}} - } - {{/hasQueryParams}} - {{/operation}} -{{/operations}} -} diff --git a/templates/java/libraries/feign/api_test.mustache b/templates/java/libraries/feign/api_test.mustache deleted file mode 100644 index a7f5bb0b32..0000000000 --- a/templates/java/libraries/feign/api_test.mustache +++ /dev/null @@ -1,70 +0,0 @@ -package {{package}}; - -import {{invokerPackage}}.ApiClient; -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.BeforeEach; - -{{^fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -/** - * API tests for {{classname}} - */ -class {{classname}}Test { - - private {{classname}} api; - - @BeforeEach - public void setup() { - api = new ApiClient().buildClient({{classname}}.class); - } - - {{#operations}}{{#operation}} - /** - * {{summary}} - * - * {{notes}} - */ - @Test - void {{operationId}}Test() { - {{#allParams}} - {{{dataType}}} {{paramName}} = null; - {{/allParams}} - // {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); - - // TODO: test validations - } - - {{#hasQueryParams}} - /** - * {{summary}} - * - * {{notes}} - * - * This tests the overload of the method that uses a Map for query parameters instead of - * listing them out individually. - */ - @Test - void {{operationId}}TestQueryMap() { - {{#allParams}} - {{^isQueryParam}} - {{{dataType}}} {{paramName}} = null; - {{/isQueryParam}} - {{/allParams}} - {{classname}}.{{operationIdCamelCase}}QueryParams queryParams = new {{classname}}.{{operationIdCamelCase}}QueryParams() - {{#queryParams}} - .{{paramName}}(null){{#-last}};{{/-last}} - {{/queryParams}} - // {{#returnType}}{{{.}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{^isQueryParam}}{{paramName}}, {{/isQueryParam}}{{/allParams}}queryParams); - - // TODO: test validations - } - {{/hasQueryParams}} - {{/operation}}{{/operations}} -} diff --git a/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache b/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache deleted file mode 100644 index da87f2563b..0000000000 --- a/templates/java/libraries/feign/auth/ApiErrorDecoder.mustache +++ /dev/null @@ -1,25 +0,0 @@ -package {{invokerPackage}}.auth; - -import feign.Response; -import feign.RetryableException; -import feign.codec.ErrorDecoder; - -/** - * Error decoder that makes the HTTP 401 and 403 Retryable. Sometimes the 401 or 403 may indicate an expired token - * All the other HTTP status are handled by the {@link feign.codec.ErrorDecoder.Default} decoder - */ -public class ApiErrorDecoder implements ErrorDecoder { - - private final Default defaultErrorDecoder = new Default(); - - @Override - public Exception decode(String methodKey, Response response) { - //401/403 response codes most likely indicate an expired access token, unless it happens two times in a row - Exception httpException = defaultErrorDecoder.decode(methodKey, response); - if (response.status() == 401 || response.status() == 403) { - return new RetryableException(response.status(), "Received status " + response.status() + " trying to renew access token", - response.request().httpMethod(), httpException, null, response.request()); - } - return httpException; - } -} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/ApiKeyAuth.mustache b/templates/java/libraries/feign/auth/ApiKeyAuth.mustache deleted file mode 100644 index c03fe5c0bc..0000000000 --- a/templates/java/libraries/feign/auth/ApiKeyAuth.mustache +++ /dev/null @@ -1,43 +0,0 @@ -package {{invokerPackage}}.auth; - -import feign.RequestInterceptor; -import feign.RequestTemplate; - -public class ApiKeyAuth implements RequestInterceptor { - private final String location; - private final String paramName; - - private String apiKey; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - @Override - public void apply(RequestTemplate template) { - if ("query".equals(location)) { - template.query(paramName, apiKey); - } else if ("header".equals(location)) { - template.header(paramName, apiKey); - } else if ("cookie".equals(location)) { - template.header("Cookie", String.format("%s=%s", paramName, apiKey)); - } - } -} diff --git a/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache b/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache deleted file mode 100644 index 72b0a00495..0000000000 --- a/templates/java/libraries/feign/auth/DefaultApi20Impl.mustache +++ /dev/null @@ -1,47 +0,0 @@ -package {{invokerPackage}}.auth; - -import com.github.scribejava.core.builder.api.DefaultApi20; -import com.github.scribejava.core.extractors.OAuth2AccessTokenJsonExtractor; -import com.github.scribejava.core.extractors.TokenExtractor; -import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.oauth2.bearersignature.BearerSignature; -import com.github.scribejava.core.oauth2.bearersignature.BearerSignatureURIQueryParameter; -import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication; -import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme; - -{{>generatedAnnotation}} -public class DefaultApi20Impl extends DefaultApi20 { - - private final String accessTokenEndpoint; - private final String authorizationBaseUrl; - - protected DefaultApi20Impl(String authorizationBaseUrl, String accessTokenEndpoint) { - this.authorizationBaseUrl = authorizationBaseUrl; - this.accessTokenEndpoint = accessTokenEndpoint; - } - - @Override - public String getAccessTokenEndpoint() { - return accessTokenEndpoint; - } - - @Override - protected String getAuthorizationBaseUrl() { - return authorizationBaseUrl; - } - - @Override - public BearerSignature getBearerSignature() { - return BearerSignatureURIQueryParameter.instance(); - } - - @Override - public ClientAuthentication getClientAuthentication() { - return RequestBodyAuthenticationScheme.instance(); - } - - @Override - public TokenExtractor getAccessTokenExtractor() { - return OAuth2AccessTokenJsonExtractor.instance(); - } -} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/HttpBasicAuth.mustache b/templates/java/libraries/feign/auth/HttpBasicAuth.mustache deleted file mode 100644 index c308131e8f..0000000000 --- a/templates/java/libraries/feign/auth/HttpBasicAuth.mustache +++ /dev/null @@ -1,41 +0,0 @@ -package {{invokerPackage}}.auth; - -import feign.RequestInterceptor; -import feign.RequestTemplate; -import feign.auth.BasicAuthRequestInterceptor; - -/** - * An interceptor that adds the request header needed to use HTTP basic authentication. - */ -public class HttpBasicAuth implements RequestInterceptor { - - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public void setCredentials(String username, String password) { - this.username = username; - this.password = password; - } - - @Override - public void apply(RequestTemplate template) { - RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password); - requestInterceptor.apply(template); - } -} diff --git a/templates/java/libraries/feign/auth/HttpBearerAuth.mustache b/templates/java/libraries/feign/auth/HttpBearerAuth.mustache deleted file mode 100644 index 2240a5518b..0000000000 --- a/templates/java/libraries/feign/auth/HttpBearerAuth.mustache +++ /dev/null @@ -1,43 +0,0 @@ -package {{invokerPackage}}.auth; - -import feign.RequestInterceptor; -import feign.RequestTemplate; - -/** - * An interceptor that adds the request header needed to use HTTP bearer authentication. - */ -public class HttpBearerAuth implements RequestInterceptor { - private final String scheme; - private String bearerToken; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } - - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. - */ - public String getBearerToken() { - return bearerToken; - } - - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. - */ - public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - } - - @Override - public void apply(RequestTemplate template) { - if(bearerToken == null) { - return; - } - - template.header("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); - } - - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } -} diff --git a/templates/java/libraries/feign/auth/OAuth.mustache b/templates/java/libraries/feign/auth/OAuth.mustache deleted file mode 100644 index e608296564..0000000000 --- a/templates/java/libraries/feign/auth/OAuth.mustache +++ /dev/null @@ -1,92 +0,0 @@ -package {{invokerPackage}}.auth; - -import com.github.scribejava.core.model.OAuth2AccessToken; -import com.github.scribejava.core.oauth.OAuth20Service; -import feign.RequestInterceptor; -import feign.RequestTemplate; - -import java.util.Collection; - -{{>generatedAnnotation}} -public abstract class OAuth implements RequestInterceptor { - - static final int MILLIS_PER_SECOND = 1000; - - public interface AccessTokenListener { - void notify(OAuth2AccessToken token); - } - - private volatile String accessToken; - private Long expirationTimeMillis; - private AccessTokenListener accessTokenListener; - - protected OAuth20Service service; - protected String scopes; - protected String authorizationUrl; - protected String tokenUrl; - - public OAuth(String authorizationUrl, String tokenUrl, String scopes) { - this.scopes = scopes; - this.authorizationUrl = authorizationUrl; - this.tokenUrl = tokenUrl; - } - - @Override - public void apply(RequestTemplate template) { - // If the request already have an authorization (eg. Basic auth), do nothing - if (requestContainsNonOauthAuthorization(template)) { - return; - } - String accessToken = getAccessToken(); - if (accessToken != null) { - template.header("Authorization", "Bearer " + accessToken); - } - } - - private boolean requestContainsNonOauthAuthorization(RequestTemplate template) { - Collection authorizations = template.headers().get("Authorization"); - if (authorizations == null) { - return false; - } - return !authorizations.stream() - .anyMatch(authHeader -> !authHeader.equalsIgnoreCase("Bearer")); - } - - private synchronized void updateAccessToken() { - OAuth2AccessToken accessTokenResponse; - accessTokenResponse = getOAuth2AccessToken(); - if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { - setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); - if (accessTokenListener != null) { - accessTokenListener.notify(accessTokenResponse); - } - } - } - - abstract OAuth2AccessToken getOAuth2AccessToken(); - - abstract OAuthFlow getFlow(); - - public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { - this.accessTokenListener = accessTokenListener; - } - - public synchronized String getAccessToken() { - // If first time, get the token - if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { - updateAccessToken(); - } - return accessToken; - } - - /** - * Manually sets the access token - * @param accessToken The access token - * @param expiresIn Seconds until the token expires - */ - public synchronized void setAccessToken(String accessToken, Integer expiresIn) { - this.accessToken = accessToken; - this.expirationTimeMillis = expiresIn == null ? null : System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; - } - -} \ No newline at end of file diff --git a/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache b/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache deleted file mode 100644 index ef22c21163..0000000000 --- a/templates/java/libraries/feign/auth/OauthClientCredentialsGrant.mustache +++ /dev/null @@ -1,39 +0,0 @@ -package {{invokerPackage}}.auth; - -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.model.OAuth2AccessToken; - -{{>generatedAnnotation}} -public class OauthClientCredentialsGrant extends OAuth { - - public OauthClientCredentialsGrant(String authorizationUrl, String tokenUrl, String scopes) { - super(authorizationUrl, tokenUrl, scopes); - } - - @Override - protected OAuth2AccessToken getOAuth2AccessToken() { - try { - return service.getAccessTokenClientCredentialsGrant(scopes); - } catch (Exception e) { - throw new RuntimeException("Failed to get oauth token", e); - } - } - - @Override - protected OAuthFlow getFlow() { - return OAuthFlow.application; - } - - /** - * Configures the client credentials flow - * - * @param clientId - * @param clientSecret - */ - public void configure(String clientId, String clientSecret) { - service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .defaultScope(scopes) - .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); - } -} diff --git a/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache b/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache deleted file mode 100644 index 870c3755a8..0000000000 --- a/templates/java/libraries/feign/auth/OauthPasswordGrant.mustache +++ /dev/null @@ -1,48 +0,0 @@ -package {{invokerPackage}}.auth; - -import com.github.scribejava.core.builder.ServiceBuilder; -import com.github.scribejava.core.model.OAuth2AccessToken; - -{{>generatedAnnotation}} -public class OauthPasswordGrant extends OAuth { - - private String username; - private String password; - - public OauthPasswordGrant(String tokenUrl, String scopes) { - super(null, tokenUrl, scopes); - } - - @Override - protected OAuth2AccessToken getOAuth2AccessToken() { - try { - return service.getAccessTokenPasswordGrant(username, password); - } catch (Exception e) { - throw new RuntimeException("Failed to get oauth token", e); - } - } - - @Override - protected OAuthFlow getFlow() { - return OAuthFlow.password; - } - - /** - * Configures Oauth password grant flow - * Note: this flow is deprecated. - * - * @param username - * @param password - * @param clientId - * @param clientSecret - */ - public void configure(String username, String password, String clientId, String clientSecret) { - this.username = username; - this.password = password; - //TODO the clientId and secret are optional according with the RFC - service = new ServiceBuilder(clientId) - .apiSecret(clientSecret) - .defaultScope(scopes) - .build(new DefaultApi20Impl(authorizationUrl, tokenUrl)); - } -} \ No newline at end of file diff --git a/templates/java/libraries/feign/build.gradle.mustache b/templates/java/libraries/feign/build.gradle.mustache deleted file mode 100644 index 93944f967e..0000000000 --- a/templates/java/libraries/feign/build.gradle.mustache +++ /dev/null @@ -1,152 +0,0 @@ -apply plugin: 'idea' -apply plugin: 'eclipse' - -group = '{{groupId}}' -version = '{{artifactVersion}}' - -buildscript { - repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' - } -} - -repositories { - jcenter() -} - - -if(hasProperty('target') && target == 'android') { - - apply plugin: 'com.android.library' - apply plugin: 'com.github.dcendents.android-maven' - - android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' - defaultConfig { - minSdkVersion 14 - targetSdkVersion 25 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - // Rename the aar correctly - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.aar')) { - def fileName = "${project.name}-${variant.baseName}-${version}.aar" - output.outputFile = new File(outputFile.parent, fileName) - } - } - } - - dependencies { - provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - } - } - - afterEvaluate { - android.libraryVariants.all { variant -> - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar - task.description = "Create jar artifact for ${variant.name}" - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDir - task.destinationDir = project.file("${project.buildDir}/outputs/jar") - task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task); - } - } - - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' - } - - artifacts { - archives sourcesJar - } - -} else { - - apply plugin: 'java' - apply plugin: 'maven' - - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' - } - } - - task execute(type:JavaExec) { - main = System.getProperty('mainClass') - classpath = sourceSets.main.runtimeClasspath - } -} - -test { - useJUnitPlatform() -} - -ext { - swagger_annotations_version = "1.5.24" - jackson_version = "2.10.3" - jackson_databind_version = "2.10.3" - {{#openApiNullable}} - jackson_databind_nullable_version = "0.2.1" - {{/openApiNullable}} - jakarta_annotation_version = "1.3.5" - {{#threetenbp}} - jackson_threetenbp_version = "2.9.10" - {{/threetenbp}} - feign_version = "10.11" - feign_form_version = "3.8.0" - junit_version = "5.7.0" - scribejava_version = "8.0.0" -} - -dependencies { - implementation "io.swagger:swagger-annotations:$swagger_annotations_version" - implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation "io.github.openfeign:feign-core:$feign_version" - implementation "io.github.openfeign:feign-jackson:$feign_version" - implementation "io.github.openfeign:feign-slf4j:$feign_version" - implementation "io.github.openfeign:feign-okhttp:$feign_version" - implementation "io.github.openfeign.form:feign-form:$feign_form_version" - implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" - implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" - {{#openApiNullable}} - implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" - {{/openApiNullable}} - {{#joda}} - implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" - {{/joda}} - {{#java8}} - implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" - {{/java8}} - {{#threetenbp}} - implementation "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - {{/threetenbp}} - implementation "com.brsanthu:migbase64:2.2" - implementation "com.github.scribejava:scribejava-core:$scribejava_version" - implementation "com.brsanthu:migbase64:2.2" - implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation "org.junit.jupiter:junit-jupiter:$junit_version" - testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version" - testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version" - testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2" - testImplementation "org.hamcrest:hamcrest:2.2" - testImplementation "commons-io:commons-io:2.8.0" - testImplementation "ch.qos.logback:logback-classic:1.2.3" -} diff --git a/templates/java/libraries/feign/build.sbt.mustache b/templates/java/libraries/feign/build.sbt.mustache deleted file mode 100644 index f2912f0dfb..0000000000 --- a/templates/java/libraries/feign/build.sbt.mustache +++ /dev/null @@ -1,34 +0,0 @@ -lazy val root = (project in file(".")). - settings( - organization := "{{groupId}}", - name := "{{artifactId}}", - version := "{{artifactVersion}}", - scalaVersion := "2.11.4", - scalacOptions ++= Seq("-feature"), - javacOptions in compile ++= Seq("-Xlint:deprecation"), - publishArtifact in (Compile, packageDoc) := false, - resolvers += Resolver.mavenLocal, - libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.24" % "compile", - "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", - "io.github.openfeign" % "feign-core" % "10.11" % "compile", - "io.github.openfeign" % "feign-jackson" % "10.11" % "compile", - "io.github.openfeign" % "feign-slf4j" % "10.11" % "compile", - "io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile", - "io.github.openfeign" % "feign-okhttp" % "10.11" % "compile", - "com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile", - "com.fasterxml.jackson.datatype" % "jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}" % "2.9.10" % "compile", - "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.9.10" % "compile", - "com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile", - "com.brsanthu" % "migbase64" % "2.2" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test", - "org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test", - "com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test", - "org.hamcrest" % "hamcrest" % "2.2" % "test", - "commons-io" % "commons-io" % "2.8.0" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test" - ) - ) diff --git a/templates/java/libraries/feign/model_test.mustache b/templates/java/libraries/feign/model_test.mustache deleted file mode 100644 index 0d75e120b0..0000000000 --- a/templates/java/libraries/feign/model_test.mustache +++ /dev/null @@ -1,48 +0,0 @@ -{{>licenseInfo}} - -package {{package}}; - -{{#imports}}import {{import}}; -{{/imports}} -import org.junit.jupiter.api.Test; - -{{#fullJavaUtil}} -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -{{/fullJavaUtil}} - -/** - * Model tests for {{classname}} - */ -class {{classname}}Test { - {{#models}} - {{#model}} - {{^vendorExtensions.x-is-one-of-interface}} - {{^isEnum}} - private final {{classname}} model = new {{classname}}(); - - {{/isEnum}} - /** - * Model tests for {{classname}} - */ - @Test - void test{{classname}}() { - // TODO: test {{classname}} - } - - {{#allVars}} - /** - * Test the property '{{name}}' - */ - @Test - void {{name}}Test() { - // TODO: test {{name}} - } - - {{/allVars}} - {{/vendorExtensions.x-is-one-of-interface}} - {{/model}} - {{/models}} -} diff --git a/templates/java/libraries/okhttp-gson/ApiCallback.mustache b/templates/java/libraries/okhttp-gson/ApiCallback.mustache new file mode 100644 index 0000000000..53b6a7b8e3 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ApiCallback.mustache @@ -0,0 +1,51 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache new file mode 100644 index 0000000000..3f024badea --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -0,0 +1,1176 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.BufferedSink; +import okio.Okio; +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +{{/joda}} +{{#threetenbp}} +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; +{{/threetenbp}} +{{#hasOAuthMethods}} +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; +{{/hasOAuthMethods}} + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +{{#java8}} +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +{{/java8}} +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import {{invokerPackage}}.auth.Authentication; +import {{invokerPackage}}.auth.HttpBasicAuth; +import {{invokerPackage}}.auth.HttpBearerAuth; +import {{invokerPackage}}.auth.ApiKeyAuth; +{{#hasOAuthMethods}} +import {{invokerPackage}}.auth.OAuth; +import {{invokerPackage}}.auth.RetryingOAuth; +import {{invokerPackage}}.auth.OAuthFlow; +{{/hasOAuthMethods}} + +public class ApiClient { + + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + + private String basePath; + private String appId, apiKey; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /* + * Basic constructor for ApiClient + */ + public ApiClient(String appId, String apiKey) { + init(); + initHttpClient(); + + this.basePath = "https://" + appId + "-1.algolianet.com"; + this.appId = appId; + this.apiKey = apiKey; + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + {{#useGzipFeature}} + // Enable gzip request compression + builder.addInterceptor(new GzipRequestInterceptor()); + {{/useGzipFeature}} + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + public DateFormat getDateFormat() { + return dateFormat; + } + + public ApiClient setDateFormat(DateFormat dateFormat) { + this.json.setDateFormat(dateFormat); + return this; + } + + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + this.json.setSqlDateFormat(dateFormat); + return this; + } + + public ApiClient setLenientOnJson(boolean lenientOnJson) { + this.json.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + {{#hasOAuthMethods}} + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + {{/hasOAuthMethods}} + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date {{#joda}}|| param instanceof DateTime || param instanceof LocalDate{{/joda}}{{#jsr310}}|| param instanceof OffsetDateTime || param instanceof LocalDate{{/jsr310}}) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = json.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(String.valueOf(o)); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * or matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + return "application/json"; + } + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return json.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = json.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{#supportStreaming}} + public InputStream executeStream(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + if (!response.isSuccessful()) { + throw new ApiException(response.code(), response.message()); + } + if (response.body() == null) { + return null; + } + return response.body().byteStream(); + } catch (IOException e) { + throw new ApiException(e); + } + } + + {{/supportStreaming}} + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws ApiException If fail to serialize the request body object + */ + public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws ApiException If fail to serialize the request body object + */ + public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); + + final String url = buildUrl(path, queryParams, collectionQueryParams); + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + String contentType = (String) headerParams.get("Content-Type"); + // ensuring a default content type + if (contentType == null) { + contentType = "application/json"; + } + + RequestBody reqBody; + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentType)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentType)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + url.append(basePath).append(path); + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } else { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); + mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + Integer.toString(index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/templates/java/libraries/feign/model/ApiResponse.mustache b/templates/java/libraries/okhttp-gson/ApiResponse.mustache similarity index 52% rename from templates/java/libraries/feign/model/ApiResponse.mustache rename to templates/java/libraries/okhttp-gson/ApiResponse.mustache index bc460dc59c..1e277319a9 100644 --- a/templates/java/libraries/feign/model/ApiResponse.mustache +++ b/templates/java/libraries/okhttp-gson/ApiResponse.mustache @@ -1,10 +1,20 @@ -package {{modelPackage}}; +{{>licenseInfo}} -import java.util.Map; -import java.util.List; - -public class ApiResponse{ +package {{invokerPackage}}; +import java.util.List; +import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +public class ApiResponse { final private int statusCode; final private Map> headers; final private T data; @@ -24,7 +34,13 @@ public class ApiResponse{ */ public ApiResponse(int statusCode, Map> headers, T data) { this.statusCode = statusCode; - this.headers = headers; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; this.data = data; } @@ -39,5 +55,4 @@ public class ApiResponse{ public T getData() { return data; } - -} \ No newline at end of file +} diff --git a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache new file mode 100644 index 0000000000..b633aa8f58 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache @@ -0,0 +1,74 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache new file mode 100644 index 0000000000..71e1e2b4cb --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -0,0 +1,62 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache new file mode 100644 index 0000000000..45115940b6 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -0,0 +1,59 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache new file mode 100644 index 0000000000..dd21bcad45 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/README.mustache @@ -0,0 +1,176 @@ +# {{artifactId}} + +{{appName}} +- API version: {{appVersion}} +{{^hideGenerationTimestamp}} + - Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} + +{{{appDescriptionWithNewLines}}} + +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ +2. Maven/Gradle + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + {{{groupId}}} + {{{artifactId}}} + {{{artifactVersion}}} + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy +compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.models.*; +import {{{package}}}.{{{classname}}}; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} + // Configure HTTP bearer authorization: {{{name}}} + HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} + + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} + .{{{paramName}}}({{{paramName}}}){{/optionalParams}} + .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + +## Documentation for Authorization + +{{^authMethods}}All endpoints do not require authorization. +{{/authMethods}}Authentication schemes defined for the API: +{{#authMethods}}### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache new file mode 100644 index 0000000000..7a33790a04 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -0,0 +1,467 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiCallback; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiException; +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ProgressRequestBody; +import {{invokerPackage}}.ProgressResponseBody; +{{#performBeanValidation}} +import {{invokerPackage}}.BeanValidationException; +{{/performBeanValidation}} + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} +{{#performBeanValidation}} +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.ValidatorFactory; +import javax.validation.executable.ExecutableValidator; +import java.util.Set; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +{{/performBeanValidation}} + +{{#imports}}import {{import}}; +{{/imports}} + +import java.lang.reflect.Type; +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{#supportStreaming}} +import java.io.InputStream; +{{/supportStreaming}} +{{/fullJavaUtil}} + +{{#operations}} +public class {{classname}} { + private ApiClient localVarApiClient; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}}/** + * Build call for {{operationId}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + + // create path and map variables + String localVarPath = "{{{path}}}"{{#pathParams}} + .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + + {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarCookieParams = new {{javaUtilPrefix}}HashMap(); + {{javaUtilPrefix}}Map localVarFormParams = new {{javaUtilPrefix}}HashMap(); + + {{#formParams}} + if ({{paramName}} != null) { + localVarFormParams.put("{{baseName}}", {{paramName}}); + } + + {{/formParams}} + {{#queryParams}} + if ({{paramName}} != null) { + {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + } + + {{/queryParams}} + {{#headerParams}} + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{#cookieParams}} + if ({{paramName}} != null) { + localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/cookieParams}} + final String[] localVarAccepts = { + {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @SuppressWarnings("rawtypes") + private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + {{^performBeanValidation}} + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); + } + {{/required}}{{/allParams}} + + okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + return localVarCall; + + {{/performBeanValidation}} + {{#performBeanValidation}} + try { + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ExecutableValidator executableValidator = factory.getValidator().forExecutables(); + + Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; + Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); + Set> violations = executableValidator.validateParameters(this, method, + parameterValues); + + if (violations.size() == 0) { + okhttp3.Call localVarCall = {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + return localVarCall; + + } else { + throw new BeanValidationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + + {{/performBeanValidation}} + } + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{#vendorExtensions.x-streaming}} + public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp;{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{^vendorExtensions.x-streaming}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} + } + {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} (asynchronously) + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + + okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} + return localVarCall; + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#requiredParams}} + private final {{{dataType}}} {{paramName}}; + {{/requiredParams}} + {{#optionalParams}} + private {{{dataType}}} {{paramName}}; + {{/optionalParams}} + + private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + {{#requiredParams}} + this.{{paramName}} = {{paramName}}; + {{/requiredParams}} + } + + {{#optionalParams}} + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/optionalParams}} + /** + * Build call for {{operationId}} + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + + /** + * Execute {{operationId}} request{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + + /** + * Execute {{operationId}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + + /** + * Execute {{operationId}} request (asynchronously) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + } + + /** + * {{summary}} + * {{notes}}{{#requiredParams}} + * @param {{paramName}} {{description}} (required){{/requiredParams}} + * @return API{{operationId}}Request + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} diff --git a/templates/java/libraries/okhttp-gson/apiException.mustache b/templates/java/libraries/okhttp-gson/apiException.mustache new file mode 100644 index 0000000000..d28b1bd963 --- /dev/null +++ b/templates/java/libraries/okhttp-gson/apiException.mustache @@ -0,0 +1,96 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +{{>generatedAnnotation}} +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/templates/java/libraries/feign/pom.mustache b/templates/java/libraries/okhttp-gson/pom.mustache similarity index 61% rename from templates/java/libraries/feign/pom.mustache rename to templates/java/libraries/okhttp-gson/pom.mustache index c1f440cf97..fa5b32cd47 100644 --- a/templates/java/libraries/feign/pom.mustache +++ b/templates/java/libraries/okhttp-gson/pom.mustache @@ -40,6 +40,20 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + + org.apache.maven.plugins maven-enforcer-plugin @@ -91,7 +105,6 @@ - org.apache.maven.plugins maven-jar-plugin @@ -120,40 +133,12 @@ - algoliasearch-core - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java + {{{sourceFolder}}} - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - true - 128m - 512m - - -Xlint:all - -J-Xss4m - - - @@ -185,164 +170,99 @@ io.swagger swagger-annotations - ${swagger-annotations-version} + ${swagger-core-version} - com.google.code.findbugs jsr305 3.0.2 - - - - io.github.openfeign - feign-core - ${feign-version} - - - io.github.openfeign - feign-jackson - ${feign-version} - - - io.github.openfeign - feign-slf4j - ${feign-version} - - - io.github.openfeign.form - feign-form - ${feign-form-version} - - io.github.openfeign - feign-okhttp - ${feign-version} + com.squareup.okhttp3 + okhttp + ${okhttp-version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson-version} + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} + com.google.code.gson + gson + ${gson-version} - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind-version} + io.gsonfire + gson-fire + ${gson-fire-version} - {{#openApiNullable}} - - org.openapitools - jackson-databind-nullable - ${jackson-databind-nullable-version} - - {{/openApiNullable}} - {{#withXml}} - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson-version} + org.apache.commons + commons-lang3 + ${commons-lang3-version} - {{/withXml}} {{#joda}} - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson-version} + joda-time + joda-time + ${jodatime-version} {{/joda}} - {{#java8}} - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson-version} - - {{/java8}} - {{#threetenbp}} - - com.github.joschi.jackson - jackson-datatype-threetenbp - ${jackson-threetenbp-version} - - {{/threetenbp}} - - com.github.scribejava - scribejava-core - ${scribejava-version} - jakarta.annotation jakarta.annotation-api ${jakarta-annotation-version} provided - - - - ch.qos.logback - logback-classic - 1.2.3 - test - + {{#openApiNullable}} - org.junit.jupiter - junit-jupiter - ${junit-version} - test + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + {{/openApiNullable}} + - org.junit.jupiter - junit-jupiter-params + junit + junit ${junit-version} test - org.hamcrest - hamcrest - 2.2 - test - - - com.github.tomakehurst - wiremock-jre8 - 2.27.2 - test - - - commons-io - commons-io - 2.8.0 + org.mockito + mockito-core + 3.11.2 test - UTF-8 - 1.8 + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} ${java.version} ${java.version} - 1.5.24 - 10.11 - 3.8.0 - 2.10.3 + 1.8.5 + 1.6.2 + 4.9.1 + 2.8.6 + 3.11 {{#openApiNullable}} 0.2.1 {{/openApiNullable}} - 2.10.3 + {{#joda}} + 2.10.9 + {{/joda}} {{#threetenbp}} - 2.9.10 + 1.5.0 {{/threetenbp}} 1.3.5 - 5.7.0 - 1.0.0 - 8.0.0 +{{#performBeanValidation}} + 3.0.3 +{{/performBeanValidation}} +{{#useBeanValidation}} + 2.0.2 +{{/useBeanValidation}} + 4.13.1 + UTF-8 From 5488d724cf107108a6866a9d986d436a484ddf4c Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 10:19:58 +0100 Subject: [PATCH 15/19] appId and apiKey --- clients/algoliasearch-client-java-2/README.md | 2 +- .../com/algolia/ApiClient.java | 33 +- .../com/algolia/ApiException.java | 2 +- .../com/algolia/Configuration.java | 42 -- .../com/algolia/auth/ApiKeyAuth.java | 83 ---- .../com/algolia/auth/Authentication.java | 32 -- .../com/algolia/auth/HttpBasicAuth.java | 58 --- .../com/algolia/auth/HttpBearerAuth.java | 71 ---- .../algolia/model/SearchParamsAsString.java | 82 ---- .../com/algolia/search/SearchApi.java | 377 ++++++++---------- clients/algoliasearch-client-java-2/pom.xml | 14 - .../libraries/okhttp-gson/ApiClient.mustache | 59 +-- .../java/libraries/okhttp-gson/api.mustache | 41 +- .../java/libraries/okhttp-gson/pom.mustache | 33 -- 14 files changed, 184 insertions(+), 745 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 612f62a6bf..4f022c0d98 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -2,7 +2,7 @@ Search API - API version: 0.1.0 - - Build date: 2021-12-14T10:06:19.720908+01:00[Europe/Paris] + - Build date: 2021-12-14T10:18:30.595134+01:00[Europe/Paris] API powering the Search feature of Algolia. diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index bd7dc8868e..6511c7dca7 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -12,7 +12,6 @@ package com.algolia; -import com.algolia.auth.Authentication; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -265,29 +264,6 @@ public ApiClient setDebugging(boolean debugging) { return this; } - /** - * The path of temporary folder used to store downloaded files from endpoints with file response. - * The default value is null, i.e. using the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - /** * Get connection timeout (in milliseconds). * @@ -1082,13 +1058,8 @@ public void updateParamsForAuth( Map headerParams, Map cookieParams ) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams); - } + headerParams.put("X-Algolia-Application-Id", this.appId); + headerParams.put("X-Algolia-API-Key", this.apiKey); } /** diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java index a27764d7bf..4c58cf7db8 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -17,7 +17,7 @@ @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-14T10:06:19.720908+01:00[Europe/Paris]" + date = "2021-12-14T10:18:30.595134+01:00[Europe/Paris]" ) public class ApiException extends Exception { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java deleted file mode 100644 index 50f074f215..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Configuration.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" -) -public class Configuration { - - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API instances without providing - * an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } - - /** - * Set the default API client, which would be used when creating API instances without providing - * an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java deleted file mode 100644 index d9dcd013d6..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/ApiKeyAuth.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; - -import com.algolia.Pair; -import java.util.List; -import java.util.Map; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" -) -public class ApiKeyAuth implements Authentication { - - private final String location; - private final String paramName; - - private String apiKey; - private String apiKeyPrefix; - - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } - - public String getLocation() { - return location; - } - - public String getParamName() { - return paramName; - } - - public String getApiKey() { - return apiKey; - } - - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - - public String getApiKeyPrefix() { - return apiKeyPrefix; - } - - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } - - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ) { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java deleted file mode 100644 index 8a2b1bcd3d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/Authentication.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; - -import com.algolia.Pair; -import java.util.List; -import java.util.Map; - -public interface Authentication { - /** - * Apply authentication settings to header and query params. - * - * @param queryParams List of query parameters - * @param headerParams Map of header parameters - * @param cookieParams Map of cookie parameters - */ - void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java deleted file mode 100644 index 67c0ed175f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBasicAuth.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; - -import com.algolia.Pair; -import java.util.List; -import java.util.Map; -import okhttp3.Credentials; - -public class HttpBasicAuth implements Authentication { - - private String username; - private String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ) { - if (username == null && password == null) { - return; - } - headerParams.put( - "Authorization", - Credentials.basic( - username == null ? "" : username, - password == null ? "" : password - ) - ); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java deleted file mode 100644 index 15432efd60..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/auth/HttpBearerAuth.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.auth; - -import com.algolia.Pair; -import java.util.List; -import java.util.Map; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-10T15:33:13.853598+01:00[Europe/Paris]" -) -public class HttpBearerAuth implements Authentication { - - private final String scheme; - private String bearerToken; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } - - /** - * Gets the token, which together with the scheme, will be sent as the value of the Authorization - * header. - * - * @return The bearer token - */ - public String getBearerToken() { - return bearerToken; - } - - /** - * Sets the token, which together with the scheme, will be sent as the value of the Authorization - * header. - * - * @param bearerToken The bearer token to send in the Authorization header - */ - public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; - } - - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams - ) { - if (bearerToken == null) { - return; - } - - headerParams.put( - "Authorization", - (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken - ); - } - - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java deleted file mode 100644 index 543d50161c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParamsAsString.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; - -import com.google.gson.annotations.SerializedName; -import io.swagger.annotations.ApiModelProperty; -import java.util.Objects; - -/** SearchParamsAsString */ -public class SearchParamsAsString { - - public static final String SERIALIZED_NAME_PARAMS = "params"; - - @SerializedName(SERIALIZED_NAME_PARAMS) - private String params; - - public SearchParamsAsString params(String params) { - this.params = params; - return this; - } - - /** - * Get params - * - * @return params - */ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getParams() { - return params; - } - - public void setParams(String params) { - this.params = params; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SearchParamsAsString searchParamsAsString = (SearchParamsAsString) o; - return Objects.equals(this.params, searchParamsAsString.params); - } - - @Override - public int hashCode() { - return Objects.hash(params); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SearchParamsAsString {\n"); - sb.append(" params: ").append(toIndentedString(params)).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-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index c17687a086..1a45e91372 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -16,7 +16,6 @@ import com.algolia.ApiClient; import com.algolia.ApiException; import com.algolia.ApiResponse; -import com.algolia.Configuration; import com.algolia.Pair; import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; @@ -38,24 +37,10 @@ import java.util.List; import java.util.Map; -public class SearchApi { +public class SearchApi extends ApiClient { - private ApiClient localVarApiClient; - - public SearchApi() { - this(Configuration.getDefaultApiClient()); - } - - public SearchApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; + public SearchApi(String appId, String apiKey) { + super(appId, apiKey); } /** @@ -87,7 +72,7 @@ public okhttp3.Call batchCall( String localVarPath = "/1/indexes/{indexName}/batch".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -97,32 +82,29 @@ public okhttp3.Call batchCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -204,7 +186,7 @@ public ApiResponse batchWithHttpInfo( null ); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -236,7 +218,7 @@ public okhttp3.Call batchAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -267,7 +249,7 @@ public okhttp3.Call deleteIndexCall( String localVarPath = "/1/indexes/{indexName}".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -277,33 +259,30 @@ public okhttp3.Call deleteIndexCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -368,7 +347,7 @@ public ApiResponse deleteIndexWithHttpInfo( ) throws ApiException { okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -397,7 +376,7 @@ public okhttp3.Call deleteIndexAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -428,7 +407,7 @@ public okhttp3.Call getSettingsCall( String localVarPath = "/1/indexes/{indexName}/settings".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -438,33 +417,30 @@ public okhttp3.Call getSettingsCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -528,7 +504,7 @@ public ApiResponse getSettingsWithHttpInfo(String indexName) throws ApiException { okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -557,7 +533,7 @@ public okhttp3.Call getSettingsAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -596,39 +572,34 @@ public okhttp3.Call listIndicesCall( Map localVarFormParams = new HashMap(); if (page != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("Page", page) - ); + localVarQueryParams.addAll(this.parameterToPair("Page", page)); } final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = {}; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -689,7 +660,7 @@ public ApiResponse listIndicesWithHttpInfo(Integer page) throws ApiException { okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -717,7 +688,7 @@ public okhttp3.Call listIndicesAsync( ) throws ApiException { okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -754,32 +725,29 @@ public okhttp3.Call multipleQueriesCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -854,7 +822,7 @@ public ApiResponse multipleQueriesWithHttpInfo( ); Type localVarReturnType = new TypeToken() {} .getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -884,7 +852,7 @@ public okhttp3.Call multipleQueriesAsync( ); Type localVarReturnType = new TypeToken() {} .getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -917,7 +885,7 @@ public okhttp3.Call operationIndexCall( String localVarPath = "/1/indexes/{indexName}/operation".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -927,32 +895,29 @@ public okhttp3.Call operationIndexCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -1042,7 +1007,7 @@ public ApiResponse operationIndexWithHttpInfo( ); Type localVarReturnType = new TypeToken() {} .getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -1075,7 +1040,7 @@ public okhttp3.Call operationIndexAsync( ); Type localVarReturnType = new TypeToken() {} .getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -1108,7 +1073,7 @@ public okhttp3.Call saveObjectCall( String localVarPath = "/1/indexes/{indexName}".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -1118,32 +1083,29 @@ public okhttp3.Call saveObjectCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -1231,7 +1193,7 @@ public ApiResponse saveObjectWithHttpInfo( null ); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -1263,7 +1225,7 @@ public okhttp3.Call saveObjectAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -1296,7 +1258,7 @@ public okhttp3.Call searchCall( String localVarPath = "/1/indexes/{indexName}/query".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -1306,32 +1268,29 @@ public okhttp3.Call searchCall( Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -1413,7 +1372,7 @@ public ApiResponse searchWithHttpInfo( null ); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -1445,7 +1404,7 @@ public okhttp3.Call searchAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } @@ -1481,7 +1440,7 @@ public okhttp3.Call setSettingsCall( String localVarPath = "/1/indexes/{indexName}/settings".replaceAll( "\\{" + "indexName" + "\\}", - localVarApiClient.escapeString(indexName.toString()) + this.escapeString(indexName.toString()) ); List localVarQueryParams = new ArrayList(); @@ -1492,40 +1451,34 @@ public okhttp3.Call setSettingsCall( if (forwardToReplicas != null) { localVarQueryParams.addAll( - localVarApiClient.parameterToPair( - "forwardToReplicas", - forwardToReplicas - ) + this.parameterToPair("forwardToReplicas", forwardToReplicas) ); } final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept( - localVarAccepts - ); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; - final String localVarContentType = localVarApiClient.selectHeaderContentType( - localVarContentTypes - ); + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "apiKey", "appId" }; - return localVarApiClient.buildCall( - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback - ); + return this.buildCall( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); } @SuppressWarnings("rawtypes") @@ -1625,7 +1578,7 @@ public ApiResponse setSettingsWithHttpInfo( null ); Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return this.execute(localVarCall, localVarReturnType); } /** @@ -1663,7 +1616,7 @@ public okhttp3.Call setSettingsAsync( _callback ); Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } } diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml index 1db6bd5da5..e905021f31 100644 --- a/clients/algoliasearch-client-java-2/pom.xml +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -207,19 +207,6 @@ jackson-databind-nullable ${jackson-databind-nullable-version}
- - - junit - junit - ${junit-version} - test - - - org.mockito - mockito-core - 3.11.2 - test - 1.8 @@ -232,7 +219,6 @@ 3.11 0.2.1 1.3.5 - 4.13.1 UTF-8 diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 3f024badea..2199bcf635 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -54,16 +54,6 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; -import {{invokerPackage}}.auth.Authentication; -import {{invokerPackage}}.auth.HttpBasicAuth; -import {{invokerPackage}}.auth.HttpBearerAuth; -import {{invokerPackage}}.auth.ApiKeyAuth; -{{#hasOAuthMethods}} -import {{invokerPackage}}.auth.OAuth; -import {{invokerPackage}}.auth.RetryingOAuth; -import {{invokerPackage}}.auth.OAuthFlow; -{{/hasOAuthMethods}} - public class ApiClient { private boolean debugging = false; @@ -294,29 +284,6 @@ public class ApiClient { return this; } - /** - * The path of temporary folder used to store downloaded files from endpoints - * with file response. The default value is null, i.e. using - * the system's default temporary folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - /** * Get connection timeout (in milliseconds). * @@ -383,23 +350,6 @@ public class ApiClient { return this; } - {{#hasOAuthMethods}} - /** - * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) - * - * @return Token request builder - */ - public TokenRequestBuilder getTokenEndPoint() { - for (Authentication apiAuth : authentications.values()) { - if (apiAuth instanceof RetryingOAuth) { - RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; - return retryingOAuth.getTokenRequestBuilder(); - } - } - return null; - } - {{/hasOAuthMethods}} - /** * Format the given parameter object into string. * @@ -1016,13 +966,8 @@ public class ApiClient { * @param cookieParams Map of cookie parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { - for (String authName : authNames) { - Authentication auth = authentications.get(authName); - if (auth == null) { - throw new RuntimeException("Authentication undefined: " + authName); - } - auth.applyToParams(queryParams, headerParams, cookieParams); - } + headerParams.put("X-Algolia-Application-Id", this.appId); + headerParams.put("X-Algolia-API-Key", this.apiKey); } /** diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 7a33790a04..6370d2d98f 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -6,7 +6,6 @@ import {{invokerPackage}}.ApiCallback; import {{invokerPackage}}.ApiClient; import {{invokerPackage}}.ApiException; import {{invokerPackage}}.ApiResponse; -import {{invokerPackage}}.Configuration; import {{invokerPackage}}.Pair; import {{invokerPackage}}.ProgressRequestBody; import {{invokerPackage}}.ProgressResponseBody; @@ -46,23 +45,9 @@ import java.io.InputStream; {{/fullJavaUtil}} {{#operations}} -public class {{classname}} { - private ApiClient localVarApiClient; - - public {{classname}}() { - this(Configuration.getDefaultApiClient()); - } - - public {{classname}}(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; +public class {{classname}} extends ApiClient { + public {{classname}}(String appId, String apiKey) { + super(appId, apiKey); } {{#operation}} @@ -97,7 +82,7 @@ public class {{classname}} { // create path and map variables String localVarPath = "{{{path}}}"{{#pathParams}} - .replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + .replaceAll("\\{" + "{{baseName}}" + "\\}", this.escapeString({{#collectionFormat}}this.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; {{javaUtilPrefix}}List localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); {{javaUtilPrefix}}List localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); @@ -113,26 +98,26 @@ public class {{classname}} { {{/formParams}} {{#queryParams}} if ({{paramName}} != null) { - {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + {{#collectionFormat}}localVarCollectionQueryParams.addAll(this.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(this.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); } {{/queryParams}} {{#headerParams}} if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + localVarHeaderParams.put("{{baseName}}", this.parameterToString({{paramName}})); } {{/headerParams}} {{#cookieParams}} if ({{paramName}} != null) { - localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + localVarCookieParams.put("{{baseName}}", this.parameterToString({{paramName}})); } {{/cookieParams}} final String[] localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } @@ -140,11 +125,11 @@ public class {{classname}} { final String[] localVarContentTypes = { {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; - return localVarApiClient.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return this.buildCall(localVarPath, "{{httpMethod}}", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } {{#isDeprecated}} @@ -262,12 +247,12 @@ public class {{classname}} { public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.executeStream(localVarCall, localVarReturnType);{{/returnType}} + return this.executeStream(localVarCall, localVarReturnType);{{/returnType}} } {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return localVarApiClient.execute(localVarCall);{{/returnType}} + return this.execute(localVarCall, localVarReturnType);{{/returnType}}{{^returnType}}return this.execute(localVarCall);{{/returnType}} } {{/vendorExtensions.x-streaming}} @@ -302,7 +287,7 @@ public class {{classname}} { okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} + this.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}this.executeAsync(localVarCall, _callback);{{/returnType}} return localVarCall; } {{#vendorExtensions.x-group-parameters}} diff --git a/templates/java/libraries/okhttp-gson/pom.mustache b/templates/java/libraries/okhttp-gson/pom.mustache index fa5b32cd47..8482f4e415 100644 --- a/templates/java/libraries/okhttp-gson/pom.mustache +++ b/templates/java/libraries/okhttp-gson/pom.mustache @@ -203,13 +203,6 @@ commons-lang3 ${commons-lang3-version} - {{#joda}} - - joda-time - joda-time - ${jodatime-version} - - {{/joda}} jakarta.annotation jakarta.annotation-api @@ -223,19 +216,6 @@ ${jackson-databind-nullable-version} {{/openApiNullable}} - - - junit - junit - ${junit-version} - test - - - org.mockito - mockito-core - 3.11.2 - test - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} @@ -249,20 +229,7 @@ {{#openApiNullable}} 0.2.1 {{/openApiNullable}} - {{#joda}} - 2.10.9 - {{/joda}} - {{#threetenbp}} - 1.5.0 - {{/threetenbp}} 1.3.5 -{{#performBeanValidation}} - 3.0.3 -{{/performBeanValidation}} -{{#useBeanValidation}} - 2.0.2 -{{/useBeanValidation}} - 4.13.1 UTF-8 From 346791338f2be6f4e8fa64ba0c2040c28990a3c7 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 10:24:37 +0100 Subject: [PATCH 16/19] change readmed --- clients/algoliasearch-client-java-2/README.md | 123 +----------------- .../com/algolia/ApiException.java | 4 - .../libraries/okhttp-gson/README.mustache | 102 +-------------- .../okhttp-gson/apiException.mustache | 1 - 4 files changed, 3 insertions(+), 227 deletions(-) diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 4f022c0d98..c1dc46500d 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -2,7 +2,7 @@ Search API - API version: 0.1.0 - - Build date: 2021-12-14T10:18:30.595134+01:00[Europe/Paris] + - Build date: 2021-12-14T10:23:23.841668+01:00[Europe/Paris] API powering the Search feature of Algolia. @@ -68,123 +68,4 @@ Then manually install the following JARs: ## Getting Started -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java - -// Import classes: -import com.algolia.ApiClient; -import com.algolia.ApiException; -import com.algolia.Configuration; -import com.algolia.auth.*; -import com.algolia.models.*; -import com.algolia.search.SearchApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://localhost"); - - // Configure API key authorization: apiKey - ApiKeyAuth apiKey = (ApiKeyAuth) defaultClient.getAuthentication("apiKey"); - apiKey.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //apiKey.setApiKeyPrefix("Token"); - - // Configure API key authorization: appId - ApiKeyAuth appId = (ApiKeyAuth) defaultClient.getAuthentication("appId"); - appId.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //appId.setApiKeyPrefix("Token"); - - SearchApi apiInstance = new SearchApi(defaultClient); - String indexName = "myIndexName"; // String | The index in which to perform the request. - BatchObject batchObject = new BatchObject(); // BatchObject | - try { - BatchResponse result = apiInstance.batch(indexName, batchObject); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling SearchApi#batch"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} - -``` - -## Documentation for API Endpoints - -All URIs are relative to *http://localhost* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*SearchApi* | [**batch**](docs/SearchApi.md#batch) | **POST** /1/indexes/{indexName}/batch | -*SearchApi* | [**deleteIndex**](docs/SearchApi.md#deleteIndex) | **DELETE** /1/indexes/{indexName} | Delete index. -*SearchApi* | [**getSettings**](docs/SearchApi.md#getSettings) | **GET** /1/indexes/{indexName}/settings | -*SearchApi* | [**listIndices**](docs/SearchApi.md#listIndices) | **GET** /1/indexes | List existing indexes. -*SearchApi* | [**multipleQueries**](docs/SearchApi.md#multipleQueries) | **POST** /1/indexes/*/queries | -*SearchApi* | [**operationIndex**](docs/SearchApi.md#operationIndex) | **POST** /1/indexes/{indexName}/operation | Copy/move index. -*SearchApi* | [**saveObject**](docs/SearchApi.md#saveObject) | **POST** /1/indexes/{indexName} | -*SearchApi* | [**search**](docs/SearchApi.md#search) | **POST** /1/indexes/{indexName}/query | -*SearchApi* | [**setSettings**](docs/SearchApi.md#setSettings) | **PUT** /1/indexes/{indexName}/settings | - - -## Documentation for Models - - - [BaseIndexSettings](docs/BaseIndexSettings.md) - - [BaseSearchParams](docs/BaseSearchParams.md) - - [BaseSearchResponse](docs/BaseSearchResponse.md) - - [BaseSearchResponseFacetsStats](docs/BaseSearchResponseFacetsStats.md) - - [BatchObject](docs/BatchObject.md) - - [BatchResponse](docs/BatchResponse.md) - - [DeleteIndexResponse](docs/DeleteIndexResponse.md) - - [ErrorBase](docs/ErrorBase.md) - - [HighlightResult](docs/HighlightResult.md) - - [Index](docs/Index.md) - - [IndexSettings](docs/IndexSettings.md) - - [IndexSettingsAsSearchParams](docs/IndexSettingsAsSearchParams.md) - - [ListIndicesResponse](docs/ListIndicesResponse.md) - - [MultipleQueries](docs/MultipleQueries.md) - - [MultipleQueriesObject](docs/MultipleQueriesObject.md) - - [MultipleQueriesResponse](docs/MultipleQueriesResponse.md) - - [Operation](docs/Operation.md) - - [OperationIndexObject](docs/OperationIndexObject.md) - - [OperationIndexResponse](docs/OperationIndexResponse.md) - - [RankingInfo](docs/RankingInfo.md) - - [RankingInfoMatchedGeoLocation](docs/RankingInfoMatchedGeoLocation.md) - - [Record](docs/Record.md) - - [SaveObjectResponse](docs/SaveObjectResponse.md) - - [SearchHits](docs/SearchHits.md) - - [SearchParams](docs/SearchParams.md) - - [SearchResponse](docs/SearchResponse.md) - - [SetSettingsResponse](docs/SetSettingsResponse.md) - - [SnippetResult](docs/SnippetResult.md) - - -## Documentation for Authorization - -Authentication schemes defined for the API: -### apiKey - -- **Type**: API key -- **API key parameter name**: X-Algolia-API-Key -- **Location**: HTTP header - -### appId - -- **Type**: API key -- **API key parameter name**: X-Algolia-Application-Id -- **Location**: HTTP header - - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - - - +Checkout the playground. diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java index 4c58cf7db8..243e8c54e5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -15,10 +15,6 @@ import java.util.List; import java.util.Map; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2021-12-14T10:18:30.595134+01:00[Europe/Paris]" -) public class ApiException extends Exception { private int code = 0; diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache index dd21bcad45..2fdc15bb93 100644 --- a/templates/java/libraries/okhttp-gson/README.mustache +++ b/templates/java/libraries/okhttp-gson/README.mustache @@ -73,104 +73,4 @@ Then manually install the following JARs: ## Getting Started -Please follow the [installation](#installation) instruction and execute the following Java code: - -```java -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -// Import classes: -import {{{invokerPackage}}}.ApiClient; -import {{{invokerPackage}}}.ApiException; -import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} -import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} -import {{{invokerPackage}}}.models.*; -import {{{package}}}.{{{classname}}}; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("{{{basePath}}}"); - {{#hasAuthMethods}} - {{#authMethods}}{{#isBasic}}{{#isBasicBasic}} - // Configure HTTP basic authorization: {{{name}}} - HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setUsername("YOUR USERNAME"); - {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasicBasic}}{{#isBasicBearer}} - // Configure HTTP bearer authorization: {{{name}}} - HttpBearerAuth {{{name}}} = (HttpBearerAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setBearerToken("BEARER TOKEN");{{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} - // Configure API key authorization: {{{name}}} - ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} - // Configure OAuth2 access token for authorization: {{{name}}} - OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); - {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} - {{/authMethods}} - {{/hasAuthMethods}} - - {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); - {{#allParams}} - {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} - {{/allParams}} - try { - {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}{{^vendorExtensions.x-group-parameters}}({{#allParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}});{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}){{#optionalParams}} - .{{{paramName}}}({{{paramName}}}){{/optionalParams}} - .execute();{{/vendorExtensions.x-group-parameters}}{{#returnType}} - System.out.println(result);{{/returnType}} - } catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} -``` - -## Documentation for API Endpoints - -All URIs are relative to *{{basePath}}* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} -{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} - -## Documentation for Models - -{{#models}}{{#model}} - [{{classname}}]({{modelDocPath}}{{classname}}.md) -{{/model}}{{/models}} - -## Documentation for Authorization - -{{^authMethods}}All endpoints do not require authorization. -{{/authMethods}}Authentication schemes defined for the API: -{{#authMethods}}### {{name}} - -{{#isApiKey}}- **Type**: API key -- **API key parameter name**: {{keyParamName}} -- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication -{{/isBasic}} -{{#isOAuth}}- **Type**: OAuth -- **Flow**: {{flow}} -- **Authorization URL**: {{authorizationUrl}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - {{scope}}: {{description}} -{{/scopes}} -{{/isOAuth}} - -{{/authMethods}} - -## Recommendation - -It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. - -## Author - -{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} -{{/-last}}{{/apis}}{{/apiInfo}} +Checkout the playground. diff --git a/templates/java/libraries/okhttp-gson/apiException.mustache b/templates/java/libraries/okhttp-gson/apiException.mustache index d28b1bd963..d1a38fc7d3 100644 --- a/templates/java/libraries/okhttp-gson/apiException.mustache +++ b/templates/java/libraries/okhttp-gson/apiException.mustache @@ -9,7 +9,6 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} -{{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ private int code = 0; private Map> responseHeaders = null; From b125c98bc607ceb7cd25faa4f58fc573e97a27ea Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 10:53:08 +0100 Subject: [PATCH 17/19] fix yarn generate --- scripts/multiplexer.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/multiplexer.sh b/scripts/multiplexer.sh index 8d690d61d6..ecca5d8b7a 100755 --- a/scripts/multiplexer.sh +++ b/scripts/multiplexer.sh @@ -16,6 +16,8 @@ CLIENT=$3 LANGUAGES=() CLIENTS=() +GENERATORS=() + find_clients_and_languages() { echo "> Searching for available languages and clients..." @@ -25,6 +27,8 @@ find_clients_and_languages() { local lang=${generator%-*} local client=${generator#*-} + GENERATORS+=($generator) + if [[ ! ${LANGUAGES[*]} =~ $lang ]]; then LANGUAGES+=($lang) fi @@ -57,6 +61,8 @@ fi for lang in "${LANGUAGE[@]}"; do for client in "${CLIENT[@]}"; do - $CMD $lang $client + if [[ " ${GENERATORS[*]} " =~ " ${lang}-${client} " ]]; then + $CMD $lang $client + fi done done From 0b048d49f67477ed872d0fcd8d88da175b199a75 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 10:55:21 +0100 Subject: [PATCH 18/19] generate synonyms --- .../model/ClearAllSynonymsResponse.java | 121 ++ .../algolia/model/DeleteSynonymResponse.java | 121 ++ .../algolia/model/SaveSynonymResponse.java | 148 ++ .../algolia/model/SaveSynonymsResponse.java | 121 ++ .../algolia/model/SearchSynonymsResponse.java | 125 ++ .../com/algolia/model/SynonymHit.java | 418 ++++ .../model/SynonymHitHighlightResult.java | 125 ++ .../com/algolia/search/SearchApi.java | 1813 ++++++++++++++--- 8 files changed, 2744 insertions(+), 248 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java new file mode 100644 index 0000000000..1cb2e4a53d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java @@ -0,0 +1,121 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** ClearAllSynonymsResponse */ +public class ClearAllSynonymsResponse { + + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public ClearAllSynonymsResponse taskID(Integer taskID) { + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * + * @return taskID + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "taskID of the indexing task to wait for." + ) + public Integer getTaskID() { + return taskID; + } + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + public ClearAllSynonymsResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * + * @return updatedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "Date of last update (ISO-8601 format)." + ) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClearAllSynonymsResponse clearAllSynonymsResponse = (ClearAllSynonymsResponse) o; + return ( + Objects.equals(this.taskID, clearAllSynonymsResponse.taskID) && + Objects.equals(this.updatedAt, clearAllSynonymsResponse.updatedAt) + ); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClearAllSynonymsResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .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-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java new file mode 100644 index 0000000000..d5af89ab3c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java @@ -0,0 +1,121 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** DeleteSynonymResponse */ +public class DeleteSynonymResponse { + + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_DELETED_AT = "deletedAt"; + + @SerializedName(SERIALIZED_NAME_DELETED_AT) + private OffsetDateTime deletedAt; + + public DeleteSynonymResponse taskID(Integer taskID) { + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * + * @return taskID + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "taskID of the indexing task to wait for." + ) + public Integer getTaskID() { + return taskID; + } + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + public DeleteSynonymResponse deletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + return this; + } + + /** + * Date of deletion (ISO-8601 format). + * + * @return deletedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "Date of deletion (ISO-8601 format)." + ) + public OffsetDateTime getDeletedAt() { + return deletedAt; + } + + public void setDeletedAt(OffsetDateTime deletedAt) { + this.deletedAt = deletedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSynonymResponse deleteSynonymResponse = (DeleteSynonymResponse) o; + return ( + Objects.equals(this.taskID, deleteSynonymResponse.taskID) && + Objects.equals(this.deletedAt, deleteSynonymResponse.deletedAt) + ); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, deletedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteSynonymResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb + .append(" deletedAt: ") + .append(toIndentedString(deletedAt)) + .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-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java new file mode 100644 index 0000000000..8e9ce72d70 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java @@ -0,0 +1,148 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** SaveSynonymResponse */ +public class SaveSynonymResponse { + + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public SaveSynonymResponse taskID(Integer taskID) { + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * + * @return taskID + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "taskID of the indexing task to wait for." + ) + public Integer getTaskID() { + return taskID; + } + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + public SaveSynonymResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * + * @return updatedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "Date of last update (ISO-8601 format)." + ) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public SaveSynonymResponse id(String id) { + this.id = id; + return this; + } + + /** + * objectID of the inserted object. + * + * @return id + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "objectID of the inserted object.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaveSynonymResponse saveSynonymResponse = (SaveSynonymResponse) o; + return ( + Objects.equals(this.taskID, saveSynonymResponse.taskID) && + Objects.equals(this.updatedAt, saveSynonymResponse.updatedAt) && + Objects.equals(this.id, saveSynonymResponse.id) + ); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, updatedAt, id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaveSynonymResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).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-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java new file mode 100644 index 0000000000..d868eadb51 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java @@ -0,0 +1,121 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.Objects; + +/** SaveSynonymsResponse */ +public class SaveSynonymsResponse { + + public static final String SERIALIZED_NAME_TASK_I_D = "taskID"; + + @SerializedName(SERIALIZED_NAME_TASK_I_D) + private Integer taskID; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public SaveSynonymsResponse taskID(Integer taskID) { + this.taskID = taskID; + return this; + } + + /** + * taskID of the indexing task to wait for. + * + * @return taskID + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "taskID of the indexing task to wait for." + ) + public Integer getTaskID() { + return taskID; + } + + public void setTaskID(Integer taskID) { + this.taskID = taskID; + } + + public SaveSynonymsResponse updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Date of last update (ISO-8601 format). + * + * @return updatedAt + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "Date of last update (ISO-8601 format)." + ) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SaveSynonymsResponse saveSynonymsResponse = (SaveSynonymsResponse) o; + return ( + Objects.equals(this.taskID, saveSynonymsResponse.taskID) && + Objects.equals(this.updatedAt, saveSynonymsResponse.updatedAt) + ); + } + + @Override + public int hashCode() { + return Objects.hash(taskID, updatedAt); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SaveSynonymsResponse {\n"); + sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n"); + sb + .append(" updatedAt: ") + .append(toIndentedString(updatedAt)) + .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-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java new file mode 100644 index 0000000000..ba705b8de9 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java @@ -0,0 +1,125 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; + +/** SearchSynonymsResponse */ +public class SearchSynonymsResponse extends HashMap { + + public static final String SERIALIZED_NAME_HITS = "hits"; + + @SerializedName(SERIALIZED_NAME_HITS) + private List hits = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NB_HITS = "nbHits"; + + @SerializedName(SERIALIZED_NAME_NB_HITS) + private Integer nbHits; + + public SearchSynonymsResponse hits(List hits) { + this.hits = hits; + return this; + } + + public SearchSynonymsResponse addHitsItem(SynonymHit hitsItem) { + this.hits.add(hitsItem); + return this; + } + + /** + * Array of synonym objects. + * + * @return hits + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Array of synonym objects.") + public List getHits() { + return hits; + } + + public void setHits(List hits) { + this.hits = hits; + } + + public SearchSynonymsResponse nbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** + * Number of hits that the search query matched + * + * @return nbHits + */ + @javax.annotation.Nonnull + @ApiModelProperty( + example = "20", + required = true, + value = "Number of hits that the search query matched" + ) + public Integer getNbHits() { + return nbHits; + } + + public void setNbHits(Integer nbHits) { + this.nbHits = nbHits; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchSynonymsResponse searchSynonymsResponse = (SearchSynonymsResponse) o; + return ( + Objects.equals(this.hits, searchSynonymsResponse.hits) && + Objects.equals(this.nbHits, searchSynonymsResponse.nbHits) && + super.equals(o) + ); + } + + @Override + public int hashCode() { + return Objects.hash(hits, nbHits, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchSynonymsResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).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-2/algoliasearch-core/com/algolia/model/SynonymHit.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java new file mode 100644 index 0000000000..9aadae84ca --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java @@ -0,0 +1,418 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Synonym object. */ +@ApiModel(description = "Synonym object.") +public class SynonymHit { + + public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID"; + + @SerializedName(SERIALIZED_NAME_OBJECT_I_D) + private String objectID; + + /** Type of the synonym object. */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + SYNONYM("synonym"), + + ONEWAYSYNONYM("onewaysynonym"), + + ALTCORRECTION1("altcorrection1"), + + ALTCORRECTION2("altcorrection2"), + + PLACEHOLDER("placeholder"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypeEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + private TypeEnum type; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private List synonyms = null; + + public static final String SERIALIZED_NAME_INPUT = "input"; + + @SerializedName(SERIALIZED_NAME_INPUT) + private String input; + + public static final String SERIALIZED_NAME_WORD = "word"; + + @SerializedName(SERIALIZED_NAME_WORD) + private String word; + + public static final String SERIALIZED_NAME_CORRECTIONS = "corrections"; + + @SerializedName(SERIALIZED_NAME_CORRECTIONS) + private List corrections = null; + + public static final String SERIALIZED_NAME_PLACEHOLDER = "placeholder"; + + @SerializedName(SERIALIZED_NAME_PLACEHOLDER) + private String placeholder; + + public static final String SERIALIZED_NAME_REPLACEMENTS = "replacements"; + + @SerializedName(SERIALIZED_NAME_REPLACEMENTS) + private List replacements = null; + + public static final String SERIALIZED_NAME_HIGHLIGHT_RESULT = + "_highlightResult"; + + @SerializedName(SERIALIZED_NAME_HIGHLIGHT_RESULT) + private SynonymHitHighlightResult highlightResult; + + public SynonymHit objectID(String objectID) { + this.objectID = objectID; + return this; + } + + /** + * Unique identifier of the synonym object to be created or updated. + * + * @return objectID + */ + @javax.annotation.Nonnull + @ApiModelProperty( + required = true, + value = "Unique identifier of the synonym object to be created or updated." + ) + public String getObjectID() { + return objectID; + } + + public void setObjectID(String objectID) { + this.objectID = objectID; + } + + public SynonymHit type(TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of the synonym object. + * + * @return type + */ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "Type of the synonym object.") + public TypeEnum getType() { + return type; + } + + public void setType(TypeEnum type) { + this.type = type; + } + + public SynonymHit synonyms(List synonyms) { + this.synonyms = synonyms; + return this; + } + + public SynonymHit addSynonymsItem(String synonymsItem) { + if (this.synonyms == null) { + this.synonyms = new ArrayList<>(); + } + this.synonyms.add(synonymsItem); + return this; + } + + /** + * Words or phrases to be considered equivalent. + * + * @return synonyms + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Words or phrases to be considered equivalent.") + public List getSynonyms() { + return synonyms; + } + + public void setSynonyms(List synonyms) { + this.synonyms = synonyms; + } + + public SynonymHit input(String input) { + this.input = input; + return this; + } + + /** + * Word or phrase to appear in query strings (for onewaysynonym). + * + * @return input + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = "Word or phrase to appear in query strings (for onewaysynonym)." + ) + public String getInput() { + return input; + } + + public void setInput(String input) { + this.input = input; + } + + public SynonymHit word(String word) { + this.word = word; + return this; + } + + /** + * Word or phrase to appear in query strings (for altcorrection1 and altcorrection2). + * + * @return word + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = "Word or phrase to appear in query strings (for altcorrection1 and altcorrection2)." + ) + public String getWord() { + return word; + } + + public void setWord(String word) { + this.word = word; + } + + public SynonymHit corrections(List corrections) { + this.corrections = corrections; + return this; + } + + public SynonymHit addCorrectionsItem(String correctionsItem) { + if (this.corrections == null) { + this.corrections = new ArrayList<>(); + } + this.corrections.add(correctionsItem); + return this; + } + + /** + * Words to be matched in records. + * + * @return corrections + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Words to be matched in records.") + public List getCorrections() { + return corrections; + } + + public void setCorrections(List corrections) { + this.corrections = corrections; + } + + public SynonymHit placeholder(String placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + * Token to be put inside records. + * + * @return placeholder + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Token to be put inside records.") + public String getPlaceholder() { + return placeholder; + } + + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } + + public SynonymHit replacements(List replacements) { + this.replacements = replacements; + return this; + } + + public SynonymHit addReplacementsItem(String replacementsItem) { + if (this.replacements == null) { + this.replacements = new ArrayList<>(); + } + this.replacements.add(replacementsItem); + return this; + } + + /** + * List of query words that will match the token. + * + * @return replacements + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "List of query words that will match the token.") + public List getReplacements() { + return replacements; + } + + public void setReplacements(List replacements) { + this.replacements = replacements; + } + + public SynonymHit highlightResult(SynonymHitHighlightResult highlightResult) { + this.highlightResult = highlightResult; + return this; + } + + /** + * Get highlightResult + * + * @return highlightResult + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public SynonymHitHighlightResult getHighlightResult() { + return highlightResult; + } + + public void setHighlightResult(SynonymHitHighlightResult highlightResult) { + this.highlightResult = highlightResult; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SynonymHit synonymHit = (SynonymHit) o; + return ( + Objects.equals(this.objectID, synonymHit.objectID) && + Objects.equals(this.type, synonymHit.type) && + Objects.equals(this.synonyms, synonymHit.synonyms) && + Objects.equals(this.input, synonymHit.input) && + Objects.equals(this.word, synonymHit.word) && + Objects.equals(this.corrections, synonymHit.corrections) && + Objects.equals(this.placeholder, synonymHit.placeholder) && + Objects.equals(this.replacements, synonymHit.replacements) && + Objects.equals(this.highlightResult, synonymHit.highlightResult) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + objectID, + type, + synonyms, + input, + word, + corrections, + placeholder, + replacements, + highlightResult + ); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SynonymHit {\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).append("\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" word: ").append(toIndentedString(word)).append("\n"); + sb + .append(" corrections: ") + .append(toIndentedString(corrections)) + .append("\n"); + sb + .append(" placeholder: ") + .append(toIndentedString(placeholder)) + .append("\n"); + sb + .append(" replacements: ") + .append(toIndentedString(replacements)) + .append("\n"); + sb + .append(" highlightResult: ") + .append(toIndentedString(highlightResult)) + .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-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java new file mode 100644 index 0000000000..0988f468d8 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java @@ -0,0 +1,125 @@ +/* + * Search API + * API powering the Search feature of Algolia. + * + * The version of the OpenAPI document: 0.1.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 com.algolia.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Highlighted results */ +@ApiModel(description = "Highlighted results") +public class SynonymHitHighlightResult { + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + private HighlightResult type; + + public static final String SERIALIZED_NAME_SYNONYMS = "synonyms"; + + @SerializedName(SERIALIZED_NAME_SYNONYMS) + private List synonyms = null; + + public SynonymHitHighlightResult type(HighlightResult type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public HighlightResult getType() { + return type; + } + + public void setType(HighlightResult type) { + this.type = type; + } + + public SynonymHitHighlightResult synonyms(List synonyms) { + this.synonyms = synonyms; + return this; + } + + public SynonymHitHighlightResult addSynonymsItem( + HighlightResult synonymsItem + ) { + if (this.synonyms == null) { + this.synonyms = new ArrayList<>(); + } + this.synonyms.add(synonymsItem); + return this; + } + + /** + * Get synonyms + * + * @return synonyms + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + public List getSynonyms() { + return synonyms; + } + + public void setSynonyms(List synonyms) { + this.synonyms = synonyms; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SynonymHitHighlightResult synonymHitHighlightResult = (SynonymHitHighlightResult) o; + return ( + Objects.equals(this.type, synonymHitHighlightResult.type) && + Objects.equals(this.synonyms, synonymHitHighlightResult.synonyms) + ); + } + + @Override + public int hashCode() { + return Objects.hash(type, synonyms); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SynonymHitHighlightResult {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" synonyms: ").append(toIndentedString(synonyms)).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-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 1a45e91372..896c991ff2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -19,7 +19,9 @@ import com.algolia.Pair; import com.algolia.model.BatchObject; import com.algolia.model.BatchResponse; +import com.algolia.model.ClearAllSynonymsResponse; import com.algolia.model.DeleteIndexResponse; +import com.algolia.model.DeleteSynonymResponse; import com.algolia.model.IndexSettings; import com.algolia.model.ListIndicesResponse; import com.algolia.model.MultipleQueriesObject; @@ -27,9 +29,13 @@ import com.algolia.model.OperationIndexObject; import com.algolia.model.OperationIndexResponse; import com.algolia.model.SaveObjectResponse; +import com.algolia.model.SaveSynonymResponse; +import com.algolia.model.SaveSynonymsResponse; import com.algolia.model.SearchParams; import com.algolia.model.SearchResponse; +import com.algolia.model.SearchSynonymsResponse; import com.algolia.model.SetSettingsResponse; +import com.algolia.model.SynonymHit; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; @@ -223,9 +229,11 @@ public okhttp3.Call batchAsync( } /** - * Build call for deleteIndex + * Build call for clearAllSynonyms * * @param indexName The index in which to perform the request. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -239,15 +247,16 @@ public okhttp3.Call batchAsync( * 404 Index not found. - * */ - public okhttp3.Call deleteIndexCall( + public okhttp3.Call clearAllSynonymsCall( String indexName, + Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = - "/1/indexes/{indexName}".replaceAll( + "/1/indexes/{indexName}/synonyms/clear".replaceAll( "\\{" + "indexName" + "\\}", this.escapeString(indexName.toString()) ); @@ -258,6 +267,12 @@ public okhttp3.Call deleteIndexCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + this.parameterToPair("forwardToReplicas", forwardToReplicas) + ); + } + final String[] localVarAccepts = { "application/json" }; final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -273,7 +288,7 @@ public okhttp3.Call deleteIndexCall( String[] localVarAuthNames = new String[] { "apiKey", "appId" }; return this.buildCall( localVarPath, - "DELETE", + "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, @@ -286,26 +301,33 @@ public okhttp3.Call deleteIndexCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteIndexValidateBeforeCall( + private okhttp3.Call clearAllSynonymsValidateBeforeCall( String indexName, + Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { throw new ApiException( - "Missing the required parameter 'indexName' when calling deleteIndex(Async)" + "Missing the required parameter 'indexName' when calling clearAllSynonyms(Async)" ); } - okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); + okhttp3.Call localVarCall = clearAllSynonymsCall( + indexName, + forwardToReplicas, + _callback + ); return localVarCall; } /** - * Delete index. Delete an existing index. + * Clear all synonyms. Remove all synonyms from an index. * * @param indexName The index in which to perform the request. (required) - * @return DeleteIndexResponse + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return ClearAllSynonymsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -318,18 +340,24 @@ private okhttp3.Call deleteIndexValidateBeforeCall( * 404 Index not found. - * */ - public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { - ApiResponse localVarResp = deleteIndexWithHttpInfo( - indexName + public ClearAllSynonymsResponse clearAllSynonyms( + String indexName, + Boolean forwardToReplicas + ) throws ApiException { + ApiResponse localVarResp = clearAllSynonymsWithHttpInfo( + indexName, + forwardToReplicas ); return localVarResp.getData(); } /** - * Delete index. Delete an existing index. + * Clear all synonyms. Remove all synonyms from an index. * * @param indexName The index in which to perform the request. (required) - * @return ApiResponse<DeleteIndexResponse> + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return ApiResponse<ClearAllSynonymsResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -342,18 +370,26 @@ public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { * 404 Index not found. - * */ - public ApiResponse deleteIndexWithHttpInfo( - String indexName + public ApiResponse clearAllSynonymsWithHttpInfo( + String indexName, + Boolean forwardToReplicas ) throws ApiException { - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = clearAllSynonymsValidateBeforeCall( + indexName, + forwardToReplicas, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); return this.execute(localVarCall, localVarReturnType); } /** - * Delete index. (asynchronously) Delete an existing index. + * Clear all synonyms. (asynchronously) Remove all synonyms from an index. * * @param indexName The index in which to perform the request. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -367,21 +403,24 @@ public ApiResponse deleteIndexWithHttpInfo( * 404 Index not found. - * */ - public okhttp3.Call deleteIndexAsync( + public okhttp3.Call clearAllSynonymsAsync( String indexName, - final ApiCallback _callback + Boolean forwardToReplicas, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = deleteIndexValidateBeforeCall( + okhttp3.Call localVarCall = clearAllSynonymsValidateBeforeCall( indexName, + forwardToReplicas, _callback ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {} + .getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for getSettings + * Build call for deleteIndex * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress @@ -397,7 +436,7 @@ public okhttp3.Call deleteIndexAsync( * 404 Index not found. - * */ - public okhttp3.Call getSettingsCall( + public okhttp3.Call deleteIndexCall( String indexName, final ApiCallback _callback ) throws ApiException { @@ -405,7 +444,7 @@ public okhttp3.Call getSettingsCall( // create path and map variables String localVarPath = - "/1/indexes/{indexName}/settings".replaceAll( + "/1/indexes/{indexName}".replaceAll( "\\{" + "indexName" + "\\}", this.escapeString(indexName.toString()) ); @@ -431,7 +470,7 @@ public okhttp3.Call getSettingsCall( String[] localVarAuthNames = new String[] { "apiKey", "appId" }; return this.buildCall( localVarPath, - "GET", + "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, @@ -444,26 +483,26 @@ public okhttp3.Call getSettingsCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingsValidateBeforeCall( + private okhttp3.Call deleteIndexValidateBeforeCall( String indexName, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { throw new ApiException( - "Missing the required parameter 'indexName' when calling getSettings(Async)" + "Missing the required parameter 'indexName' when calling deleteIndex(Async)" ); } - okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); + okhttp3.Call localVarCall = deleteIndexCall(indexName, _callback); return localVarCall; } /** - * Retrieve settings of a given indexName. + * Delete index. Delete an existing index. * * @param indexName The index in which to perform the request. (required) - * @return IndexSettings + * @return DeleteIndexResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -476,18 +515,18 @@ private okhttp3.Call getSettingsValidateBeforeCall( * 404 Index not found. - * */ - public IndexSettings getSettings(String indexName) throws ApiException { - ApiResponse localVarResp = getSettingsWithHttpInfo( + public DeleteIndexResponse deleteIndex(String indexName) throws ApiException { + ApiResponse localVarResp = deleteIndexWithHttpInfo( indexName ); return localVarResp.getData(); } /** - * Retrieve settings of a given indexName. + * Delete index. Delete an existing index. * * @param indexName The index in which to perform the request. (required) - * @return ApiResponse<IndexSettings> + * @return ApiResponse<DeleteIndexResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -500,15 +539,16 @@ public IndexSettings getSettings(String indexName) throws ApiException { * 404 Index not found. - * */ - public ApiResponse getSettingsWithHttpInfo(String indexName) - throws ApiException { - okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse deleteIndexWithHttpInfo( + String indexName + ) throws ApiException { + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); return this.execute(localVarCall, localVarReturnType); } /** - * (asynchronously) Retrieve settings of a given indexName. + * Delete index. (asynchronously) Delete an existing index. * * @param indexName The index in which to perform the request. (required) * @param _callback The callback to be executed when the API call finishes @@ -524,25 +564,26 @@ public ApiResponse getSettingsWithHttpInfo(String indexName) * 404 Index not found. - * */ - public okhttp3.Call getSettingsAsync( + public okhttp3.Call deleteIndexAsync( String indexName, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = getSettingsValidateBeforeCall( + okhttp3.Call localVarCall = deleteIndexValidateBeforeCall( indexName, _callback ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for listIndices + * Build call for deleteSynonym * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -556,14 +597,24 @@ public okhttp3.Call getSettingsAsync( * 404 Index not found. - * */ - public okhttp3.Call listIndicesCall( - Integer page, + public okhttp3.Call deleteSynonymCall( + String indexName, + String objectID, + Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { Object localVarPostBody = null; // create path and map variables - String localVarPath = "/1/indexes"; + String localVarPath = + "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ) + .replaceAll( + "\\{" + "objectID" + "\\}", + this.escapeString(objectID.toString()) + ); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -571,8 +622,10 @@ public okhttp3.Call listIndicesCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (page != null) { - localVarQueryParams.addAll(this.parameterToPair("Page", page)); + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + this.parameterToPair("forwardToReplicas", forwardToReplicas) + ); } final String[] localVarAccepts = { "application/json" }; @@ -590,7 +643,7 @@ public okhttp3.Call listIndicesCall( String[] localVarAuthNames = new String[] { "apiKey", "appId" }; return this.buildCall( localVarPath, - "GET", + "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, @@ -603,21 +656,43 @@ public okhttp3.Call listIndicesCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call listIndicesValidateBeforeCall( - Integer page, + private okhttp3.Call deleteSynonymValidateBeforeCall( + String indexName, + String objectID, + Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = listIndicesCall(page, _callback); + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling deleteSynonym(Async)" + ); + } + + // verify the required parameter 'objectID' is set + if (objectID == null) { + throw new ApiException( + "Missing the required parameter 'objectID' when calling deleteSynonym(Async)" + ); + } + + okhttp3.Call localVarCall = deleteSynonymCall( + indexName, + objectID, + forwardToReplicas, + _callback + ); return localVarCall; } /** - * List existing indexes. List existing indexes from an application. + * Delete synonym. Delete a single synonyms set, identified by the given objectID. * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @return ListIndicesResponse + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return DeleteSynonymResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -630,20 +705,27 @@ private okhttp3.Call listIndicesValidateBeforeCall( * 404 Index not found. - * */ - public ListIndicesResponse listIndices(Integer page) throws ApiException { - ApiResponse localVarResp = listIndicesWithHttpInfo( - page + public DeleteSynonymResponse deleteSynonym( + String indexName, + String objectID, + Boolean forwardToReplicas + ) throws ApiException { + ApiResponse localVarResp = deleteSynonymWithHttpInfo( + indexName, + objectID, + forwardToReplicas ); return localVarResp.getData(); } /** - * List existing indexes. List existing indexes from an application. + * Delete synonym. Delete a single synonyms set, identified by the given objectID. * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @return ApiResponse<ListIndicesResponse> + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return ApiResponse<DeleteSynonymResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -656,19 +738,30 @@ public ListIndicesResponse listIndices(Integer page) throws ApiException { * 404 Index not found. - * */ - public ApiResponse listIndicesWithHttpInfo(Integer page) - throws ApiException { - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse deleteSynonymWithHttpInfo( + String indexName, + String objectID, + Boolean forwardToReplicas + ) throws ApiException { + okhttp3.Call localVarCall = deleteSynonymValidateBeforeCall( + indexName, + objectID, + forwardToReplicas, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); return this.execute(localVarCall, localVarReturnType); } /** - * List existing indexes. (asynchronously) List existing indexes from an application. + * Delete synonym. (asynchronously) Delete a single synonyms set, identified by the given + * objectID. * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -682,20 +775,28 @@ public ApiResponse listIndicesWithHttpInfo(Integer page) * 404 Index not found. - * */ - public okhttp3.Call listIndicesAsync( - Integer page, - final ApiCallback _callback + public okhttp3.Call deleteSynonymAsync( + String indexName, + String objectID, + Boolean forwardToReplicas, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = deleteSynonymValidateBeforeCall( + indexName, + objectID, + forwardToReplicas, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for multipleQueries + * Build call for getSettings * - * @param multipleQueriesObject (required) + * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -709,14 +810,18 @@ public okhttp3.Call listIndicesAsync( * 404 Index not found. - * */ - public okhttp3.Call multipleQueriesCall( - MultipleQueriesObject multipleQueriesObject, + public okhttp3.Call getSettingsCall( + String indexName, final ApiCallback _callback ) throws ApiException { - Object localVarPostBody = multipleQueriesObject; + Object localVarPostBody = null; // create path and map variables - String localVarPath = "/1/indexes/*/queries"; + String localVarPath = + "/1/indexes/{indexName}/settings".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -730,7 +835,8 @@ public okhttp3.Call multipleQueriesCall( localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { "application/json" }; + final String[] localVarContentTypes = {}; + final String localVarContentType = this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); @@ -738,7 +844,7 @@ public okhttp3.Call multipleQueriesCall( String[] localVarAuthNames = new String[] { "apiKey", "appId" }; return this.buildCall( localVarPath, - "POST", + "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, @@ -751,30 +857,26 @@ public okhttp3.Call multipleQueriesCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call multipleQueriesValidateBeforeCall( - MultipleQueriesObject multipleQueriesObject, + private okhttp3.Call getSettingsValidateBeforeCall( + String indexName, final ApiCallback _callback ) throws ApiException { - // verify the required parameter 'multipleQueriesObject' is set - if (multipleQueriesObject == null) { + // verify the required parameter 'indexName' is set + if (indexName == null) { throw new ApiException( - "Missing the required parameter 'multipleQueriesObject' when calling" + - " multipleQueries(Async)" + "Missing the required parameter 'indexName' when calling getSettings(Async)" ); } - okhttp3.Call localVarCall = multipleQueriesCall( - multipleQueriesObject, - _callback - ); + okhttp3.Call localVarCall = getSettingsCall(indexName, _callback); return localVarCall; } /** - * Get search results for the given requests. + * Retrieve settings of a given indexName. * - * @param multipleQueriesObject (required) - * @return MultipleQueriesResponse + * @param indexName The index in which to perform the request. (required) + * @return IndexSettings * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -787,20 +889,1108 @@ private okhttp3.Call multipleQueriesValidateBeforeCall( * 404 Index not found. - * */ - public MultipleQueriesResponse multipleQueries( - MultipleQueriesObject multipleQueriesObject + public IndexSettings getSettings(String indexName) throws ApiException { + ApiResponse localVarResp = getSettingsWithHttpInfo( + indexName + ); + return localVarResp.getData(); + } + + /** + * Retrieve settings of a given indexName. + * + * @param indexName The index in which to perform the request. (required) + * @return ApiResponse<IndexSettings> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse getSettingsWithHttpInfo(String indexName) + throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(indexName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Retrieve settings of a given indexName. + * + * @param indexName The index in which to perform the request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSettingsAsync( + String indexName, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall( + indexName, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSynonym + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSynonymCall( + String indexName, + String objectID, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ) + .replaceAll( + "\\{" + "objectID" + "\\}", + this.escapeString(objectID.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSynonymValidateBeforeCall( + String indexName, + String objectID, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling getSynonym(Async)" + ); + } + + // verify the required parameter 'objectID' is set + if (objectID == null) { + throw new ApiException( + "Missing the required parameter 'objectID' when calling getSynonym(Async)" + ); + } + + okhttp3.Call localVarCall = getSynonymCall(indexName, objectID, _callback); + return localVarCall; + } + + /** + * Get synonym. Fetch a synonym object identified by its objectID. + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @return SynonymHit + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SynonymHit getSynonym(String indexName, String objectID) + throws ApiException { + ApiResponse localVarResp = getSynonymWithHttpInfo( + indexName, + objectID + ); + return localVarResp.getData(); + } + + /** + * Get synonym. Fetch a synonym object identified by its objectID. + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @return ApiResponse<SynonymHit> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse getSynonymWithHttpInfo( + String indexName, + String objectID + ) throws ApiException { + okhttp3.Call localVarCall = getSynonymValidateBeforeCall( + indexName, + objectID, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * Get synonym. (asynchronously) Fetch a synonym object identified by its objectID. + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call getSynonymAsync( + String indexName, + String objectID, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = getSynonymValidateBeforeCall( + indexName, + objectID, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listIndices + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call listIndicesCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/1/indexes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (page != null) { + localVarQueryParams.addAll(this.parameterToPair("Page", page)); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listIndicesValidateBeforeCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesCall(page, _callback); + return localVarCall; + } + + /** + * List existing indexes. List existing indexes from an application. + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @return ListIndicesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ListIndicesResponse listIndices(Integer page) throws ApiException { + ApiResponse localVarResp = listIndicesWithHttpInfo( + page + ); + return localVarResp.getData(); + } + + /** + * List existing indexes. List existing indexes from an application. + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @return ApiResponse<ListIndicesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse listIndicesWithHttpInfo(Integer page) + throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * List existing indexes. (asynchronously) List existing indexes from an application. + * + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call listIndicesAsync( + Integer page, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = listIndicesValidateBeforeCall(page, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for multipleQueries + * + * @param multipleQueriesObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call multipleQueriesCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = multipleQueriesObject; + + // create path and map variables + String localVarPath = "/1/indexes/*/queries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call multipleQueriesValidateBeforeCall( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'multipleQueriesObject' is set + if (multipleQueriesObject == null) { + throw new ApiException( + "Missing the required parameter 'multipleQueriesObject' when calling" + + " multipleQueries(Async)" + ); + } + + okhttp3.Call localVarCall = multipleQueriesCall( + multipleQueriesObject, + _callback + ); + return localVarCall; + } + + /** + * Get search results for the given requests. + * + * @param multipleQueriesObject (required) + * @return MultipleQueriesResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public MultipleQueriesResponse multipleQueries( + MultipleQueriesObject multipleQueriesObject + ) throws ApiException { + ApiResponse localVarResp = multipleQueriesWithHttpInfo( + multipleQueriesObject + ); + return localVarResp.getData(); + } + + /** + * Get search results for the given requests. + * + * @param multipleQueriesObject (required) + * @return ApiResponse<MultipleQueriesResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse multipleQueriesWithHttpInfo( + MultipleQueriesObject multipleQueriesObject + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Get search results for the given requests. + * + * @param multipleQueriesObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call multipleQueriesAsync( + MultipleQueriesObject multipleQueriesObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( + multipleQueriesObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for operationIndex + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = operationIndexObject; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/operation".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call operationIndexValidateBeforeCall( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling operationIndex(Async)" + ); + } + + // verify the required parameter 'operationIndexObject' is set + if (operationIndexObject == null) { + throw new ApiException( + "Missing the required parameter 'operationIndexObject' when calling" + + " operationIndex(Async)" + ); + } + + okhttp3.Call localVarCall = operationIndexCall( + indexName, + operationIndexObject, + _callback + ); + return localVarCall; + } + + /** + * Copy/move index. Peforms a copy or a move operation on a index. + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return OperationIndexResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public OperationIndexResponse operationIndex( + String indexName, + OperationIndexObject operationIndexObject + ) throws ApiException { + ApiResponse localVarResp = operationIndexWithHttpInfo( + indexName, + operationIndexObject + ); + return localVarResp.getData(); + } + + /** + * Copy/move index. Peforms a copy or a move operation on a index. + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @return ApiResponse<OperationIndexResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse operationIndexWithHttpInfo( + String indexName, + OperationIndexObject operationIndexObject + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + null + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * Copy/move index. (asynchronously) Peforms a copy or a move operation on a index. + * + * @param indexName The index in which to perform the request. (required) + * @param operationIndexObject (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call operationIndexAsync( + String indexName, + OperationIndexObject operationIndexObject, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + indexName, + operationIndexObject, + _callback + ); + Type localVarReturnType = new TypeToken() {} + .getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for saveObject + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = requestBody; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call saveObjectValidateBeforeCall( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling saveObject(Async)" + ); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException( + "Missing the required parameter 'requestBody' when calling saveObject(Async)" + ); + } + + okhttp3.Call localVarCall = saveObjectCall( + indexName, + requestBody, + _callback + ); + return localVarCall; + } + + /** + * Add an object to the index, automatically assigning it an object ID. + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return SaveObjectResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SaveObjectResponse saveObject( + String indexName, + Map requestBody + ) throws ApiException { + ApiResponse localVarResp = saveObjectWithHttpInfo( + indexName, + requestBody + ); + return localVarResp.getData(); + } + + /** + * Add an object to the index, automatically assigning it an object ID. + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @return ApiResponse<SaveObjectResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public ApiResponse saveObjectWithHttpInfo( + String indexName, + Map requestBody + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + null + ); + Type localVarReturnType = new TypeToken() {}.getType(); + return this.execute(localVarCall, localVarReturnType); + } + + /** + * (asynchronously) Add an object to the index, automatically assigning it an object ID. + * + * @param indexName The index in which to perform the request. (required) + * @param requestBody The Algolia object. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveObjectAsync( + String indexName, + Map requestBody, + final ApiCallback _callback + ) throws ApiException { + okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + indexName, + requestBody, + _callback + ); + Type localVarReturnType = new TypeToken() {}.getType(); + this.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for saveSynonym + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public okhttp3.Call saveSynonymCall( + String indexName, + String objectID, + SynonymHit synonymHit, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + Object localVarPostBody = synonymHit; + + // create path and map variables + String localVarPath = + "/1/indexes/{indexName}/synonyms/{objectID}".replaceAll( + "\\{" + "indexName" + "\\}", + this.escapeString(indexName.toString()) + ) + .replaceAll( + "\\{" + "objectID" + "\\}", + this.escapeString(objectID.toString()) + ); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + this.parameterToPair("forwardToReplicas", forwardToReplicas) + ); + } + + final String[] localVarAccepts = { "application/json" }; + final String localVarAccept = this.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { "application/json" }; + final String localVarContentType = + this.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + String[] localVarAuthNames = new String[] { "apiKey", "appId" }; + return this.buildCall( + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback + ); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call saveSynonymValidateBeforeCall( + String indexName, + String objectID, + SynonymHit synonymHit, + Boolean forwardToReplicas, + final ApiCallback _callback + ) throws ApiException { + // verify the required parameter 'indexName' is set + if (indexName == null) { + throw new ApiException( + "Missing the required parameter 'indexName' when calling saveSynonym(Async)" + ); + } + + // verify the required parameter 'objectID' is set + if (objectID == null) { + throw new ApiException( + "Missing the required parameter 'objectID' when calling saveSynonym(Async)" + ); + } + + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) { + throw new ApiException( + "Missing the required parameter 'synonymHit' when calling saveSynonym(Async)" + ); + } + + okhttp3.Call localVarCall = saveSynonymCall( + indexName, + objectID, + synonymHit, + forwardToReplicas, + _callback + ); + return localVarCall; + } + + /** + * Save synonym. Create a new synonym object or update the existing synonym object with the given + * object ID. + * + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return SaveSynonymResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
400 Bad request or request arguments. -
402 This feature is not enabled on your Algolia account. -
403 Method not allowed with this API key. -
404 Index not found. -
+ */ + public SaveSynonymResponse saveSynonym( + String indexName, + String objectID, + SynonymHit synonymHit, + Boolean forwardToReplicas ) throws ApiException { - ApiResponse localVarResp = multipleQueriesWithHttpInfo( - multipleQueriesObject + ApiResponse localVarResp = saveSynonymWithHttpInfo( + indexName, + objectID, + synonymHit, + forwardToReplicas ); return localVarResp.getData(); } /** - * Get search results for the given requests. + * Save synonym. Create a new synonym object or update the existing synonym object with the given + * object ID. * - * @param multipleQueriesObject (required) - * @return ApiResponse<MultipleQueriesResponse> + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @return ApiResponse<SaveSynonymResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -813,22 +2003,32 @@ public MultipleQueriesResponse multipleQueries( * 404 Index not found. - * */ - public ApiResponse multipleQueriesWithHttpInfo( - MultipleQueriesObject multipleQueriesObject + public ApiResponse saveSynonymWithHttpInfo( + String indexName, + String objectID, + SynonymHit synonymHit, + Boolean forwardToReplicas ) throws ApiException { - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( - multipleQueriesObject, + okhttp3.Call localVarCall = saveSynonymValidateBeforeCall( + indexName, + objectID, + synonymHit, + forwardToReplicas, null ); - Type localVarReturnType = new TypeToken() {} - .getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return this.execute(localVarCall, localVarReturnType); } /** - * (asynchronously) Get search results for the given requests. + * Save synonym. (asynchronously) Create a new synonym object or update the existing synonym + * object with the given object ID. * - * @param multipleQueriesObject (required) + * @param indexName The index in which to perform the request. (required) + * @param objectID Unique identifier of an object. (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -842,25 +2042,34 @@ public ApiResponse multipleQueriesWithHttpInfo( * 404 Index not found. - * */ - public okhttp3.Call multipleQueriesAsync( - MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback + public okhttp3.Call saveSynonymAsync( + String indexName, + String objectID, + SynonymHit synonymHit, + Boolean forwardToReplicas, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = multipleQueriesValidateBeforeCall( - multipleQueriesObject, + okhttp3.Call localVarCall = saveSynonymValidateBeforeCall( + indexName, + objectID, + synonymHit, + forwardToReplicas, _callback ); - Type localVarReturnType = new TypeToken() {} - .getType(); + Type localVarReturnType = new TypeToken() {}.getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for operationIndex + * Build call for saveSynonyms * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this + * request. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -874,16 +2083,18 @@ public okhttp3.Call multipleQueriesAsync( * 404 Index not found. - * */ - public okhttp3.Call operationIndexCall( + public okhttp3.Call saveSynonymsCall( String indexName, - OperationIndexObject operationIndexObject, + List synonymHit, + Boolean forwardToReplicas, + Boolean replaceExistingSynonyms, final ApiCallback _callback ) throws ApiException { - Object localVarPostBody = operationIndexObject; + Object localVarPostBody = synonymHit; // create path and map variables String localVarPath = - "/1/indexes/{indexName}/operation".replaceAll( + "/1/indexes/{indexName}/synonyms/batch".replaceAll( "\\{" + "indexName" + "\\}", this.escapeString(indexName.toString()) ); @@ -894,6 +2105,18 @@ public okhttp3.Call operationIndexCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (forwardToReplicas != null) { + localVarQueryParams.addAll( + this.parameterToPair("forwardToReplicas", forwardToReplicas) + ); + } + + if (replaceExistingSynonyms != null) { + localVarQueryParams.addAll( + this.parameterToPair("replaceExistingSynonyms", replaceExistingSynonyms) + ); + } + final String[] localVarAccepts = { "application/json" }; final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -921,40 +2144,48 @@ public okhttp3.Call operationIndexCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call operationIndexValidateBeforeCall( + private okhttp3.Call saveSynonymsValidateBeforeCall( String indexName, - OperationIndexObject operationIndexObject, + List synonymHit, + Boolean forwardToReplicas, + Boolean replaceExistingSynonyms, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { throw new ApiException( - "Missing the required parameter 'indexName' when calling operationIndex(Async)" + "Missing the required parameter 'indexName' when calling saveSynonyms(Async)" ); } - // verify the required parameter 'operationIndexObject' is set - if (operationIndexObject == null) { + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) { throw new ApiException( - "Missing the required parameter 'operationIndexObject' when calling" + - " operationIndex(Async)" + "Missing the required parameter 'synonymHit' when calling saveSynonyms(Async)" ); } - okhttp3.Call localVarCall = operationIndexCall( + okhttp3.Call localVarCall = saveSynonymsCall( indexName, - operationIndexObject, + synonymHit, + forwardToReplicas, + replaceExistingSynonyms, _callback ); return localVarCall; } /** - * Copy/move index. Peforms a copy or a move operation on a index. + * Save a batch of synonyms. Create/update multiple synonym objects at once, potentially replacing + * the entire list of synonyms if replaceExistingSynonyms is true. * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @return OperationIndexResponse + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this + * request. (optional) + * @return SaveSynonymsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -967,23 +2198,32 @@ private okhttp3.Call operationIndexValidateBeforeCall( * 404 Index not found. - * */ - public OperationIndexResponse operationIndex( + public SaveSynonymsResponse saveSynonyms( String indexName, - OperationIndexObject operationIndexObject + List synonymHit, + Boolean forwardToReplicas, + Boolean replaceExistingSynonyms ) throws ApiException { - ApiResponse localVarResp = operationIndexWithHttpInfo( + ApiResponse localVarResp = saveSynonymsWithHttpInfo( indexName, - operationIndexObject + synonymHit, + forwardToReplicas, + replaceExistingSynonyms ); return localVarResp.getData(); } /** - * Copy/move index. Peforms a copy or a move operation on a index. + * Save a batch of synonyms. Create/update multiple synonym objects at once, potentially replacing + * the entire list of synonyms if replaceExistingSynonyms is true. * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) - * @return ApiResponse<OperationIndexResponse> + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this + * request. (optional) + * @return ApiResponse<SaveSynonymsResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -996,25 +2236,34 @@ public OperationIndexResponse operationIndex( * 404 Index not found. - * */ - public ApiResponse operationIndexWithHttpInfo( + public ApiResponse saveSynonymsWithHttpInfo( String indexName, - OperationIndexObject operationIndexObject + List synonymHit, + Boolean forwardToReplicas, + Boolean replaceExistingSynonyms ) throws ApiException { - okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + okhttp3.Call localVarCall = saveSynonymsValidateBeforeCall( indexName, - operationIndexObject, + synonymHit, + forwardToReplicas, + replaceExistingSynonyms, null ); - Type localVarReturnType = new TypeToken() {} + Type localVarReturnType = new TypeToken() {} .getType(); return this.execute(localVarCall, localVarReturnType); } /** - * Copy/move index. (asynchronously) Peforms a copy or a move operation on a index. + * Save a batch of synonyms. (asynchronously) Create/update multiple synonym objects at once, + * potentially replacing the entire list of synonyms if replaceExistingSynonyms is true. * * @param indexName The index in which to perform the request. (required) - * @param operationIndexObject (required) + * @param synonymHit (required) + * @param forwardToReplicas When true, changes are also propagated to replicas of the given + * indexName. (optional) + * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this + * request. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1028,27 +2277,31 @@ public ApiResponse operationIndexWithHttpInfo( * 404 Index not found. - * */ - public okhttp3.Call operationIndexAsync( + public okhttp3.Call saveSynonymsAsync( String indexName, - OperationIndexObject operationIndexObject, - final ApiCallback _callback + List synonymHit, + Boolean forwardToReplicas, + Boolean replaceExistingSynonyms, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = operationIndexValidateBeforeCall( + okhttp3.Call localVarCall = saveSynonymsValidateBeforeCall( indexName, - operationIndexObject, + synonymHit, + forwardToReplicas, + replaceExistingSynonyms, _callback ); - Type localVarReturnType = new TypeToken() {} + Type localVarReturnType = new TypeToken() {} .getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for saveObject + * Build call for search * * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) + * @param searchParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1062,16 +2315,16 @@ public okhttp3.Call operationIndexAsync( * 404 Index not found. - * */ - public okhttp3.Call saveObjectCall( + public okhttp3.Call searchCall( String indexName, - Map requestBody, + SearchParams searchParams, final ApiCallback _callback ) throws ApiException { - Object localVarPostBody = requestBody; + Object localVarPostBody = searchParams; // create path and map variables String localVarPath = - "/1/indexes/{indexName}".replaceAll( + "/1/indexes/{indexName}/query".replaceAll( "\\{" + "indexName" + "\\}", this.escapeString(indexName.toString()) ); @@ -1109,39 +2362,35 @@ public okhttp3.Call saveObjectCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call saveObjectValidateBeforeCall( + private okhttp3.Call searchValidateBeforeCall( String indexName, - Map requestBody, + SearchParams searchParams, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { throw new ApiException( - "Missing the required parameter 'indexName' when calling saveObject(Async)" + "Missing the required parameter 'indexName' when calling search(Async)" ); } - // verify the required parameter 'requestBody' is set - if (requestBody == null) { + // verify the required parameter 'searchParams' is set + if (searchParams == null) { throw new ApiException( - "Missing the required parameter 'requestBody' when calling saveObject(Async)" + "Missing the required parameter 'searchParams' when calling search(Async)" ); } - okhttp3.Call localVarCall = saveObjectCall( - indexName, - requestBody, - _callback - ); + okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); return localVarCall; } /** - * Add an object to the index, automatically assigning it an object ID. + * Get search results. * * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @return SaveObjectResponse + * @param searchParams (required) + * @return SearchResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -1154,23 +2403,21 @@ private okhttp3.Call saveObjectValidateBeforeCall( * 404 Index not found. - * */ - public SaveObjectResponse saveObject( - String indexName, - Map requestBody - ) throws ApiException { - ApiResponse localVarResp = saveObjectWithHttpInfo( + public SearchResponse search(String indexName, SearchParams searchParams) + throws ApiException { + ApiResponse localVarResp = searchWithHttpInfo( indexName, - requestBody + searchParams ); return localVarResp.getData(); } /** - * Add an object to the index, automatically assigning it an object ID. + * Get search results. * * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) - * @return ApiResponse<SaveObjectResponse> + * @param searchParams (required) + * @return ApiResponse<SearchResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -1183,24 +2430,24 @@ public SaveObjectResponse saveObject( * 404 Index not found. - * */ - public ApiResponse saveObjectWithHttpInfo( + public ApiResponse searchWithHttpInfo( String indexName, - Map requestBody + SearchParams searchParams ) throws ApiException { - okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + okhttp3.Call localVarCall = searchValidateBeforeCall( indexName, - requestBody, + searchParams, null ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); return this.execute(localVarCall, localVarReturnType); } /** - * (asynchronously) Add an object to the index, automatically assigning it an object ID. + * (asynchronously) Get search results. * * @param indexName The index in which to perform the request. (required) - * @param requestBody The Algolia object. (required) + * @param searchParams (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1214,26 +2461,31 @@ public ApiResponse saveObjectWithHttpInfo( * 404 Index not found. - * */ - public okhttp3.Call saveObjectAsync( + public okhttp3.Call searchAsync( String indexName, - Map requestBody, - final ApiCallback _callback + SearchParams searchParams, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = saveObjectValidateBeforeCall( + okhttp3.Call localVarCall = searchValidateBeforeCall( indexName, - requestBody, + searchParams, _callback ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {}.getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for search + * Build call for searchSynonyms * * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param query Search for specific synonyms matching this string. (optional, default to ) + * @param type Only search for specific types of synonyms. (optional) + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional, default to 0) + * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1247,16 +2499,19 @@ public okhttp3.Call saveObjectAsync( * 404 Index not found. - * */ - public okhttp3.Call searchCall( + public okhttp3.Call searchSynonymsCall( String indexName, - SearchParams searchParams, + String query, + String type, + Integer page, + Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { - Object localVarPostBody = searchParams; + Object localVarPostBody = null; // create path and map variables String localVarPath = - "/1/indexes/{indexName}/query".replaceAll( + "/1/indexes/{indexName}/synonyms/search".replaceAll( "\\{" + "indexName" + "\\}", this.escapeString(indexName.toString()) ); @@ -1267,13 +2522,32 @@ public okhttp3.Call searchCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + if (query != null) { + localVarQueryParams.addAll(this.parameterToPair("query", query)); + } + + if (type != null) { + localVarQueryParams.addAll(this.parameterToPair("type", type)); + } + + if (page != null) { + localVarQueryParams.addAll(this.parameterToPair("Page", page)); + } + + if (hitsPerPage != null) { + localVarQueryParams.addAll( + this.parameterToPair("hitsPerPage", hitsPerPage) + ); + } + final String[] localVarAccepts = { "application/json" }; final String localVarAccept = this.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = { "application/json" }; + final String[] localVarContentTypes = {}; + final String localVarContentType = this.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); @@ -1294,35 +2568,44 @@ public okhttp3.Call searchCall( } @SuppressWarnings("rawtypes") - private okhttp3.Call searchValidateBeforeCall( + private okhttp3.Call searchSynonymsValidateBeforeCall( String indexName, - SearchParams searchParams, + String query, + String type, + Integer page, + Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { throw new ApiException( - "Missing the required parameter 'indexName' when calling search(Async)" - ); - } - - // verify the required parameter 'searchParams' is set - if (searchParams == null) { - throw new ApiException( - "Missing the required parameter 'searchParams' when calling search(Async)" + "Missing the required parameter 'indexName' when calling searchSynonyms(Async)" ); } - okhttp3.Call localVarCall = searchCall(indexName, searchParams, _callback); + okhttp3.Call localVarCall = searchSynonymsCall( + indexName, + query, + type, + page, + hitsPerPage, + _callback + ); return localVarCall; } /** - * Get search results. + * Get all synonyms that match a query. Search or browse all synonyms, optionally filtering them + * by type. * * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @return SearchResponse + * @param query Search for specific synonyms matching this string. (optional, default to ) + * @param type Only search for specific types of synonyms. (optional) + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional, default to 0) + * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) + * @return SearchSynonymsResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -1335,21 +2618,35 @@ private okhttp3.Call searchValidateBeforeCall( * 404 Index not found. - * */ - public SearchResponse search(String indexName, SearchParams searchParams) - throws ApiException { - ApiResponse localVarResp = searchWithHttpInfo( + public SearchSynonymsResponse searchSynonyms( + String indexName, + String query, + String type, + Integer page, + Integer hitsPerPage + ) throws ApiException { + ApiResponse localVarResp = searchSynonymsWithHttpInfo( indexName, - searchParams + query, + type, + page, + hitsPerPage ); return localVarResp.getData(); } /** - * Get search results. + * Get all synonyms that match a query. Search or browse all synonyms, optionally filtering them + * by type. * * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) - * @return ApiResponse<SearchResponse> + * @param query Search for specific synonyms matching this string. (optional, default to ) + * @param type Only search for specific types of synonyms. (optional) + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional, default to 0) + * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) + * @return ApiResponse<SearchSynonymsResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body * @http.response.details @@ -1362,24 +2659,37 @@ public SearchResponse search(String indexName, SearchParams searchParams) * 404 Index not found. - * */ - public ApiResponse searchWithHttpInfo( + public ApiResponse searchSynonymsWithHttpInfo( String indexName, - SearchParams searchParams + String query, + String type, + Integer page, + Integer hitsPerPage ) throws ApiException { - okhttp3.Call localVarCall = searchValidateBeforeCall( + okhttp3.Call localVarCall = searchSynonymsValidateBeforeCall( indexName, - searchParams, + query, + type, + page, + hitsPerPage, null ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {} + .getType(); return this.execute(localVarCall, localVarReturnType); } /** - * (asynchronously) Get search results. + * Get all synonyms that match a query. (asynchronously) Search or browse all synonyms, optionally + * filtering them by type. * * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) + * @param query Search for specific synonyms matching this string. (optional, default to ) + * @param type Only search for specific types of synonyms. (optional) + * @param page Requested page (zero-based). When specified, will retrieve a specific page; the + * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * (optional, default to 0) + * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1393,17 +2703,24 @@ public ApiResponse searchWithHttpInfo( * 404 Index not found. - * */ - public okhttp3.Call searchAsync( + public okhttp3.Call searchSynonymsAsync( String indexName, - SearchParams searchParams, - final ApiCallback _callback + String query, + String type, + Integer page, + Integer hitsPerPage, + final ApiCallback _callback ) throws ApiException { - okhttp3.Call localVarCall = searchValidateBeforeCall( + okhttp3.Call localVarCall = searchSynonymsValidateBeforeCall( indexName, - searchParams, + query, + type, + page, + hitsPerPage, _callback ); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken() {} + .getType(); this.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } From 03b2703da3acb6dbdfc083c790b07f4bc22238ba Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 14 Dec 2021 14:06:10 +0100 Subject: [PATCH 19/19] review --- clients/algoliasearch-client-java-2/README.md | 2 - .../com/algolia/ApiCallback.java | 12 ------ .../com/algolia/ApiClient.java | 12 ------ .../com/algolia/ApiException.java | 12 ------ .../com/algolia/ApiResponse.java | 12 ------ .../com/algolia/GzipRequestInterceptor.java | 12 ------ .../algoliasearch-core/com/algolia/JSON.java | 12 ------ .../algoliasearch-core/com/algolia/Pair.java | 12 ------ .../com/algolia/ProgressRequestBody.java | 12 ------ .../com/algolia/ProgressResponseBody.java | 12 ------ .../com/algolia/StringUtil.java | 12 ------ .../com/algolia/model/BaseIndexSettings.java | 12 ------ .../com/algolia/model/BaseSearchParams.java | 14 +------ .../com/algolia/model/BaseSearchResponse.java | 12 ------ .../model/BaseSearchResponseFacetsStats.java | 12 ------ .../com/algolia/model/BatchObject.java | 14 +------ .../com/algolia/model/BatchResponse.java | 12 ------ .../model/ClearAllSynonymsResponse.java | 12 ------ .../algolia/model/DeleteIndexResponse.java | 12 ------ .../algolia/model/DeleteSynonymResponse.java | 12 ------ .../com/algolia/model/ErrorBase.java | 12 ------ .../com/algolia/model/HighlightResult.java | 12 ------ .../com/algolia/model/Index.java | 12 ------ .../com/algolia/model/IndexSettings.java | 12 ------ .../model/IndexSettingsAsSearchParams.java | 12 ------ .../algolia/model/ListIndicesResponse.java | 12 ------ .../com/algolia/model/MultipleQueries.java | 22 ++-------- .../algolia/model/MultipleQueriesObject.java | 12 ------ .../model/MultipleQueriesResponse.java | 12 ------ .../com/algolia/model/Operation.java | 12 ------ .../algolia/model/OperationIndexObject.java | 12 ------ .../algolia/model/OperationIndexResponse.java | 12 ------ .../com/algolia/model/RankingInfo.java | 12 ------ .../model/RankingInfoMatchedGeoLocation.java | 12 ------ .../com/algolia/model/Record.java | 12 ------ .../com/algolia/model/SaveObjectResponse.java | 12 ------ .../algolia/model/SaveSynonymResponse.java | 12 ------ .../algolia/model/SaveSynonymsResponse.java | 12 ------ .../com/algolia/model/SearchHits.java | 12 ------ .../com/algolia/model/SearchParams.java | 14 +------ .../com/algolia/model/SearchResponse.java | 12 ------ .../algolia/model/SearchSynonymsResponse.java | 12 ------ .../algolia/model/SetSettingsResponse.java | 12 ------ .../com/algolia/model/SnippetResult.java | 12 ------ .../com/algolia/model/SynonymHit.java | 12 ------ .../model/SynonymHitHighlightResult.java | 12 ------ .../com/algolia/search/SearchApi.java | 12 ------ package.json | 1 - scripts/multiplexer.sh | 6 +-- scripts/post-gen/java.sh | 4 +- templates/java/JSON.mustache | 2 - templates/java/JavaTimeFormatter.mustache | 1 - templates/java/Pair.mustache | 2 - templates/java/StringUtil.mustache | 6 +-- .../additionalEnumTypeAnnotations.mustache | 2 +- .../additionalModelTypeAnnotations.mustache | 2 +- templates/java/jackson_annotations.mustache | 2 +- .../okhttp-gson/ApiCallback.mustache | 2 - .../libraries/okhttp-gson/ApiClient.mustache | 2 - .../okhttp-gson/ApiResponse.mustache | 2 - .../GzipRequestInterceptor.mustache | 2 - .../okhttp-gson/ProgressRequestBody.mustache | 2 - .../okhttp-gson/ProgressResponseBody.mustache | 2 - .../libraries/okhttp-gson/README.mustache | 3 +- .../java/libraries/okhttp-gson/api.mustache | 42 +++++++++---------- .../okhttp-gson/apiException.mustache | 2 - templates/java/licenseInfo.mustache | 11 ----- templates/java/model.mustache | 2 - templates/java/modelEnum.mustache | 4 +- templates/java/modelInnerEnum.mustache | 4 +- templates/java/pojo.mustache | 4 +- templates/java/xmlAnnotation.mustache | 2 +- templates/javascript/api-single.mustache | 2 +- templates/javascript/licenseInfo.mustache | 11 ----- 74 files changed, 45 insertions(+), 652 deletions(-) delete mode 100644 templates/java/licenseInfo.mustache delete mode 100644 templates/javascript/licenseInfo.mustache diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index 4a6d00c41e..d1fe04db28 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -5,10 +5,8 @@ Search API API powering the Search feature of Algolia. - *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - ## Requirements Building the API client library requires: diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java index 6e705f81e3..6b149c2b32 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiCallback.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.List; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index 6511c7dca7..6bca7ae6f2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.io.File; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java index 243e8c54e5..06c74f5cc5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.List; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java index 2e0cf698d2..3826fd0754 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.List; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java index adbaeed4d5..3a05424539 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.io.IOException; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java index fe28064063..fff9b8547c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import com.algolia.model.*; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java index 752fe67775..1e5bf539ea 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; public class Pair { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java index 1b84b55603..42c926955c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.io.IOException; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java index f85f459d87..d5f13aa6e5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.io.IOException; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java index 55d6187be4..af841ec05c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia; import java.util.Collection; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java index 9f94437545..5ac1b4dfa2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java index ad0204e342..504405ca14 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; @@ -230,7 +218,7 @@ public BaseSearchParams similarQuery(String similarQuery) { /** * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. + * \"similar\" results. * * @return similarQuery */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java index 62e9c43953..8a7d905271 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java index 4db1e7113e..390f261989 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java index 944de19b21..e3f053211a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; @@ -19,7 +7,7 @@ import java.util.List; import java.util.Objects; -/** The `batch` requests. */ +/** The `batch` requests. */ @ApiModel(description = "The `batch` requests.") public class BatchObject { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java index e159080b10..9d8a55c551 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java index 1cb2e4a53d..f3f206367c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java index 2ab2e00bfc..28c6eba125 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java index d5af89ab3c..f087b81734 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java index ff7cef593d..95ad612300 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java index d4b4717b0d..7bb3d2dbbe 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java index 8095d35453..9f28608505 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java index d5f69586d5..5b043ad11c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java index e816b78ae3..88e9177b84 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettingsAsSearchParams.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java index 5cd95e3d43..201e4d3634 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ListIndicesResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java index e68727912e..f7cd5d23f0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueries.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; @@ -34,10 +22,7 @@ public class MultipleQueries { @SerializedName(SERIALIZED_NAME_QUERY) private String query = ""; - /** - * Perform a search query with `default`, will search for facet values if - * `facet` is given. - */ + /** Perform a search query with `default`, will search for facet values if `facet` is given. */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DEFAULT("default"), @@ -151,8 +136,7 @@ public MultipleQueries type(TypeEnum type) { } /** - * Perform a search query with `default`, will search for facet values if - * `facet` is given. + * Perform a search query with `default`, will search for facet values if `facet` is given. * * @return type */ @@ -175,7 +159,7 @@ public MultipleQueries facet(String facet) { } /** - * The `facet` name. + * The `facet` name. * * @return facet */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java index 0de00f9c8a..f799ac1ac0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesObject.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java index 8f25a633d0..c9818f862b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleQueriesResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java index 6beec65203..269dc3d26d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java index 9cb2eec001..c7bc64aa54 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexObject.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java index 13eedb8195..0a4b6bb252 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OperationIndexResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java index 0aad4857c1..ca84786ff7 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfo.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java index e8e5abdc4d..9007f515dc 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/RankingInfoMatchedGeoLocation.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java index dd7e996fab..c077f4165f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Record.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java index de0ecdfe20..176038ae90 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveObjectResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java index 8e9ce72d70..47a5c4d96e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java index d868eadb51..f6b8e6da20 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SaveSynonymsResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java index 4465288b9b..0901da6c69 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchHits.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java index 306a90701c..81b9a491f5 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchParams.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; @@ -803,7 +791,7 @@ public SearchParams similarQuery(String similarQuery) { /** * Overrides the query parameter and performs a more generic search that can be used to find - * \"similar\" results. + * \"similar\" results. * * @return similarQuery */ diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java index 5f33adae73..2bb7c74206 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java index ba705b8de9..c4153d718d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SearchSynonymsResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java index 4564cffef4..bdb6ef85d2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SetSettingsResponse.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java index d8a19e3233..f117c58767 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SnippetResult.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java index 9aadae84ca..514cc6431b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHit.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.TypeAdapter; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java index 0988f468d8..ccc0e886e3 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/SynonymHitHighlightResult.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.model; import com.google.gson.annotations.SerializedName; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 896c991ff2..2b534b708d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -1,15 +1,3 @@ -/* - * Search API - * API powering the Search feature of Algolia. - * - * The version of the OpenAPI document: 0.1.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 com.algolia.search; import com.algolia.ApiCallback; diff --git a/package.json b/package.json index 1212dafd4b..4e5aa71614 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "cts:generate": "yarn workspace tests cts:generate", "cts:test": "yarn workspace tests test", "lint": "eslint --ext=ts .", - "format:specs": "yarn prettier --write specs", "post:generate": "./scripts/post-gen/global.sh", "generate": "./scripts/multiplexer.sh ./scripts/generate.sh ${0:-all} ${1:-all} && yarn post:generate", "playground:java": "mvn clean compile exec:java -f playground/java/pom.xml", diff --git a/scripts/multiplexer.sh b/scripts/multiplexer.sh index ecca5d8b7a..576f049e6c 100755 --- a/scripts/multiplexer.sh +++ b/scripts/multiplexer.sh @@ -21,14 +21,12 @@ GENERATORS=() find_clients_and_languages() { echo "> Searching for available languages and clients..." - local generators=( $(cat openapitools.json | jq '."generator-cli".generators' | jq -r 'keys[]') ) + GENERATORS=( $(cat openapitools.json | jq '."generator-cli".generators' | jq -r 'keys[]') ) - for generator in "${generators[@]}"; do + for generator in "${GENERATORS[@]}"; do local lang=${generator%-*} local client=${generator#*-} - GENERATORS+=($generator) - if [[ ! ${LANGUAGES[*]} =~ $lang ]]; then LANGUAGES+=($lang) fi diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh index 3b53aa7ccf..8b3bc1dbed 100755 --- a/scripts/post-gen/java.sh +++ b/scripts/post-gen/java.sh @@ -6,11 +6,13 @@ export CLIENT=$(cat openapitools.json | jq -r --arg generator "$GENERATOR" '."ge # Restore the oneOf spec mv ./specs/search/paths/search/search.yml.bak ./specs/search/paths/search/search.yml +# Replace {} (Openapi default) with new Object find $CLIENT -type f -name "*.java" | xargs sed -i '' -e 's/= {}/= new Object()/g' +# Create a special class for the OneOf integer string (not complete yet, juste here for compilation) echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfintegerstring.java -# Download the formatter if not present +# Download the formatter if not present and run it javaFormatter="google-java-format-1.13.0-all-deps.jar" if [[ ! -f "dist/$javaFormatter" ]]; then echo "Downloading formatter dependency" diff --git a/templates/java/JSON.mustache b/templates/java/JSON.mustache index 77b72ddc7f..cd412a9853 100644 --- a/templates/java/JSON.mustache +++ b/templates/java/JSON.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import com.google.gson.Gson; diff --git a/templates/java/JavaTimeFormatter.mustache b/templates/java/JavaTimeFormatter.mustache index d94ab5d0cb..5850c6425e 100644 --- a/templates/java/JavaTimeFormatter.mustache +++ b/templates/java/JavaTimeFormatter.mustache @@ -1,4 +1,3 @@ -{{>licenseInfo}} package {{invokerPackage}}; {{^threetenbp}} diff --git a/templates/java/Pair.mustache b/templates/java/Pair.mustache index 2cd1879dfc..c79e1d2846 100644 --- a/templates/java/Pair.mustache +++ b/templates/java/Pair.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; public class Pair { diff --git a/templates/java/StringUtil.mustache b/templates/java/StringUtil.mustache index 1fbb6a5556..4957c3b1c0 100644 --- a/templates/java/StringUtil.mustache +++ b/templates/java/StringUtil.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.util.Collection; @@ -27,10 +25,10 @@ public class StringUtil { /** * Join an array of strings with the given separator. - *

+ * * Note: This might be replaced by utility method from commons-lang or guava someday * if one of those libraries is added as dependency. - *

+ * * * @param array The array of strings * @param separator The separator diff --git a/templates/java/additionalEnumTypeAnnotations.mustache b/templates/java/additionalEnumTypeAnnotations.mustache index aa524798b4..452340adc4 100644 --- a/templates/java/additionalEnumTypeAnnotations.mustache +++ b/templates/java/additionalEnumTypeAnnotations.mustache @@ -1,2 +1,2 @@ {{#additionalEnumTypeAnnotations}}{{{.}}} -{{/additionalEnumTypeAnnotations}} \ No newline at end of file +{{/additionalEnumTypeAnnotations}} diff --git a/templates/java/additionalModelTypeAnnotations.mustache b/templates/java/additionalModelTypeAnnotations.mustache index f4871c02cc..a28cbba29a 100644 --- a/templates/java/additionalModelTypeAnnotations.mustache +++ b/templates/java/additionalModelTypeAnnotations.mustache @@ -1,2 +1,2 @@ {{#additionalModelTypeAnnotations}}{{{.}}} -{{/additionalModelTypeAnnotations}} \ No newline at end of file +{{/additionalModelTypeAnnotations}} diff --git a/templates/java/jackson_annotations.mustache b/templates/java/jackson_annotations.mustache index ccde126f54..d7a36b1b94 100644 --- a/templates/java/jackson_annotations.mustache +++ b/templates/java/jackson_annotations.mustache @@ -16,4 +16,4 @@ @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") {{/isXmlWrapped}} {{/isContainer}} - {{/withXml}} \ No newline at end of file + {{/withXml}} diff --git a/templates/java/libraries/okhttp-gson/ApiCallback.mustache b/templates/java/libraries/okhttp-gson/ApiCallback.mustache index 53b6a7b8e3..a86035f690 100644 --- a/templates/java/libraries/okhttp-gson/ApiCallback.mustache +++ b/templates/java/libraries/okhttp-gson/ApiCallback.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.io.IOException; diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 2199bcf635..a06cbb1d70 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import okhttp3.*; diff --git a/templates/java/libraries/okhttp-gson/ApiResponse.mustache b/templates/java/libraries/okhttp-gson/ApiResponse.mustache index 1e277319a9..0d2c7b1cd7 100644 --- a/templates/java/libraries/okhttp-gson/ApiResponse.mustache +++ b/templates/java/libraries/okhttp-gson/ApiResponse.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.util.List; diff --git a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache index b633aa8f58..af802483cf 100644 --- a/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache +++ b/templates/java/libraries/okhttp-gson/GzipRequestInterceptor.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import okhttp3.*; diff --git a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache index 71e1e2b4cb..b0ac8180e4 100644 --- a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import okhttp3.MediaType; diff --git a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache index 45115940b6..2db7b35157 100644 --- a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import okhttp3.MediaType; diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache index ea25f232d9..f3620a9cd3 100644 --- a/templates/java/libraries/okhttp-gson/README.mustache +++ b/templates/java/libraries/okhttp-gson/README.mustache @@ -4,14 +4,13 @@ - API version: {{appVersion}} {{{appDescriptionWithNewLines}}} - {{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) {{/infoUrl}} *Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - ## Requirements Building the API client library requires: diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 6370d2d98f..2b4931ee8e 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{package}}; import {{invokerPackage}}.ApiCallback; @@ -53,7 +51,7 @@ public class {{classname}} extends ApiClient { {{#operation}} {{^vendorExtensions.x-group-parameters}}/** * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -62,7 +60,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -70,7 +68,7 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{description}} + * {{{description}}} * @see {{summary}} Documentation {{/externalDocs}} */ @@ -181,7 +179,7 @@ public class {{classname}} extends ApiClient { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} * @return {{.}}{{/returnType}} * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} @@ -189,7 +187,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -197,7 +195,7 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{description}} + * {{{description}}} * @see {{summary}} Documentation {{/externalDocs}} */ @@ -221,7 +219,7 @@ public class {{classname}} extends ApiClient { {{^vendorExtensions.x-group-parameters}}/** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#responses.0}} @@ -229,7 +227,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -237,7 +235,7 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{description}} + * {{{description}}} * @see {{summary}} Documentation {{/externalDocs}} */ @@ -259,7 +257,7 @@ public class {{classname}} extends ApiClient { {{^vendorExtensions.x-group-parameters}}/** * {{summary}} (asynchronously) * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -268,7 +266,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -276,7 +274,7 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{description}} + * {{{description}}} * @see {{summary}} Documentation {{/externalDocs}} */ @@ -309,7 +307,7 @@ public class {{classname}} extends ApiClient { {{#optionalParams}} /** * Set {{paramName}} - * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @param {{paramName}} {{{description}}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) * @return API{{operationId}}Request */ public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { @@ -328,7 +326,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -352,7 +350,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -377,7 +375,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -402,7 +400,7 @@ public class {{classname}} extends ApiClient { {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -421,14 +419,14 @@ public class {{classname}} extends ApiClient { /** * {{summary}} * {{notes}}{{#requiredParams}} - * @param {{paramName}} {{description}} (required){{/requiredParams}} + * @param {{paramName}} {{{description}}} (required){{/requiredParams}} * @return API{{operationId}}Request {{#responses.0}} * @http.response.details {{#responses}} - + {{/responses}}
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{code}} {{message}} {{#headers}} * {{baseName}} - {{{description}}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
{{/responses.0}} @@ -436,7 +434,7 @@ public class {{classname}} extends ApiClient { * @deprecated {{/isDeprecated}} {{#externalDocs}} - * {{description}} + * {{{description}}} * @see {{summary}} Documentation {{/externalDocs}} */ diff --git a/templates/java/libraries/okhttp-gson/apiException.mustache b/templates/java/libraries/okhttp-gson/apiException.mustache index d1a38fc7d3..f64a2f29ff 100644 --- a/templates/java/libraries/okhttp-gson/apiException.mustache +++ b/templates/java/libraries/okhttp-gson/apiException.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{invokerPackage}}; import java.util.Map; diff --git a/templates/java/licenseInfo.mustache b/templates/java/licenseInfo.mustache deleted file mode 100644 index c66209f279..0000000000 --- a/templates/java/licenseInfo.mustache +++ /dev/null @@ -1,11 +0,0 @@ -/* - * {{{appName}}} - * {{{appDescription}}} - * - * {{#version}}The version of the OpenAPI document: {{{.}}}{{/version}} - * {{#infoEmail}}Contact: {{{.}}}{{/infoEmail}} - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ diff --git a/templates/java/model.mustache b/templates/java/model.mustache index 42efebb680..d8db05d71b 100644 --- a/templates/java/model.mustache +++ b/templates/java/model.mustache @@ -1,5 +1,3 @@ -{{>licenseInfo}} - package {{package}}; {{#useReflectionEqualsHashCode}} diff --git a/templates/java/modelEnum.mustache b/templates/java/modelEnum.mustache index f81c7c93ff..091bd1dd6b 100644 --- a/templates/java/modelEnum.mustache +++ b/templates/java/modelEnum.mustache @@ -11,7 +11,7 @@ import com.google.gson.stream.JsonWriter; {{/gson}} /** - * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + * {{{description}}}{{^description}}Gets or Sets {{{name}}}{{/description}} */ {{#gson}} @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.Adapter.class) @@ -24,7 +24,7 @@ import com.google.gson.stream.JsonWriter; {{#allowableValues}}{{#enumVars}} {{#enumDescription}} /** - * {{.}} + * {{{.}}} */ {{/enumDescription}} {{#withXml}} diff --git a/templates/java/modelInnerEnum.mustache b/templates/java/modelInnerEnum.mustache index a9c99783fd..3a82945127 100644 --- a/templates/java/modelInnerEnum.mustache +++ b/templates/java/modelInnerEnum.mustache @@ -1,5 +1,5 @@ /** - * {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} + * {{{description}}}{{^description}}Gets or Sets {{{name}}}{{/description}} */ {{#gson}} @JsonAdapter({{{datatypeWithEnum}}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.Adapter.class) @@ -17,7 +17,7 @@ {{#enumVars}} {{#enumDescription}} /** - * {{.}} + * {{{.}}} */ {{/enumDescription}} {{#withXml}} diff --git a/templates/java/pojo.mustache b/templates/java/pojo.mustache index 499382f3be..bd0d35b137 100644 --- a/templates/java/pojo.mustache +++ b/templates/java/pojo.mustache @@ -1,5 +1,5 @@ /** - * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * {{{description}}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} * @deprecated{{/isDeprecated}} */{{#isDeprecated}} @Deprecated{{/isDeprecated}}{{#description}} @@ -160,7 +160,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isReadOnly}} /** {{#description}} - * {{.}} + * {{{.}}} {{/description}} {{^description}} * Get {{name}} diff --git a/templates/java/xmlAnnotation.mustache b/templates/java/xmlAnnotation.mustache index 4f3b448c8d..af6aaa50fb 100644 --- a/templates/java/xmlAnnotation.mustache +++ b/templates/java/xmlAnnotation.mustache @@ -3,4 +3,4 @@ @XmlRootElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}name = "{{xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}") @XmlAccessorType(XmlAccessType.FIELD) {{#jackson}} -@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}"){{/jackson}}{{/withXml}} \ No newline at end of file +@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{.}}", {{/xmlNamespace}}localName = "{{xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}"){{/jackson}}{{/withXml}} diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 05cf6a95e1..f1bd91b08f 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -120,7 +120,7 @@ export class {{classname}} { * @summary {{&summary}} {{/summary}} {{#allParams}} - * @param {{paramName}} {{^description}}The {{paramName}}{{/description}}{{#description}}{{description}}{{/description}} + * @param {{paramName}} {{^description}}The {{paramName}}{{/description}}{{#description}}{{{description}}}{{/description}} {{/allParams}} */ public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}) : Promise<{{{returnType}}}> { diff --git a/templates/javascript/licenseInfo.mustache b/templates/javascript/licenseInfo.mustache deleted file mode 100644 index 9866f297a4..0000000000 --- a/templates/javascript/licenseInfo.mustache +++ /dev/null @@ -1,11 +0,0 @@ -/** - * {{{appName}}} - * {{{appDescription}}} - * - * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} - * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */