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 {
+ final OkHttpClient.Builder builder = httpClient.newBuilder();
+ builder.interceptors().remove(loggingInterceptor);
+ httpClient = builder.build();
+ loggingInterceptor = null;
+ }
+ }
+ this.debugging = debugging;
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ /**
+ * {@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
+ ) {
+ headerParams.put("X-Algolia-Application-Id", this.appId);
+ headerParams.put("X-Algolia-API-Key", this.apiKey);
+ }
+
+ /**
+ * 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 extends Certificate> 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 00000000000..06c74f5cc5b
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiException.java
@@ -0,0 +1,103 @@
+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/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java
new file mode 100644
index 00000000000..3826fd07542
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiResponse.java
@@ -0,0 +1,51 @@
+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;
+ 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/GzipRequestInterceptor.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java
new file mode 100644
index 00000000000..3a054245399
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/GzipRequestInterceptor.java
@@ -0,0 +1,80 @@
+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 00000000000..fff9b8547c2
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/JSON.java
@@ -0,0 +1,392 @@
+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 00000000000..1e5bf539ea2
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/Pair.java
@@ -0,0 +1,48 @@
+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 00000000000..42c926955cc
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressRequestBody.java
@@ -0,0 +1,61 @@
+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 00000000000..d5f13aa6e50
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ProgressResponseBody.java
@@ -0,0 +1,59 @@
+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/ServerConfiguration.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java
new file mode 100644
index 00000000000..2079f056c98
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerConfiguration.java
@@ -0,0 +1,71 @@
+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 00000000000..c0e8b2aa675
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ServerVariable.java
@@ -0,0 +1,27 @@
+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 00000000000..af841ec05cd
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java
@@ -0,0 +1,69 @@
+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/model/BaseIndexSettings.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java
new file mode 100644
index 00000000000..5ac1b4dfa23
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseIndexSettings.java
@@ -0,0 +1,583 @@
+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.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";
+
+ @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 00000000000..504405ca146
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchParams.java
@@ -0,0 +1,1261 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+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";
+
+ @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 OneOfintegerstring 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(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 OneOfintegerstring getAroundRadius() {
+ return 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."
+ )
+ 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)
+ );
+ }
+
+ 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
+ );
+ }
+
+ private static int hashCodeNullable(JsonNullable a) {
+ if (a == null) {
+ return 1;
+ }
+ return a.isPresent() ? Arrays.deepHashCode(new Object[] { a.get() }) : 31;
+ }
+
+ @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 00000000000..8a7d905271d
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponse.java
@@ -0,0 +1,882 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.HashMap;
+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";
+
+ @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 00000000000..390f261989d
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BaseSearchResponseFacetsStats.java
@@ -0,0 +1,153 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+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) {
+ 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 00000000000..e3f053211a0
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchObject.java
@@ -0,0 +1,82 @@
+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;
+
+/** 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 00000000000..9d8a55c551a
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchResponse.java
@@ -0,0 +1,112 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+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;
+ }
+
+ 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/ClearAllSynonymsResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java
new file mode 100644
index 00000000000..f3f206367c6
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ClearAllSynonymsResponse.java
@@ -0,0 +1,109 @@
+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/DeleteIndexResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java
new file mode 100644
index 00000000000..28c6eba1257
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteIndexResponse.java
@@ -0,0 +1,100 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.OffsetDateTime;
+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) {
+ 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/DeleteSynonymResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java
new file mode 100644
index 00000000000..f087b817349
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/DeleteSynonymResponse.java
@@ -0,0 +1,109 @@
+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/ErrorBase.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java
new file mode 100644
index 00000000000..95ad6123009
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/ErrorBase.java
@@ -0,0 +1,74 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.HashMap;
+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) {
+ 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 00000000000..7bb3d2dbbee
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/HighlightResult.java
@@ -0,0 +1,239 @@
+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.ApiModelProperty;
+import java.io.IOException;
+import java.util.ArrayList;
+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;
+
+ /** 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 00000000000..9f28608505e
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Index.java
@@ -0,0 +1,410 @@
+package com.algolia.model;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import java.time.OffsetDateTime;
+import java.util.ArrayList;
+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";
+
+ @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 00000000000..5b043ad11c5
--- /dev/null
+++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/IndexSettings.java
@@ -0,0 +1,2654 @@
+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.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";
+
+ @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 = new Object();
+
+ 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