From 47b00ccbcc2aa319ad279c87690ff5c80f1e36fb Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 14 Jan 2022 16:53:27 +0100 Subject: [PATCH 1/7] feat: add EchoRequester to java --- clients/algoliasearch-client-java-2/README.md | 8 +- .../com/algolia/ApiClient.java | 94 +- .../com/algolia/search/SearchApi.java | 1409 ++++++++++------- .../com/algolia/utils/EchoRequester.java | 33 + .../com/algolia/utils/HttpRequester.java | 106 ++ .../com/algolia/utils/Requester.java | 60 + .../utils/EchoRequester.java | 33 + .../utils/HttpRequester.java | 106 ++ .../utils/Requester.java | 60 + scripts/post-gen/java.sh | 4 +- .../libraries/okhttp-gson/ApiClient.mustache | 78 +- .../java/libraries/okhttp-gson/api.mustache | 31 +- tests/output/java/tests/searchRequests.java | 0 13 files changed, 1263 insertions(+), 759 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java create mode 100644 clients/algoliasearch-client-java-2/utils/EchoRequester.java create mode 100644 clients/algoliasearch-client-java-2/utils/HttpRequester.java create mode 100644 clients/algoliasearch-client-java-2/utils/Requester.java delete mode 100644 tests/output/java/tests/searchRequests.java diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md index d1fe04db28..522fb9b453 100644 --- a/clients/algoliasearch-client-java-2/README.md +++ b/clients/algoliasearch-client-java-2/README.md @@ -1,15 +1,17 @@ # algoliasearch-client-java-2 Search API + - API version: 0.1.0 API powering the Search feature of Algolia. -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* +_Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)_ ## Requirements Building the API client library requires: + 1. Java 1.8+ 2. Maven/Gradle @@ -60,8 +62,8 @@ mvn clean package Then manually install the following JARs: -* `target/algoliasearch-client-java-2-0.1.0.jar` -* `target/lib/*.jar` +- `target/algoliasearch-client-java-2-0.1.0.jar` +- `target/lib/*.jar` ## Getting Started diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index c89d7d6044..a2db1445f2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -1,5 +1,6 @@ package com.algolia; +import com.algolia.utils.Requester; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; @@ -9,11 +10,8 @@ import java.time.OffsetDateTime; import java.util.*; import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; import okhttp3.*; import okhttp3.internal.http.HttpMethod; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; public class ApiClient { @@ -25,36 +23,21 @@ public class ApiClient { private DateFormat dateFormat; - private OkHttpClient httpClient; private JSON json; - private HttpLoggingInterceptor loggingInterceptor; + private Requester requester; /* - * Basic constructor for ApiClient + * Constructor for ApiClient with custom Requester */ - public ApiClient(String appId, String apiKey) { + public ApiClient(String appId, String apiKey, Requester requester) { json = new JSON(); setUserAgent("OpenAPI-Generator/0.1.0/java"); - initHttpClient(); this.basePath = "https://" + appId + "-1.algolianet.com"; this.appId = appId; this.apiKey = apiKey; - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor : interceptors) { - builder.addInterceptor(interceptor); - } - - httpClient = builder.build(); + this.requester = requester; } /** @@ -130,20 +113,7 @@ public boolean isDebugging() { * @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; + requester.setDebugging(debugging); return this; } @@ -153,7 +123,7 @@ public ApiClient setDebugging(boolean debugging) { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); + return requester.getConnectTimeout(); } /** @@ -164,11 +134,7 @@ public int getConnectTimeout() { * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); + requester.setConnectTimeout(connectionTimeout); return this; } @@ -178,7 +144,7 @@ public ApiClient setConnectTimeout(int connectionTimeout) { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.readTimeoutMillis(); + return requester.getReadTimeout(); } /** @@ -189,11 +155,7 @@ public int getReadTimeout() { * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient = - httpClient - .newBuilder() - .readTimeout(readTimeout, TimeUnit.MILLISECONDS) - .build(); + requester.setReadTimeout(readTimeout); return this; } @@ -203,7 +165,7 @@ public ApiClient setReadTimeout(int readTimeout) { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); + return requester.getWriteTimeout(); } /** @@ -214,11 +176,7 @@ public int getWriteTimeout() { * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = - httpClient - .newBuilder() - .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) - .build(); + requester.setWriteTimeout(writeTimeout); return this; } @@ -652,10 +610,10 @@ public T handleResponse(Response response, Type returnType) * @param body The request body object * @param headerParams The header parameters * @param callback Callback for upload/download progress - * @return The HTTP call + * @return The HTTP call or EchoRequester * @throws ApiException If fail to serialize the request body object */ - public Call buildCall( + public Object buildCall( String path, String method, List queryParams, @@ -672,7 +630,7 @@ public Call buildCall( callback ); - return httpClient.newCall(request); + return requester.newCall(request); } /** @@ -815,26 +773,4 @@ public RequestBody buildRequestBodyFormEncoding( } return formBuilder.build(); } - - /** - * 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; - } - }; - } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 39d51cceed..6a676bfe9a 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -60,6 +60,7 @@ import com.algolia.model.UpdatedAtWithObjectIdResponse; import com.algolia.model.UpdatedRuleResponse; import com.algolia.model.UserId; +import com.algolia.utils.*; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; @@ -71,7 +72,11 @@ public class SearchApi extends ApiClient { public SearchApi(String appId, String apiKey) { - super(appId, apiKey); + super(appId, apiKey, new HttpRequester()); + } + + public SearchApi(String appId, String apiKey, Requester requester) { + super(appId, apiKey, requester); } /** @@ -79,10 +84,10 @@ public SearchApi(String appId, String apiKey) { * * @param apiKey (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call addApiKeyCall(ApiKey apiKey, final ApiCallback _callback) + private Object addApiKeyCall(ApiKey apiKey, final ApiCallback _callback) throws ApiException { Object bodyObj = apiKey; @@ -105,8 +110,7 @@ private Call addApiKeyCall(ApiKey apiKey, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call addApiKeyValidateBeforeCall( + private Object addApiKeyValidateBeforeCall( ApiKey apiKey, final ApiCallback _callback ) throws ApiException { @@ -128,11 +132,15 @@ private Call addApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public AddApiKeyResponse addApiKey(ApiKey apiKey) throws ApiException { - Call call = addApiKeyValidateBeforeCall(apiKey, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T addApiKey(ApiKey apiKey) throws ApiException { + Object req = addApiKeyValidateBeforeCall(apiKey, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -147,7 +155,7 @@ public Call addApiKeyAsync( ApiKey apiKey, final ApiCallback _callback ) throws ApiException { - Call call = addApiKeyValidateBeforeCall(apiKey, _callback); + Call call = (Call) addApiKeyValidateBeforeCall(apiKey, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -160,10 +168,10 @@ public Call addApiKeyAsync( * @param objectID Unique identifier of an object. (required) * @param body The Algolia object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call addOrUpdateObjectCall( + private Object addOrUpdateObjectCall( String indexName, String objectID, Object body, @@ -198,8 +206,7 @@ private Call addOrUpdateObjectCall( ); } - @SuppressWarnings("rawtypes") - private Call addOrUpdateObjectValidateBeforeCall( + private Object addOrUpdateObjectValidateBeforeCall( String indexName, String objectID, Object body, @@ -240,22 +247,26 @@ private Call addOrUpdateObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtWithObjectIdResponse addOrUpdateObject( + public T addOrUpdateObject( String indexName, String objectID, Object body ) throws ApiException { - Call call = addOrUpdateObjectValidateBeforeCall( + Object req = addOrUpdateObjectValidateBeforeCall( indexName, objectID, body, null ); - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -275,7 +286,7 @@ public Call addOrUpdateObjectAsync( Object body, final ApiCallback _callback ) throws ApiException { - Call call = addOrUpdateObjectValidateBeforeCall( + Call call = (Call) addOrUpdateObjectValidateBeforeCall( indexName, objectID, body, @@ -292,10 +303,10 @@ public Call addOrUpdateObjectAsync( * * @param source The source to add. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call appendSourceCall(Source source, final ApiCallback _callback) + private Object appendSourceCall(Source source, final ApiCallback _callback) throws ApiException { Object bodyObj = source; @@ -318,8 +329,7 @@ private Call appendSourceCall(Source source, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call appendSourceValidateBeforeCall( + private Object appendSourceValidateBeforeCall( Source source, final ApiCallback _callback ) throws ApiException { @@ -341,11 +351,15 @@ private Call appendSourceValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public CreatedAtResponse appendSource(Source source) throws ApiException { - Call call = appendSourceValidateBeforeCall(source, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T appendSource(Source source) throws ApiException { + Object req = appendSourceValidateBeforeCall(source, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -360,7 +374,7 @@ public Call appendSourceAsync( Source source, final ApiCallback _callback ) throws ApiException { - Call call = appendSourceValidateBeforeCall(source, _callback); + Call call = (Call) appendSourceValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -372,10 +386,10 @@ public Call appendSourceAsync( * @param xAlgoliaUserID userID to assign. (required) * @param assignUserIdObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call assignUserIdCall( + private Object assignUserIdCall( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject, final ApiCallback _callback @@ -407,8 +421,7 @@ private Call assignUserIdCall( ); } - @SuppressWarnings("rawtypes") - private Call assignUserIdValidateBeforeCall( + private Object assignUserIdValidateBeforeCall( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject, final ApiCallback _callback @@ -442,18 +455,22 @@ private Call assignUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public CreatedAtResponse assignUserId( + public T assignUserId( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject ) throws ApiException { - Call call = assignUserIdValidateBeforeCall( + Object req = assignUserIdValidateBeforeCall( xAlgoliaUserID, assignUserIdObject, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -473,7 +490,7 @@ public Call assignUserIdAsync( AssignUserIdObject assignUserIdObject, final ApiCallback _callback ) throws ApiException { - Call call = assignUserIdValidateBeforeCall( + Call call = (Call) assignUserIdValidateBeforeCall( xAlgoliaUserID, assignUserIdObject, _callback @@ -489,10 +506,10 @@ public Call assignUserIdAsync( * @param indexName The index in which to perform the request. (required) * @param batchWriteObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call batchCall( + private Object batchCall( String indexName, BatchWriteObject batchWriteObject, final ApiCallback _callback @@ -522,8 +539,7 @@ private Call batchCall( ); } - @SuppressWarnings("rawtypes") - private Call batchValidateBeforeCall( + private Object batchValidateBeforeCall( String indexName, BatchWriteObject batchWriteObject, final ApiCallback _callback @@ -554,14 +570,16 @@ private Call batchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public BatchResponse batch( - String indexName, - BatchWriteObject batchWriteObject - ) throws ApiException { - Call call = batchValidateBeforeCall(indexName, batchWriteObject, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T batch(String indexName, BatchWriteObject batchWriteObject) + throws ApiException { + Object req = batchValidateBeforeCall(indexName, batchWriteObject, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -578,7 +596,11 @@ public Call batchAsync( BatchWriteObject batchWriteObject, final ApiCallback _callback ) throws ApiException { - Call call = batchValidateBeforeCall(indexName, batchWriteObject, _callback); + Call call = (Call) batchValidateBeforeCall( + indexName, + batchWriteObject, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -590,10 +612,10 @@ public Call batchAsync( * @param xAlgoliaUserID userID to assign. (required) * @param batchAssignUserIdsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call batchAssignUserIdsCall( + private Object batchAssignUserIdsCall( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject, final ApiCallback _callback @@ -625,8 +647,7 @@ private Call batchAssignUserIdsCall( ); } - @SuppressWarnings("rawtypes") - private Call batchAssignUserIdsValidateBeforeCall( + private Object batchAssignUserIdsValidateBeforeCall( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject, final ApiCallback _callback @@ -664,18 +685,22 @@ private Call batchAssignUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public CreatedAtResponse batchAssignUserIds( + public T batchAssignUserIds( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject ) throws ApiException { - Call call = batchAssignUserIdsValidateBeforeCall( + Object req = batchAssignUserIdsValidateBeforeCall( xAlgoliaUserID, batchAssignUserIdsObject, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -694,7 +719,7 @@ public Call batchAssignUserIdsAsync( BatchAssignUserIdsObject batchAssignUserIdsObject, final ApiCallback _callback ) throws ApiException { - Call call = batchAssignUserIdsValidateBeforeCall( + Call call = (Call) batchAssignUserIdsValidateBeforeCall( xAlgoliaUserID, batchAssignUserIdsObject, _callback @@ -710,10 +735,10 @@ public Call batchAssignUserIdsAsync( * @param dictionaryName The dictionary to search in. (required) * @param batchDictionaryEntries (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call batchDictionaryEntriesCall( + private Object batchDictionaryEntriesCall( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries, final ApiCallback _callback @@ -743,8 +768,7 @@ private Call batchDictionaryEntriesCall( ); } - @SuppressWarnings("rawtypes") - private Call batchDictionaryEntriesValidateBeforeCall( + private Object batchDictionaryEntriesValidateBeforeCall( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries, final ApiCallback _callback @@ -781,18 +805,22 @@ private Call batchDictionaryEntriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse batchDictionaryEntries( + public T batchDictionaryEntries( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries ) throws ApiException { - Call call = batchDictionaryEntriesValidateBeforeCall( + Object req = batchDictionaryEntriesValidateBeforeCall( dictionaryName, batchDictionaryEntries, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -809,7 +837,7 @@ public Call batchDictionaryEntriesAsync( BatchDictionaryEntries batchDictionaryEntries, final ApiCallback _callback ) throws ApiException { - Call call = batchDictionaryEntriesValidateBeforeCall( + Call call = (Call) batchDictionaryEntriesValidateBeforeCall( dictionaryName, batchDictionaryEntries, _callback @@ -829,10 +857,10 @@ public Call batchDictionaryEntriesAsync( * @param clearExistingRules When true, existing Rules are cleared before adding this batch. When * false, existing Rules are kept. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call batchRulesCall( + private Object batchRulesCall( String indexName, List rule, Boolean forwardToReplicas, @@ -876,8 +904,7 @@ private Call batchRulesCall( ); } - @SuppressWarnings("rawtypes") - private Call batchRulesValidateBeforeCall( + private Object batchRulesValidateBeforeCall( String indexName, List rule, Boolean forwardToReplicas, @@ -920,22 +947,26 @@ private Call batchRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse batchRules( + public T batchRules( String indexName, List rule, Boolean forwardToReplicas, Boolean clearExistingRules ) throws ApiException { - Call call = batchRulesValidateBeforeCall( + Object req = batchRulesValidateBeforeCall( indexName, rule, forwardToReplicas, clearExistingRules, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -958,7 +989,7 @@ public Call batchRulesAsync( Boolean clearExistingRules, final ApiCallback _callback ) throws ApiException { - Call call = batchRulesValidateBeforeCall( + Call call = (Call) batchRulesValidateBeforeCall( indexName, rule, forwardToReplicas, @@ -976,10 +1007,10 @@ public Call batchRulesAsync( * @param indexName The index in which to perform the request. (required) * @param browseRequest (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call browseCall( + private Object browseCall( String indexName, BrowseRequest browseRequest, final ApiCallback _callback @@ -1009,8 +1040,7 @@ private Call browseCall( ); } - @SuppressWarnings("rawtypes") - private Call browseValidateBeforeCall( + private Object browseValidateBeforeCall( String indexName, BrowseRequest browseRequest, final ApiCallback _callback @@ -1039,12 +1069,16 @@ private Call browseValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public BrowseResponse browse(String indexName, BrowseRequest browseRequest) + public T browse(String indexName, BrowseRequest browseRequest) throws ApiException { - Call call = browseValidateBeforeCall(indexName, browseRequest, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = browseValidateBeforeCall(indexName, browseRequest, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1067,7 +1101,11 @@ public Call browseAsync( BrowseRequest browseRequest, final ApiCallback _callback ) throws ApiException { - Call call = browseValidateBeforeCall(indexName, browseRequest, _callback); + Call call = (Call) browseValidateBeforeCall( + indexName, + browseRequest, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1080,10 +1118,10 @@ public Call browseAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call clearAllSynonymsCall( + private Object clearAllSynonymsCall( String indexName, Boolean forwardToReplicas, final ApiCallback _callback @@ -1119,8 +1157,7 @@ private Call clearAllSynonymsCall( ); } - @SuppressWarnings("rawtypes") - private Call clearAllSynonymsValidateBeforeCall( + private Object clearAllSynonymsValidateBeforeCall( String indexName, Boolean forwardToReplicas, final ApiCallback _callback @@ -1145,18 +1182,20 @@ private Call clearAllSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse clearAllSynonyms( - String indexName, - Boolean forwardToReplicas - ) throws ApiException { - Call call = clearAllSynonymsValidateBeforeCall( + public T clearAllSynonyms(String indexName, Boolean forwardToReplicas) + throws ApiException { + Object req = clearAllSynonymsValidateBeforeCall( indexName, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1174,7 +1213,7 @@ public Call clearAllSynonymsAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = clearAllSynonymsValidateBeforeCall( + Call call = (Call) clearAllSynonymsValidateBeforeCall( indexName, forwardToReplicas, _callback @@ -1189,11 +1228,13 @@ public Call clearAllSynonymsAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call clearObjectsCall(String indexName, final ApiCallback _callback) - throws ApiException { + private Object clearObjectsCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -1219,8 +1260,7 @@ private Call clearObjectsCall(String indexName, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call clearObjectsValidateBeforeCall( + private Object clearObjectsValidateBeforeCall( String indexName, final ApiCallback _callback ) throws ApiException { @@ -1242,11 +1282,15 @@ private Call clearObjectsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse clearObjects(String indexName) throws ApiException { - Call call = clearObjectsValidateBeforeCall(indexName, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T clearObjects(String indexName) throws ApiException { + Object req = clearObjectsValidateBeforeCall(indexName, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1262,7 +1306,7 @@ public Call clearObjectsAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = clearObjectsValidateBeforeCall(indexName, _callback); + Call call = (Call) clearObjectsValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1275,10 +1319,10 @@ public Call clearObjectsAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call clearRulesCall( + private Object clearRulesCall( String indexName, Boolean forwardToReplicas, final ApiCallback _callback @@ -1314,8 +1358,7 @@ private Call clearRulesCall( ); } - @SuppressWarnings("rawtypes") - private Call clearRulesValidateBeforeCall( + private Object clearRulesValidateBeforeCall( String indexName, Boolean forwardToReplicas, final ApiCallback _callback @@ -1340,18 +1383,20 @@ private Call clearRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse clearRules( - String indexName, - Boolean forwardToReplicas - ) throws ApiException { - Call call = clearRulesValidateBeforeCall( + public T clearRules(String indexName, Boolean forwardToReplicas) + throws ApiException { + Object req = clearRulesValidateBeforeCall( indexName, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1369,7 +1414,7 @@ public Call clearRulesAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = clearRulesValidateBeforeCall( + Call call = (Call) clearRulesValidateBeforeCall( indexName, forwardToReplicas, _callback @@ -1384,10 +1429,10 @@ public Call clearRulesAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteApiKeyCall(String key, final ApiCallback _callback) + private Object deleteApiKeyCall(String key, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -1414,8 +1459,7 @@ private Call deleteApiKeyCall(String key, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call deleteApiKeyValidateBeforeCall( + private Object deleteApiKeyValidateBeforeCall( String key, final ApiCallback _callback ) throws ApiException { @@ -1437,11 +1481,15 @@ private Call deleteApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeleteApiKeyResponse deleteApiKey(String key) throws ApiException { - Call call = deleteApiKeyValidateBeforeCall(key, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T deleteApiKey(String key) throws ApiException { + Object req = deleteApiKeyValidateBeforeCall(key, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1456,7 +1504,7 @@ public Call deleteApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = deleteApiKeyValidateBeforeCall(key, _callback); + Call call = (Call) deleteApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1468,10 +1516,10 @@ public Call deleteApiKeyAsync( * @param indexName The index in which to perform the request. (required) * @param searchParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteByCall( + private Object deleteByCall( String indexName, SearchParams searchParams, final ApiCallback _callback @@ -1501,8 +1549,7 @@ private Call deleteByCall( ); } - @SuppressWarnings("rawtypes") - private Call deleteByValidateBeforeCall( + private Object deleteByValidateBeforeCall( String indexName, SearchParams searchParams, final ApiCallback _callback @@ -1535,14 +1582,16 @@ private Call deleteByValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeletedAtResponse deleteBy( - String indexName, - SearchParams searchParams - ) throws ApiException { - Call call = deleteByValidateBeforeCall(indexName, searchParams, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T deleteBy(String indexName, SearchParams searchParams) + throws ApiException { + Object req = deleteByValidateBeforeCall(indexName, searchParams, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1561,7 +1610,11 @@ public Call deleteByAsync( SearchParams searchParams, final ApiCallback _callback ) throws ApiException { - Call call = deleteByValidateBeforeCall(indexName, searchParams, _callback); + Call call = (Call) deleteByValidateBeforeCall( + indexName, + searchParams, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1572,10 +1625,10 @@ public Call deleteByAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteIndexCall(String indexName, final ApiCallback _callback) + private Object deleteIndexCall(String indexName, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -1602,8 +1655,7 @@ private Call deleteIndexCall(String indexName, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call deleteIndexValidateBeforeCall( + private Object deleteIndexValidateBeforeCall( String indexName, final ApiCallback _callback ) throws ApiException { @@ -1625,11 +1677,15 @@ private Call deleteIndexValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeletedAtResponse deleteIndex(String indexName) throws ApiException { - Call call = deleteIndexValidateBeforeCall(indexName, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T deleteIndex(String indexName) throws ApiException { + Object req = deleteIndexValidateBeforeCall(indexName, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1644,7 +1700,7 @@ public Call deleteIndexAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = deleteIndexValidateBeforeCall(indexName, _callback); + Call call = (Call) deleteIndexValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1656,10 +1712,10 @@ public Call deleteIndexAsync( * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteObjectCall( + private Object deleteObjectCall( String indexName, String objectID, final ApiCallback _callback @@ -1693,8 +1749,7 @@ private Call deleteObjectCall( ); } - @SuppressWarnings("rawtypes") - private Call deleteObjectValidateBeforeCall( + private Object deleteObjectValidateBeforeCall( String indexName, String objectID, final ApiCallback _callback @@ -1725,12 +1780,16 @@ private Call deleteObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeletedAtResponse deleteObject(String indexName, String objectID) + public T deleteObject(String indexName, String objectID) throws ApiException { - Call call = deleteObjectValidateBeforeCall(indexName, objectID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = deleteObjectValidateBeforeCall(indexName, objectID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1747,7 +1806,11 @@ public Call deleteObjectAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = deleteObjectValidateBeforeCall(indexName, objectID, _callback); + Call call = (Call) deleteObjectValidateBeforeCall( + indexName, + objectID, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1761,10 +1824,10 @@ public Call deleteObjectAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteRuleCall( + private Object deleteRuleCall( String indexName, String objectID, Boolean forwardToReplicas, @@ -1805,8 +1868,7 @@ private Call deleteRuleCall( ); } - @SuppressWarnings("rawtypes") - private Call deleteRuleValidateBeforeCall( + private Object deleteRuleValidateBeforeCall( String indexName, String objectID, Boolean forwardToReplicas, @@ -1840,20 +1902,24 @@ private Call deleteRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse deleteRule( + public T deleteRule( String indexName, String objectID, Boolean forwardToReplicas ) throws ApiException { - Call call = deleteRuleValidateBeforeCall( + Object req = deleteRuleValidateBeforeCall( indexName, objectID, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1873,7 +1939,7 @@ public Call deleteRuleAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = deleteRuleValidateBeforeCall( + Call call = (Call) deleteRuleValidateBeforeCall( indexName, objectID, forwardToReplicas, @@ -1889,10 +1955,10 @@ public Call deleteRuleAsync( * * @param source The IP range of the source. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteSourceCall(String source, final ApiCallback _callback) + private Object deleteSourceCall(String source, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -1919,8 +1985,7 @@ private Call deleteSourceCall(String source, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call deleteSourceValidateBeforeCall( + private Object deleteSourceValidateBeforeCall( String source, final ApiCallback _callback ) throws ApiException { @@ -1942,11 +2007,15 @@ private Call deleteSourceValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeleteSourceResponse deleteSource(String source) throws ApiException { - Call call = deleteSourceValidateBeforeCall(source, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T deleteSource(String source) throws ApiException { + Object req = deleteSourceValidateBeforeCall(source, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -1961,7 +2030,7 @@ public Call deleteSourceAsync( String source, final ApiCallback _callback ) throws ApiException { - Call call = deleteSourceValidateBeforeCall(source, _callback); + Call call = (Call) deleteSourceValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1975,10 +2044,10 @@ public Call deleteSourceAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call deleteSynonymCall( + private Object deleteSynonymCall( String indexName, String objectID, Boolean forwardToReplicas, @@ -2019,8 +2088,7 @@ private Call deleteSynonymCall( ); } - @SuppressWarnings("rawtypes") - private Call deleteSynonymValidateBeforeCall( + private Object deleteSynonymValidateBeforeCall( String indexName, String objectID, Boolean forwardToReplicas, @@ -2054,20 +2122,24 @@ private Call deleteSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public DeletedAtResponse deleteSynonym( + public T deleteSynonym( String indexName, String objectID, Boolean forwardToReplicas ) throws ApiException { - Call call = deleteSynonymValidateBeforeCall( + Object req = deleteSynonymValidateBeforeCall( indexName, objectID, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2087,7 +2159,7 @@ public Call deleteSynonymAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = deleteSynonymValidateBeforeCall( + Call call = (Call) deleteSynonymValidateBeforeCall( indexName, objectID, forwardToReplicas, @@ -2103,10 +2175,10 @@ public Call deleteSynonymAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getApiKeyCall(String key, final ApiCallback _callback) + private Object getApiKeyCall(String key, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -2133,8 +2205,7 @@ private Call getApiKeyCall(String key, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getApiKeyValidateBeforeCall( + private Object getApiKeyValidateBeforeCall( String key, final ApiCallback _callback ) throws ApiException { @@ -2156,11 +2227,15 @@ private Call getApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public KeyObject getApiKey(String key) throws ApiException { - Call call = getApiKeyValidateBeforeCall(key, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getApiKey(String key) throws ApiException { + Object req = getApiKeyValidateBeforeCall(key, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2175,7 +2250,7 @@ public Call getApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = getApiKeyValidateBeforeCall(key, _callback); + Call call = (Call) getApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2185,10 +2260,10 @@ public Call getApiKeyAsync( * Build call for getDictionaryLanguages * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getDictionaryLanguagesCall(final ApiCallback _callback) + private Object getDictionaryLanguagesCall(final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -2211,8 +2286,7 @@ private Call getDictionaryLanguagesCall(final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getDictionaryLanguagesValidateBeforeCall( + private Object getDictionaryLanguagesValidateBeforeCall( final ApiCallback _callback ) throws ApiException { return getDictionaryLanguagesCall(_callback); @@ -2225,11 +2299,15 @@ private Call getDictionaryLanguagesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public Map getDictionaryLanguages() throws ApiException { - Call call = getDictionaryLanguagesValidateBeforeCall(null); - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); + public T getDictionaryLanguages() throws ApiException { + Object req = getDictionaryLanguagesValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2242,7 +2320,7 @@ public Map getDictionaryLanguages() throws ApiException { public Call getDictionaryLanguagesAsync( final ApiCallback> _callback ) throws ApiException { - Call call = getDictionaryLanguagesValidateBeforeCall(_callback); + Call call = (Call) getDictionaryLanguagesValidateBeforeCall(_callback); Type returnType = new TypeToken>() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2252,10 +2330,10 @@ public Call getDictionaryLanguagesAsync( * Build call for getDictionarySettings * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getDictionarySettingsCall(final ApiCallback _callback) + private Object getDictionarySettingsCall(final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -2278,8 +2356,7 @@ private Call getDictionarySettingsCall(final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getDictionarySettingsValidateBeforeCall( + private Object getDictionarySettingsValidateBeforeCall( final ApiCallback _callback ) throws ApiException { return getDictionarySettingsCall(_callback); @@ -2292,14 +2369,17 @@ private Call getDictionarySettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public GetDictionarySettingsResponse getDictionarySettings() - throws ApiException { - Call call = getDictionarySettingsValidateBeforeCall(null); - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); + public T getDictionarySettings() throws ApiException { + Object req = getDictionarySettingsValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2312,7 +2392,7 @@ public GetDictionarySettingsResponse getDictionarySettings() public Call getDictionarySettingsAsync( final ApiCallback _callback ) throws ApiException { - Call call = getDictionarySettingsValidateBeforeCall(_callback); + Call call = (Call) getDictionarySettingsValidateBeforeCall(_callback); Type returnType = new TypeToken() {} .getType(); this.executeAsync(call, returnType, _callback); @@ -2331,10 +2411,10 @@ public Call getDictionarySettingsAsync( * @param type Type of log entries to retrieve. When omitted, all log entries are retrieved. * (optional, default to all) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getLogsCall( + private Object getLogsCall( Integer offset, Integer length, String indexName, @@ -2378,8 +2458,7 @@ private Call getLogsCall( ); } - @SuppressWarnings("rawtypes") - private Call getLogsValidateBeforeCall( + private Object getLogsValidateBeforeCall( Integer offset, Integer length, String indexName, @@ -2404,22 +2483,26 @@ private Call getLogsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public GetLogsResponse getLogs( + public T getLogs( Integer offset, Integer length, String indexName, String type ) throws ApiException { - Call call = getLogsValidateBeforeCall( + Object req = getLogsValidateBeforeCall( offset, length, indexName, type, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2444,7 +2527,7 @@ public Call getLogsAsync( String type, final ApiCallback _callback ) throws ApiException { - Call call = getLogsValidateBeforeCall( + Call call = (Call) getLogsValidateBeforeCall( offset, length, indexName, @@ -2464,10 +2547,10 @@ public Call getLogsAsync( * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable * attributes are returned. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getObjectCall( + private Object getObjectCall( String indexName, String objectID, List attributesToRetrieve, @@ -2508,8 +2591,7 @@ private Call getObjectCall( ); } - @SuppressWarnings("rawtypes") - private Call getObjectValidateBeforeCall( + private Object getObjectValidateBeforeCall( String indexName, String objectID, List attributesToRetrieve, @@ -2543,20 +2625,24 @@ private Call getObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public Map getObject( + public T getObject( String indexName, String objectID, List attributesToRetrieve ) throws ApiException { - Call call = getObjectValidateBeforeCall( + Object req = getObjectValidateBeforeCall( indexName, objectID, attributesToRetrieve, null ); - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2576,7 +2662,7 @@ public Call getObjectAsync( List attributesToRetrieve, final ApiCallback> _callback ) throws ApiException { - Call call = getObjectValidateBeforeCall( + Call call = (Call) getObjectValidateBeforeCall( indexName, objectID, attributesToRetrieve, @@ -2592,10 +2678,10 @@ public Call getObjectAsync( * * @param getObjectsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getObjectsCall( + private Object getObjectsCall( GetObjectsObject getObjectsObject, final ApiCallback _callback ) throws ApiException { @@ -2620,8 +2706,7 @@ private Call getObjectsCall( ); } - @SuppressWarnings("rawtypes") - private Call getObjectsValidateBeforeCall( + private Object getObjectsValidateBeforeCall( GetObjectsObject getObjectsObject, final ApiCallback _callback ) throws ApiException { @@ -2643,12 +2728,16 @@ private Call getObjectsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public GetObjectsResponse getObjects(GetObjectsObject getObjectsObject) + public T getObjects(GetObjectsObject getObjectsObject) throws ApiException { - Call call = getObjectsValidateBeforeCall(getObjectsObject, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = getObjectsValidateBeforeCall(getObjectsObject, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2664,7 +2753,10 @@ public Call getObjectsAsync( GetObjectsObject getObjectsObject, final ApiCallback _callback ) throws ApiException { - Call call = getObjectsValidateBeforeCall(getObjectsObject, _callback); + Call call = (Call) getObjectsValidateBeforeCall( + getObjectsObject, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2676,10 +2768,10 @@ public Call getObjectsAsync( * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getRuleCall( + private Object getRuleCall( String indexName, String objectID, final ApiCallback _callback @@ -2713,8 +2805,7 @@ private Call getRuleCall( ); } - @SuppressWarnings("rawtypes") - private Call getRuleValidateBeforeCall( + private Object getRuleValidateBeforeCall( String indexName, String objectID, final ApiCallback _callback @@ -2745,11 +2836,15 @@ private Call getRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public Rule getRule(String indexName, String objectID) throws ApiException { - Call call = getRuleValidateBeforeCall(indexName, objectID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getRule(String indexName, String objectID) throws ApiException { + Object req = getRuleValidateBeforeCall(indexName, objectID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2766,7 +2861,11 @@ public Call getRuleAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = getRuleValidateBeforeCall(indexName, objectID, _callback); + Call call = (Call) getRuleValidateBeforeCall( + indexName, + objectID, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2777,10 +2876,10 @@ public Call getRuleAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getSettingsCall(String indexName, final ApiCallback _callback) + private Object getSettingsCall(String indexName, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -2807,8 +2906,7 @@ private Call getSettingsCall(String indexName, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getSettingsValidateBeforeCall( + private Object getSettingsValidateBeforeCall( String indexName, final ApiCallback _callback ) throws ApiException { @@ -2830,11 +2928,15 @@ private Call getSettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public IndexSettings getSettings(String indexName) throws ApiException { - Call call = getSettingsValidateBeforeCall(indexName, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getSettings(String indexName) throws ApiException { + Object req = getSettingsValidateBeforeCall(indexName, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2849,7 +2951,7 @@ public Call getSettingsAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = getSettingsValidateBeforeCall(indexName, _callback); + Call call = (Call) getSettingsValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2859,10 +2961,11 @@ public Call getSettingsAsync( * Build call for getSources * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getSourcesCall(final ApiCallback _callback) throws ApiException { + private Object getSourcesCall(final ApiCallback _callback) + throws ApiException { Object bodyObj = null; // create path and map variables @@ -2884,8 +2987,7 @@ private Call getSourcesCall(final ApiCallback _callback) throws ApiException { ); } - @SuppressWarnings("rawtypes") - private Call getSourcesValidateBeforeCall(final ApiCallback _callback) + private Object getSourcesValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getSourcesCall(_callback); } @@ -2897,11 +2999,15 @@ private Call getSourcesValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public List getSources() throws ApiException { - Call call = getSourcesValidateBeforeCall(null); - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return res.getData(); + public T getSources() throws ApiException { + Object req = getSourcesValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -2913,7 +3019,7 @@ public List getSources() throws ApiException { */ public Call getSourcesAsync(final ApiCallback> _callback) throws ApiException { - Call call = getSourcesValidateBeforeCall(_callback); + Call call = (Call) getSourcesValidateBeforeCall(_callback); Type returnType = new TypeToken>() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2925,10 +3031,10 @@ public Call getSourcesAsync(final ApiCallback> _callback) * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getSynonymCall( + private Object getSynonymCall( String indexName, String objectID, final ApiCallback _callback @@ -2962,8 +3068,7 @@ private Call getSynonymCall( ); } - @SuppressWarnings("rawtypes") - private Call getSynonymValidateBeforeCall( + private Object getSynonymValidateBeforeCall( String indexName, String objectID, final ApiCallback _callback @@ -2994,12 +3099,16 @@ private Call getSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SynonymHit getSynonym(String indexName, String objectID) + public T getSynonym(String indexName, String objectID) throws ApiException { - Call call = getSynonymValidateBeforeCall(indexName, objectID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = getSynonymValidateBeforeCall(indexName, objectID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3016,7 +3125,11 @@ public Call getSynonymAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = getSynonymValidateBeforeCall(indexName, objectID, _callback); + Call call = (Call) getSynonymValidateBeforeCall( + indexName, + objectID, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3028,10 +3141,10 @@ public Call getSynonymAsync( * @param indexName The index in which to perform the request. (required) * @param taskID Unique identifier of an task. Numeric value (up to 64bits) (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getTaskCall( + private Object getTaskCall( String indexName, Integer taskID, final ApiCallback _callback @@ -3065,8 +3178,7 @@ private Call getTaskCall( ); } - @SuppressWarnings("rawtypes") - private Call getTaskValidateBeforeCall( + private Object getTaskValidateBeforeCall( String indexName, Integer taskID, final ApiCallback _callback @@ -3097,12 +3209,15 @@ private Call getTaskValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public GetTaskResponse getTask(String indexName, Integer taskID) - throws ApiException { - Call call = getTaskValidateBeforeCall(indexName, taskID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getTask(String indexName, Integer taskID) throws ApiException { + Object req = getTaskValidateBeforeCall(indexName, taskID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3119,7 +3234,7 @@ public Call getTaskAsync( Integer taskID, final ApiCallback _callback ) throws ApiException { - Call call = getTaskValidateBeforeCall(indexName, taskID, _callback); + Call call = (Call) getTaskValidateBeforeCall(indexName, taskID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3129,10 +3244,10 @@ public Call getTaskAsync( * Build call for getTopUserIds * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getTopUserIdsCall(final ApiCallback _callback) + private Object getTopUserIdsCall(final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -3155,8 +3270,7 @@ private Call getTopUserIdsCall(final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getTopUserIdsValidateBeforeCall(final ApiCallback _callback) + private Object getTopUserIdsValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getTopUserIdsCall(_callback); } @@ -3171,11 +3285,15 @@ private Call getTopUserIdsValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public GetTopUserIdsResponse getTopUserIds() throws ApiException { - Call call = getTopUserIdsValidateBeforeCall(null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getTopUserIds() throws ApiException { + Object req = getTopUserIdsValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3191,7 +3309,7 @@ public GetTopUserIdsResponse getTopUserIds() throws ApiException { public Call getTopUserIdsAsync( final ApiCallback _callback ) throws ApiException { - Call call = getTopUserIdsValidateBeforeCall(_callback); + Call call = (Call) getTopUserIdsValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3202,10 +3320,10 @@ public Call getTopUserIdsAsync( * * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call getUserIdCall(String userID, final ApiCallback _callback) + private Object getUserIdCall(String userID, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -3232,8 +3350,7 @@ private Call getUserIdCall(String userID, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call getUserIdValidateBeforeCall( + private Object getUserIdValidateBeforeCall( String userID, final ApiCallback _callback ) throws ApiException { @@ -3258,11 +3375,15 @@ private Call getUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UserId getUserId(String userID) throws ApiException { - Call call = getUserIdValidateBeforeCall(userID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T getUserId(String userID) throws ApiException { + Object req = getUserIdValidateBeforeCall(userID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3280,7 +3401,7 @@ public Call getUserIdAsync( String userID, final ApiCallback _callback ) throws ApiException { - Call call = getUserIdValidateBeforeCall(userID, _callback); + Call call = (Call) getUserIdValidateBeforeCall(userID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3291,10 +3412,10 @@ public Call getUserIdAsync( * * @param getClusters Whether to get clusters or not. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call hasPendingMappingsCall( + private Object hasPendingMappingsCall( Boolean getClusters, final ApiCallback _callback ) throws ApiException { @@ -3323,8 +3444,7 @@ private Call hasPendingMappingsCall( ); } - @SuppressWarnings("rawtypes") - private Call hasPendingMappingsValidateBeforeCall( + private Object hasPendingMappingsValidateBeforeCall( Boolean getClusters, final ApiCallback _callback ) throws ApiException { @@ -3343,12 +3463,15 @@ private Call hasPendingMappingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public CreatedAtResponse hasPendingMappings(Boolean getClusters) - throws ApiException { - Call call = hasPendingMappingsValidateBeforeCall(getClusters, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T hasPendingMappings(Boolean getClusters) throws ApiException { + Object req = hasPendingMappingsValidateBeforeCall(getClusters, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3367,7 +3490,10 @@ public Call hasPendingMappingsAsync( Boolean getClusters, final ApiCallback _callback ) throws ApiException { - Call call = hasPendingMappingsValidateBeforeCall(getClusters, _callback); + Call call = (Call) hasPendingMappingsValidateBeforeCall( + getClusters, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3377,10 +3503,10 @@ public Call hasPendingMappingsAsync( * Build call for listApiKeys * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call listApiKeysCall(final ApiCallback _callback) + private Object listApiKeysCall(final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -3403,8 +3529,7 @@ private Call listApiKeysCall(final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call listApiKeysValidateBeforeCall(final ApiCallback _callback) + private Object listApiKeysValidateBeforeCall(final ApiCallback _callback) throws ApiException { return listApiKeysCall(_callback); } @@ -3416,11 +3541,15 @@ private Call listApiKeysValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public ListApiKeysResponse listApiKeys() throws ApiException { - Call call = listApiKeysValidateBeforeCall(null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T listApiKeys() throws ApiException { + Object req = listApiKeysValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3433,7 +3562,7 @@ public ListApiKeysResponse listApiKeys() throws ApiException { public Call listApiKeysAsync( final ApiCallback _callback ) throws ApiException { - Call call = listApiKeysValidateBeforeCall(_callback); + Call call = (Call) listApiKeysValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3443,10 +3572,10 @@ public Call listApiKeysAsync( * Build call for listClusters * * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call listClustersCall(final ApiCallback _callback) + private Object listClustersCall(final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -3469,8 +3598,7 @@ private Call listClustersCall(final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call listClustersValidateBeforeCall(final ApiCallback _callback) + private Object listClustersValidateBeforeCall(final ApiCallback _callback) throws ApiException { return listClustersCall(_callback); } @@ -3483,11 +3611,15 @@ private Call listClustersValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public ListClustersResponse listClusters() throws ApiException { - Call call = listClustersValidateBeforeCall(null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T listClusters() throws ApiException { + Object req = listClustersValidateBeforeCall(null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3501,7 +3633,7 @@ public ListClustersResponse listClusters() throws ApiException { public Call listClustersAsync( final ApiCallback _callback ) throws ApiException { - Call call = listClustersValidateBeforeCall(_callback); + Call call = (Call) listClustersValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3514,10 +3646,10 @@ public Call listClustersAsync( * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call listIndicesCall(Integer page, final ApiCallback _callback) + private Object listIndicesCall(Integer page, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -3544,8 +3676,7 @@ private Call listIndicesCall(Integer page, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call listIndicesValidateBeforeCall( + private Object listIndicesValidateBeforeCall( Integer page, final ApiCallback _callback ) throws ApiException { @@ -3562,11 +3693,15 @@ private Call listIndicesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public ListIndicesResponse listIndices(Integer page) throws ApiException { - Call call = listIndicesValidateBeforeCall(page, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T listIndices(Integer page) throws ApiException { + Object req = listIndicesValidateBeforeCall(page, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3583,7 +3718,7 @@ public Call listIndicesAsync( Integer page, final ApiCallback _callback ) throws ApiException { - Call call = listIndicesValidateBeforeCall(page, _callback); + Call call = (Call) listIndicesValidateBeforeCall(page, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3597,10 +3732,10 @@ public Call listIndicesAsync( * (optional) * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call listUserIdsCall( + private Object listUserIdsCall( Integer page, Integer hitsPerPage, final ApiCallback _callback @@ -3634,8 +3769,7 @@ private Call listUserIdsCall( ); } - @SuppressWarnings("rawtypes") - private Call listUserIdsValidateBeforeCall( + private Object listUserIdsValidateBeforeCall( Integer page, Integer hitsPerPage, final ApiCallback _callback @@ -3657,12 +3791,16 @@ private Call listUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) + public T listUserIds(Integer page, Integer hitsPerPage) throws ApiException { - Call call = listUserIdsValidateBeforeCall(page, hitsPerPage, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3684,7 +3822,11 @@ public Call listUserIdsAsync( Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { - Call call = listUserIdsValidateBeforeCall(page, hitsPerPage, _callback); + Call call = (Call) listUserIdsValidateBeforeCall( + page, + hitsPerPage, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3695,10 +3837,10 @@ public Call listUserIdsAsync( * * @param batchObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call multipleBatchCall( + private Object multipleBatchCall( BatchObject batchObject, final ApiCallback _callback ) throws ApiException { @@ -3723,8 +3865,7 @@ private Call multipleBatchCall( ); } - @SuppressWarnings("rawtypes") - private Call multipleBatchValidateBeforeCall( + private Object multipleBatchValidateBeforeCall( BatchObject batchObject, final ApiCallback _callback ) throws ApiException { @@ -3747,12 +3888,15 @@ private Call multipleBatchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public MultipleBatchResponse multipleBatch(BatchObject batchObject) - throws ApiException { - Call call = multipleBatchValidateBeforeCall(batchObject, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T multipleBatch(BatchObject batchObject) throws ApiException { + Object req = multipleBatchValidateBeforeCall(batchObject, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3768,7 +3912,7 @@ public Call multipleBatchAsync( BatchObject batchObject, final ApiCallback _callback ) throws ApiException { - Call call = multipleBatchValidateBeforeCall(batchObject, _callback); + Call call = (Call) multipleBatchValidateBeforeCall(batchObject, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3779,10 +3923,10 @@ public Call multipleBatchAsync( * * @param multipleQueriesObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call multipleQueriesCall( + private Object multipleQueriesCall( MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback ) throws ApiException { @@ -3807,8 +3951,7 @@ private Call multipleQueriesCall( ); } - @SuppressWarnings("rawtypes") - private Call multipleQueriesValidateBeforeCall( + private Object multipleQueriesValidateBeforeCall( MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback ) throws ApiException { @@ -3831,13 +3974,16 @@ private Call multipleQueriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public MultipleQueriesResponse multipleQueries( - MultipleQueriesObject multipleQueriesObject - ) throws ApiException { - Call call = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T multipleQueries(MultipleQueriesObject multipleQueriesObject) + throws ApiException { + Object req = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3852,7 +3998,7 @@ public Call multipleQueriesAsync( MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback ) throws ApiException { - Call call = multipleQueriesValidateBeforeCall( + Call call = (Call) multipleQueriesValidateBeforeCall( multipleQueriesObject, _callback ); @@ -3867,10 +4013,10 @@ public Call multipleQueriesAsync( * @param indexName The index in which to perform the request. (required) * @param operationIndexObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call operationIndexCall( + private Object operationIndexCall( String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback @@ -3900,8 +4046,7 @@ private Call operationIndexCall( ); } - @SuppressWarnings("rawtypes") - private Call operationIndexValidateBeforeCall( + private Object operationIndexValidateBeforeCall( String indexName, OperationIndexObject operationIndexObject, final ApiCallback _callback @@ -3933,18 +4078,22 @@ private Call operationIndexValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse operationIndex( + public T operationIndex( String indexName, OperationIndexObject operationIndexObject ) throws ApiException { - Call call = operationIndexValidateBeforeCall( + Object req = operationIndexValidateBeforeCall( indexName, operationIndexObject, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -3961,7 +4110,7 @@ public Call operationIndexAsync( OperationIndexObject operationIndexObject, final ApiCallback _callback ) throws ApiException { - Call call = operationIndexValidateBeforeCall( + Call call = (Call) operationIndexValidateBeforeCall( indexName, operationIndexObject, _callback @@ -3980,10 +4129,10 @@ public Call operationIndexAsync( * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call partialUpdateObjectCall( + private Object partialUpdateObjectCall( String indexName, String objectID, List> oneOfstringbuiltInOperation, @@ -4025,8 +4174,7 @@ private Call partialUpdateObjectCall( ); } - @SuppressWarnings("rawtypes") - private Call partialUpdateObjectValidateBeforeCall( + private Object partialUpdateObjectValidateBeforeCall( String indexName, String objectID, List> oneOfstringbuiltInOperation, @@ -4079,24 +4227,28 @@ private Call partialUpdateObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtWithObjectIdResponse partialUpdateObject( + public T partialUpdateObject( String indexName, String objectID, List> oneOfstringbuiltInOperation, Boolean createIfNotExists ) throws ApiException { - Call call = partialUpdateObjectValidateBeforeCall( + Object req = partialUpdateObjectValidateBeforeCall( indexName, objectID, oneOfstringbuiltInOperation, createIfNotExists, null ); - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4121,7 +4273,7 @@ public Call partialUpdateObjectAsync( Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { - Call call = partialUpdateObjectValidateBeforeCall( + Call call = (Call) partialUpdateObjectValidateBeforeCall( indexName, objectID, oneOfstringbuiltInOperation, @@ -4139,10 +4291,10 @@ public Call partialUpdateObjectAsync( * * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call removeUserIdCall(String userID, final ApiCallback _callback) + private Object removeUserIdCall(String userID, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -4169,8 +4321,7 @@ private Call removeUserIdCall(String userID, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call removeUserIdValidateBeforeCall( + private Object removeUserIdValidateBeforeCall( String userID, final ApiCallback _callback ) throws ApiException { @@ -4193,11 +4344,15 @@ private Call removeUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public RemoveUserIdResponse removeUserId(String userID) throws ApiException { - Call call = removeUserIdValidateBeforeCall(userID, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T removeUserId(String userID) throws ApiException { + Object req = removeUserIdValidateBeforeCall(userID, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4213,7 +4368,7 @@ public Call removeUserIdAsync( String userID, final ApiCallback _callback ) throws ApiException { - Call call = removeUserIdValidateBeforeCall(userID, _callback); + Call call = (Call) removeUserIdValidateBeforeCall(userID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4224,10 +4379,10 @@ public Call removeUserIdAsync( * * @param source The sources to allow. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call replaceSourcesCall( + private Object replaceSourcesCall( List source, final ApiCallback _callback ) throws ApiException { @@ -4252,8 +4407,7 @@ private Call replaceSourcesCall( ); } - @SuppressWarnings("rawtypes") - private Call replaceSourcesValidateBeforeCall( + private Object replaceSourcesValidateBeforeCall( List source, final ApiCallback _callback ) throws ApiException { @@ -4275,12 +4429,15 @@ private Call replaceSourcesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public ReplaceSourceResponse replaceSources(List source) - throws ApiException { - Call call = replaceSourcesValidateBeforeCall(source, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T replaceSources(List source) throws ApiException { + Object req = replaceSourcesValidateBeforeCall(source, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4295,7 +4452,7 @@ public Call replaceSourcesAsync( List source, final ApiCallback _callback ) throws ApiException { - Call call = replaceSourcesValidateBeforeCall(source, _callback); + Call call = (Call) replaceSourcesValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4306,10 +4463,10 @@ public Call replaceSourcesAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call restoreApiKeyCall(String key, final ApiCallback _callback) + private Object restoreApiKeyCall(String key, final ApiCallback _callback) throws ApiException { Object bodyObj = null; @@ -4336,8 +4493,7 @@ private Call restoreApiKeyCall(String key, final ApiCallback _callback) ); } - @SuppressWarnings("rawtypes") - private Call restoreApiKeyValidateBeforeCall( + private Object restoreApiKeyValidateBeforeCall( String key, final ApiCallback _callback ) throws ApiException { @@ -4359,11 +4515,15 @@ private Call restoreApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public AddApiKeyResponse restoreApiKey(String key) throws ApiException { - Call call = restoreApiKeyValidateBeforeCall(key, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T restoreApiKey(String key) throws ApiException { + Object req = restoreApiKeyValidateBeforeCall(key, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4378,7 +4538,7 @@ public Call restoreApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = restoreApiKeyValidateBeforeCall(key, _callback); + Call call = (Call) restoreApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4390,10 +4550,10 @@ public Call restoreApiKeyAsync( * @param indexName The index in which to perform the request. (required) * @param body The Algolia object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call saveObjectCall( + private Object saveObjectCall( String indexName, Object body, final ApiCallback _callback @@ -4423,8 +4583,7 @@ private Call saveObjectCall( ); } - @SuppressWarnings("rawtypes") - private Call saveObjectValidateBeforeCall( + private Object saveObjectValidateBeforeCall( String indexName, Object body, final ApiCallback _callback @@ -4455,12 +4614,15 @@ private Call saveObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SaveObjectResponse saveObject(String indexName, Object body) - throws ApiException { - Call call = saveObjectValidateBeforeCall(indexName, body, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T saveObject(String indexName, Object body) throws ApiException { + Object req = saveObjectValidateBeforeCall(indexName, body, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4477,7 +4639,7 @@ public Call saveObjectAsync( Object body, final ApiCallback _callback ) throws ApiException { - Call call = saveObjectValidateBeforeCall(indexName, body, _callback); + Call call = (Call) saveObjectValidateBeforeCall(indexName, body, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4492,10 +4654,10 @@ public Call saveObjectAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call saveRuleCall( + private Object saveRuleCall( String indexName, String objectID, Rule rule, @@ -4537,8 +4699,7 @@ private Call saveRuleCall( ); } - @SuppressWarnings("rawtypes") - private Call saveRuleValidateBeforeCall( + private Object saveRuleValidateBeforeCall( String indexName, String objectID, Rule rule, @@ -4587,22 +4748,26 @@ private Call saveRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedRuleResponse saveRule( + public T saveRule( String indexName, String objectID, Rule rule, Boolean forwardToReplicas ) throws ApiException { - Call call = saveRuleValidateBeforeCall( + Object req = saveRuleValidateBeforeCall( indexName, objectID, rule, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4624,7 +4789,7 @@ public Call saveRuleAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = saveRuleValidateBeforeCall( + Call call = (Call) saveRuleValidateBeforeCall( indexName, objectID, rule, @@ -4645,10 +4810,10 @@ public Call saveRuleAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call saveSynonymCall( + private Object saveSynonymCall( String indexName, String objectID, SynonymHit synonymHit, @@ -4690,8 +4855,7 @@ private Call saveSynonymCall( ); } - @SuppressWarnings("rawtypes") - private Call saveSynonymValidateBeforeCall( + private Object saveSynonymValidateBeforeCall( String indexName, String objectID, SynonymHit synonymHit, @@ -4740,22 +4904,26 @@ private Call saveSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SaveSynonymResponse saveSynonym( + public T saveSynonym( String indexName, String objectID, SynonymHit synonymHit, Boolean forwardToReplicas ) throws ApiException { - Call call = saveSynonymValidateBeforeCall( + Object req = saveSynonymValidateBeforeCall( indexName, objectID, synonymHit, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4778,7 +4946,7 @@ public Call saveSynonymAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = saveSynonymValidateBeforeCall( + Call call = (Call) saveSynonymValidateBeforeCall( indexName, objectID, synonymHit, @@ -4800,10 +4968,10 @@ public Call saveSynonymAsync( * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this * request. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call saveSynonymsCall( + private Object saveSynonymsCall( String indexName, List synonymHit, Boolean forwardToReplicas, @@ -4847,8 +5015,7 @@ private Call saveSynonymsCall( ); } - @SuppressWarnings("rawtypes") - private Call saveSynonymsValidateBeforeCall( + private Object saveSynonymsValidateBeforeCall( String indexName, List synonymHit, Boolean forwardToReplicas, @@ -4892,22 +5059,26 @@ private Call saveSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse saveSynonyms( + public T saveSynonyms( String indexName, List synonymHit, Boolean forwardToReplicas, Boolean replaceExistingSynonyms ) throws ApiException { - Call call = saveSynonymsValidateBeforeCall( + Object req = saveSynonymsValidateBeforeCall( indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -4931,7 +5102,7 @@ public Call saveSynonymsAsync( Boolean replaceExistingSynonyms, final ApiCallback _callback ) throws ApiException { - Call call = saveSynonymsValidateBeforeCall( + Call call = (Call) saveSynonymsValidateBeforeCall( indexName, synonymHit, forwardToReplicas, @@ -4949,10 +5120,10 @@ public Call saveSynonymsAsync( * @param indexName The index in which to perform the request. (required) * @param searchParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchCall( + private Object searchCall( String indexName, SearchParams searchParams, final ApiCallback _callback @@ -4982,8 +5153,7 @@ private Call searchCall( ); } - @SuppressWarnings("rawtypes") - private Call searchValidateBeforeCall( + private Object searchValidateBeforeCall( String indexName, SearchParams searchParams, final ApiCallback _callback @@ -5014,12 +5184,16 @@ private Call searchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SearchResponse search(String indexName, SearchParams searchParams) + public T search(String indexName, SearchParams searchParams) throws ApiException { - Call call = searchValidateBeforeCall(indexName, searchParams, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + Object req = searchValidateBeforeCall(indexName, searchParams, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5036,7 +5210,11 @@ public Call searchAsync( SearchParams searchParams, final ApiCallback _callback ) throws ApiException { - Call call = searchValidateBeforeCall(indexName, searchParams, _callback); + Call call = (Call) searchValidateBeforeCall( + indexName, + searchParams, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -5048,10 +5226,10 @@ public Call searchAsync( * @param dictionaryName The dictionary to search in. (required) * @param searchDictionaryEntries (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchDictionaryEntriesCall( + private Object searchDictionaryEntriesCall( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries, final ApiCallback _callback @@ -5081,8 +5259,7 @@ private Call searchDictionaryEntriesCall( ); } - @SuppressWarnings("rawtypes") - private Call searchDictionaryEntriesValidateBeforeCall( + private Object searchDictionaryEntriesValidateBeforeCall( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries, final ApiCallback _callback @@ -5119,18 +5296,22 @@ private Call searchDictionaryEntriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse searchDictionaryEntries( + public T searchDictionaryEntries( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries ) throws ApiException { - Call call = searchDictionaryEntriesValidateBeforeCall( + Object req = searchDictionaryEntriesValidateBeforeCall( dictionaryName, searchDictionaryEntries, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5147,7 +5328,7 @@ public Call searchDictionaryEntriesAsync( SearchDictionaryEntries searchDictionaryEntries, final ApiCallback _callback ) throws ApiException { - Call call = searchDictionaryEntriesValidateBeforeCall( + Call call = (Call) searchDictionaryEntriesValidateBeforeCall( dictionaryName, searchDictionaryEntries, _callback @@ -5164,10 +5345,10 @@ public Call searchDictionaryEntriesAsync( * @param facetName The facet name. (required) * @param searchForFacetValuesRequest (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchForFacetValuesCall( + private Object searchForFacetValuesCall( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest, @@ -5202,8 +5383,7 @@ private Call searchForFacetValuesCall( ); } - @SuppressWarnings("rawtypes") - private Call searchForFacetValuesValidateBeforeCall( + private Object searchForFacetValuesValidateBeforeCall( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest, @@ -5242,22 +5422,26 @@ private Call searchForFacetValuesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SearchForFacetValuesResponse searchForFacetValues( + public T searchForFacetValues( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest ) throws ApiException { - Call call = searchForFacetValuesValidateBeforeCall( + Object req = searchForFacetValuesValidateBeforeCall( indexName, facetName, searchForFacetValuesRequest, null ); - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5277,7 +5461,7 @@ public Call searchForFacetValuesAsync( SearchForFacetValuesRequest searchForFacetValuesRequest, final ApiCallback _callback ) throws ApiException { - Call call = searchForFacetValuesValidateBeforeCall( + Call call = (Call) searchForFacetValuesValidateBeforeCall( indexName, facetName, searchForFacetValuesRequest, @@ -5295,10 +5479,10 @@ public Call searchForFacetValuesAsync( * @param indexName The index in which to perform the request. (required) * @param searchRulesParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchRulesCall( + private Object searchRulesCall( String indexName, SearchRulesParams searchRulesParams, final ApiCallback _callback @@ -5328,8 +5512,7 @@ private Call searchRulesCall( ); } - @SuppressWarnings("rawtypes") - private Call searchRulesValidateBeforeCall( + private Object searchRulesValidateBeforeCall( String indexName, SearchRulesParams searchRulesParams, final ApiCallback _callback @@ -5360,18 +5543,22 @@ private Call searchRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SearchRulesResponse searchRules( + public T searchRules( String indexName, SearchRulesParams searchRulesParams ) throws ApiException { - Call call = searchRulesValidateBeforeCall( + Object req = searchRulesValidateBeforeCall( indexName, searchRulesParams, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5388,7 +5575,7 @@ public Call searchRulesAsync( SearchRulesParams searchRulesParams, final ApiCallback _callback ) throws ApiException { - Call call = searchRulesValidateBeforeCall( + Call call = (Call) searchRulesValidateBeforeCall( indexName, searchRulesParams, _callback @@ -5409,10 +5596,10 @@ public Call searchRulesAsync( * (optional, default to 0) * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchSynonymsCall( + private Object searchSynonymsCall( String indexName, String query, String type, @@ -5461,8 +5648,7 @@ private Call searchSynonymsCall( ); } - @SuppressWarnings("rawtypes") - private Call searchSynonymsValidateBeforeCall( + private Object searchSynonymsValidateBeforeCall( String indexName, String query, String type, @@ -5501,14 +5687,14 @@ private Call searchSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SearchSynonymsResponse searchSynonyms( + public T searchSynonyms( String indexName, String query, String type, Integer page, Integer hitsPerPage ) throws ApiException { - Call call = searchSynonymsValidateBeforeCall( + Object req = searchSynonymsValidateBeforeCall( indexName, query, type, @@ -5516,9 +5702,13 @@ public SearchSynonymsResponse searchSynonyms( hitsPerPage, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5543,7 +5733,7 @@ public Call searchSynonymsAsync( Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { - Call call = searchSynonymsValidateBeforeCall( + Call call = (Call) searchSynonymsValidateBeforeCall( indexName, query, type, @@ -5561,10 +5751,10 @@ public Call searchSynonymsAsync( * * @param searchUserIdsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call searchUserIdsCall( + private Object searchUserIdsCall( SearchUserIdsObject searchUserIdsObject, final ApiCallback _callback ) throws ApiException { @@ -5589,8 +5779,7 @@ private Call searchUserIdsCall( ); } - @SuppressWarnings("rawtypes") - private Call searchUserIdsValidateBeforeCall( + private Object searchUserIdsValidateBeforeCall( SearchUserIdsObject searchUserIdsObject, final ApiCallback _callback ) throws ApiException { @@ -5618,13 +5807,16 @@ private Call searchUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public SearchUserIdsResponse searchUserIds( - SearchUserIdsObject searchUserIdsObject - ) throws ApiException { - Call call = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T searchUserIds(SearchUserIdsObject searchUserIdsObject) + throws ApiException { + Object req = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5645,7 +5837,10 @@ public Call searchUserIdsAsync( SearchUserIdsObject searchUserIdsObject, final ApiCallback _callback ) throws ApiException { - Call call = searchUserIdsValidateBeforeCall(searchUserIdsObject, _callback); + Call call = (Call) searchUserIdsValidateBeforeCall( + searchUserIdsObject, + _callback + ); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -5656,10 +5851,10 @@ public Call searchUserIdsAsync( * * @param dictionarySettingsRequest (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call setDictionarySettingsCall( + private Object setDictionarySettingsCall( DictionarySettingsRequest dictionarySettingsRequest, final ApiCallback _callback ) throws ApiException { @@ -5684,8 +5879,7 @@ private Call setDictionarySettingsCall( ); } - @SuppressWarnings("rawtypes") - private Call setDictionarySettingsValidateBeforeCall( + private Object setDictionarySettingsValidateBeforeCall( DictionarySettingsRequest dictionarySettingsRequest, final ApiCallback _callback ) throws ApiException { @@ -5708,16 +5902,20 @@ private Call setDictionarySettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse setDictionarySettings( + public T setDictionarySettings( DictionarySettingsRequest dictionarySettingsRequest ) throws ApiException { - Call call = setDictionarySettingsValidateBeforeCall( + Object req = setDictionarySettingsValidateBeforeCall( dictionarySettingsRequest, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5732,7 +5930,7 @@ public Call setDictionarySettingsAsync( DictionarySettingsRequest dictionarySettingsRequest, final ApiCallback _callback ) throws ApiException { - Call call = setDictionarySettingsValidateBeforeCall( + Call call = (Call) setDictionarySettingsValidateBeforeCall( dictionarySettingsRequest, _callback ); @@ -5749,10 +5947,10 @@ public Call setDictionarySettingsAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call setSettingsCall( + private Object setSettingsCall( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, @@ -5789,8 +5987,7 @@ private Call setSettingsCall( ); } - @SuppressWarnings("rawtypes") - private Call setSettingsValidateBeforeCall( + private Object setSettingsValidateBeforeCall( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, @@ -5830,20 +6027,24 @@ private Call setSettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdatedAtResponse setSettings( + public T setSettings( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas ) throws ApiException { - Call call = setSettingsValidateBeforeCall( + Object req = setSettingsValidateBeforeCall( indexName, indexSettings, forwardToReplicas, null ); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5865,7 +6066,7 @@ public Call setSettingsAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = setSettingsValidateBeforeCall( + Call call = (Call) setSettingsValidateBeforeCall( indexName, indexSettings, forwardToReplicas, @@ -5882,10 +6083,10 @@ public Call setSettingsAsync( * @param key API Key string. (required) * @param apiKey (required) * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object */ - private Call updateApiKeyCall( + private Object updateApiKeyCall( String key, ApiKey apiKey, final ApiCallback _callback @@ -5915,8 +6116,7 @@ private Call updateApiKeyCall( ); } - @SuppressWarnings("rawtypes") - private Call updateApiKeyValidateBeforeCall( + private Object updateApiKeyValidateBeforeCall( String key, ApiKey apiKey, final ApiCallback _callback @@ -5947,12 +6147,15 @@ private Call updateApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public UpdateApiKeyResponse updateApiKey(String key, ApiKey apiKey) - throws ApiException { - Call call = updateApiKeyValidateBeforeCall(key, apiKey, null); - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return res.getData(); + public T updateApiKey(String key, ApiKey apiKey) throws ApiException { + Object req = updateApiKeyValidateBeforeCall(key, apiKey, null); + if (req instanceof Call) { + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return (T) res.getData(); + } + return (T) req; } /** @@ -5969,7 +6172,7 @@ public Call updateApiKeyAsync( ApiKey apiKey, final ApiCallback _callback ) throws ApiException { - Call call = updateApiKeyValidateBeforeCall(key, apiKey, _callback); + Call call = (Call) updateApiKeyValidateBeforeCall(key, apiKey, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java new file mode 100644 index 0000000000..f9a62971ad --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java @@ -0,0 +1,33 @@ +package com.algolia.utils; + +import com.algolia.ApiException; +import okhttp3.Request; + +public class EchoRequester implements Requester { + + public Object newCall(Request request) throws ApiException { + return request; + } + + // NO-OP for now + + public void setDebugging(boolean debugging) {} + + public int getConnectTimeout() { + return 100; + } + + public void setConnectTimeout(int connectionTimeout) {} + + public int getReadTimeout() { + return 100; + } + + public void setReadTimeout(int readTimeout) {} + + public int getWriteTimeout() { + return 100; + } + + public void setWriteTimeout(int writeTimeout) {} +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java new file mode 100644 index 0000000000..25a8d29fed --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java @@ -0,0 +1,106 @@ +package com.algolia.utils; + +import com.algolia.ApiCallback; +import com.algolia.ApiException; +import com.algolia.ProgressResponseBody; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; + +public class HttpRequester implements Requester { + + private OkHttpClient httpClient; + private HttpLoggingInterceptor loggingInterceptor; + private boolean debugging; + + public HttpRequester() { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + + httpClient = builder.build(); + } + + public Object newCall(Request request) throws ApiException { + return httpClient.newCall(request); + } + + public void 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; + } + + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + public void setConnectTimeout(int connectionTimeout) { + httpClient = + httpClient + .newBuilder() + .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + public void setReadTimeout(int readTimeout) { + httpClient = + httpClient + .newBuilder() + .readTimeout(readTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + public void setWriteTimeout(int writeTimeout) { + httpClient = + httpClient + .newBuilder() + .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + /** + * 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; + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java new file mode 100644 index 0000000000..65f3ac4c35 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java @@ -0,0 +1,60 @@ +package com.algolia.utils; + +import com.algolia.ApiException; +import okhttp3.Request; + +public interface Requester { + public Object newCall(Request request) throws ApiException; + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + */ + public void setDebugging(boolean debugging); + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout(); + + /** + * 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 + */ + public void setConnectTimeout(int connectionTimeout); + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout(); + + /** + * 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 + */ + public void setReadTimeout(int readTimeout); + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout(); + + /** + * 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 + */ + public void setWriteTimeout(int writeTimeout); +} diff --git a/clients/algoliasearch-client-java-2/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/utils/EchoRequester.java new file mode 100644 index 0000000000..f9a62971ad --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/EchoRequester.java @@ -0,0 +1,33 @@ +package com.algolia.utils; + +import com.algolia.ApiException; +import okhttp3.Request; + +public class EchoRequester implements Requester { + + public Object newCall(Request request) throws ApiException { + return request; + } + + // NO-OP for now + + public void setDebugging(boolean debugging) {} + + public int getConnectTimeout() { + return 100; + } + + public void setConnectTimeout(int connectionTimeout) {} + + public int getReadTimeout() { + return 100; + } + + public void setReadTimeout(int readTimeout) {} + + public int getWriteTimeout() { + return 100; + } + + public void setWriteTimeout(int writeTimeout) {} +} diff --git a/clients/algoliasearch-client-java-2/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/utils/HttpRequester.java new file mode 100644 index 0000000000..25a8d29fed --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/HttpRequester.java @@ -0,0 +1,106 @@ +package com.algolia.utils; + +import com.algolia.ApiCallback; +import com.algolia.ApiException; +import com.algolia.ProgressResponseBody; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; + +public class HttpRequester implements Requester { + + private OkHttpClient httpClient; + private HttpLoggingInterceptor loggingInterceptor; + private boolean debugging; + + public HttpRequester() { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + + httpClient = builder.build(); + } + + public Object newCall(Request request) throws ApiException { + return httpClient.newCall(request); + } + + public void 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; + } + + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + public void setConnectTimeout(int connectionTimeout) { + httpClient = + httpClient + .newBuilder() + .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + public void setReadTimeout(int readTimeout) { + httpClient = + httpClient + .newBuilder() + .readTimeout(readTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + public void setWriteTimeout(int writeTimeout) { + httpClient = + httpClient + .newBuilder() + .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) + .build(); + } + + /** + * 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; + } + }; + } +} diff --git a/clients/algoliasearch-client-java-2/utils/Requester.java b/clients/algoliasearch-client-java-2/utils/Requester.java new file mode 100644 index 0000000000..65f3ac4c35 --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/Requester.java @@ -0,0 +1,60 @@ +package com.algolia.utils; + +import com.algolia.ApiException; +import okhttp3.Request; + +public interface Requester { + public Object newCall(Request request) throws ApiException; + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + */ + public void setDebugging(boolean debugging); + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout(); + + /** + * 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 + */ + public void setConnectTimeout(int connectionTimeout); + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout(); + + /** + * 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 + */ + public void setReadTimeout(int readTimeout); + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout(); + + /** + * 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 + */ + public void setWriteTimeout(int writeTimeout); +} diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh index 5d3c52664b..6e72096941 100755 --- a/scripts/post-gen/java.sh +++ b/scripts/post-gen/java.sh @@ -15,6 +15,8 @@ find "$CLIENT" -type f -name "*.java" | xargs sed -i -e 's~= {}~= new Object()~g echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfintegerstring.java echo "package com.algolia.model;public class OneOfstringbuiltInOperation {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java +cp -R clients/algoliasearch-client-java-2/utils/ $CLIENT/algoliasearch-core/com/algolia/ + format_client() { echo "> Formatting $GENERATOR..." @@ -34,7 +36,7 @@ format_client() { --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ -jar dist/$javaFormatter -r - CMD="yarn prettier --write $CLIENT/**/*.java" + CMD="yarn prettier --write $CLIENT" if [[ $VERBOSE == "true" ]]; then $CMD else diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index e729d7161e..36bbd89612 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -1,5 +1,7 @@ package {{invokerPackage}}; +import com.algolia.utils.Requester; + import okhttp3.*; import okhttp3.internal.http.HttpMethod; import okhttp3.logging.HttpLoggingInterceptor; @@ -30,36 +32,21 @@ public class ApiClient { private DateFormat dateFormat; - private OkHttpClient httpClient; private JSON json; - private HttpLoggingInterceptor loggingInterceptor; + private Requester requester; /* - * Basic constructor for ApiClient + * Constructor for ApiClient with custom Requester */ - public ApiClient(String appId, String apiKey) { + public ApiClient(String appId, String apiKey, Requester requester) { json = new JSON(); setUserAgent("{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - initHttpClient(); this.basePath = "https://" + appId + "-1.algolianet.com"; this.appId = appId; this.apiKey = apiKey; - } - - private void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - private void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor: interceptors) { - builder.addInterceptor(interceptor); - } - - httpClient = builder.build(); + this.requester = requester; } /** @@ -135,19 +122,7 @@ public class ApiClient { * @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; + requester.setDebugging(debugging); return this; } @@ -157,7 +132,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); + return requester.getConnectTimeout(); } /** @@ -169,7 +144,7 @@ public class ApiClient { * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + requester.setConnectTimeout(connectionTimeout); return this; } @@ -179,7 +154,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getReadTimeout() { - return httpClient.readTimeoutMillis(); + return requester.getReadTimeout(); } /** @@ -191,7 +166,7 @@ public class ApiClient { * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + requester.setReadTimeout(readTimeout); return this; } @@ -201,7 +176,7 @@ public class ApiClient { * @return Timeout in milliseconds */ public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); + return requester.getWriteTimeout(); } /** @@ -213,7 +188,7 @@ public class ApiClient { * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + requester.setWriteTimeout(writeTimeout); return this; } @@ -605,13 +580,13 @@ public class ApiClient { * @param body The request body object * @param headerParams The header parameters * @param callback Callback for upload/download progress - * @return The HTTP call + * @return The HTTP call or EchoRequester * @throws ApiException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws ApiException { + public Object buildCall(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, body, headerParams, callback); - return httpClient.newCall(request); + return requester.newCall(request); } /** @@ -732,25 +707,4 @@ public class ApiClient { } return formBuilder.build(); } - - /** - * 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; - } - }; - } } diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index dfac1c987a..5c6fadc18d 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -10,6 +10,8 @@ import com.google.gson.reflect.TypeToken; import okhttp3.Call; +import com.algolia.utils.*; + {{#imports}}import {{import}}; {{/imports}} @@ -24,7 +26,11 @@ import java.util.Map; {{#operations}} public class {{classname}} extends ApiClient { public {{classname}}(String appId, String apiKey) { - super(appId, apiKey); + super(appId, apiKey, new HttpRequester()); + } + + public {{classname}}(String appId, String apiKey, Requester requester) { + super(appId, apiKey, requester); } {{#operation}} @@ -32,7 +38,7 @@ public class {{classname}} extends ApiClient { * Build call for {{operationId}}{{#allParams}} * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param _callback Callback for upload/download progress - * @return Call to execute + * @return Call to execute or EchoRequest * @throws ApiException If fail to serialize the request body object {{#isDeprecated}} * @deprecated @@ -45,7 +51,7 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + private Object {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { Object bodyObj = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; // create path and map variables @@ -76,8 +82,7 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - @SuppressWarnings("rawtypes") - private Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + private Object {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { @@ -104,11 +109,15 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - Call call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); - ApiResponse<{{{.}}}> res = this.execute(call, returnType); - return res.getData();{{/returnType}}{{^returnType}}return this.execute(call).getData();{{/returnType}} + public {{#returnType}} T {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + Object req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + if(req instanceof Call) { + Call call = (Call)req; + {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); + ApiResponse<{{{.}}}> res = this.execute(call, returnType); + return (T)res.getData();{{/returnType}}{{^returnType}}this.execute(call).getData();{{/returnType}} + } + {{#returnType}}return (T)req;{{/returnType}} } /** * (asynchronously) @@ -129,7 +138,7 @@ public class {{classname}} extends ApiClient { @Deprecated {{/isDeprecated}} public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - Call call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + Call call = (Call){{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); {{#returnType}}Type returnType = new TypeToken<{{{returnType}}}>(){}.getType(); this.executeAsync(call, returnType, _callback);{{/returnType}}{{^returnType}}this.executeAsync(call, _callback);{{/returnType}} return call; diff --git a/tests/output/java/tests/searchRequests.java b/tests/output/java/tests/searchRequests.java deleted file mode 100644 index e69de29bb2..0000000000 From 1983bfbffbaf308f9d839e24616786944aeee560 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 18 Jan 2022 10:05:33 +0100 Subject: [PATCH 2/7] remove java readme --- .../.openapi-generator-ignore | 1 + clients/algoliasearch-client-java-2/README.md | 70 ------------------ .../libraries/okhttp-gson/README.mustache | 72 ------------------- 3 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/README.md delete mode 100644 templates/java/libraries/okhttp-gson/README.mustache diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore index dd94f3e8b5..913185fd6c 100644 --- a/clients/algoliasearch-client-java-2/.openapi-generator-ignore +++ b/clients/algoliasearch-client-java-2/.openapi-generator-ignore @@ -8,6 +8,7 @@ api/** docs/** gradle/** src/** +README.md .travis.yml build.gradle diff --git a/clients/algoliasearch-client-java-2/README.md b/clients/algoliasearch-client-java-2/README.md deleted file mode 100644 index 522fb9b453..0000000000 --- a/clients/algoliasearch-client-java-2/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# algoliasearch-client-java-2 - -Search API - -- API version: 0.1.0 - -API powering the Search feature of Algolia. - -_Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)_ - -## Requirements - -Building the API client library requires: - -1. Java 1.8+ -2. Maven/Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - com.algolia - algoliasearch-client-java-2 - 0.1.0 - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy -compile "com.algolia:algoliasearch-client-java-2:0.1.0" -``` - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -- `target/algoliasearch-client-java-2-0.1.0.jar` -- `target/lib/*.jar` - -## Getting Started - -Checkout the playground. diff --git a/templates/java/libraries/okhttp-gson/README.mustache b/templates/java/libraries/okhttp-gson/README.mustache deleted file mode 100644 index f3620a9cd3..0000000000 --- a/templates/java/libraries/okhttp-gson/README.mustache +++ /dev/null @@ -1,72 +0,0 @@ -# {{artifactId}} - -{{appName}} -- API version: {{appVersion}} - -{{{appDescriptionWithNewLines}}} -{{#infoUrl}} - - For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) -{{/infoUrl}} - -*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* - -## Requirements - -Building the API client library requires: -1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ -2. Maven/Gradle - -## Installation - -To install the API client library to your local Maven repository, simply execute: - -```shell -mvn clean install -``` - -To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: - -```shell -mvn clean deploy -``` - -Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. - -### Maven users - -Add this dependency to your project's POM: - -```xml - - {{{groupId}}} - {{{artifactId}}} - {{{artifactVersion}}} - compile - -``` - -### Gradle users - -Add this dependency to your project's build file: - -```groovy -compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" -``` - -### Others - -At first generate the JAR by executing: - -```shell -mvn clean package -``` - -Then manually install the following JARs: - -* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar` -* `target/lib/*.jar` - -## Getting Started - -Checkout the playground. From 9631eafde84f27f796e89d57562513500b438a0a Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 18 Jan 2022 16:06:30 +0100 Subject: [PATCH 3/7] extends the supposed return type --- Dockerfile | 1 + .../com/algolia/ApiClient.java | 4 +- .../com/algolia/search/SearchApi.java | 1778 ++++++++--------- .../com/algolia/utils/CallEcho.java | 57 + .../com/algolia/utils/EchoRequester.java | 4 +- .../com/algolia/utils/HttpRequester.java | 3 +- .../com/algolia/utils/Requester.java | 3 +- .../utils/echoResponse/AddApiKeyEcho.java | 17 + .../echoResponse/AddOrUpdateObjectEcho.java | 19 + .../utils/echoResponse/AppendSourceEcho.java | 19 + .../utils/echoResponse/AssignUserIdEcho.java | 19 + .../echoResponse/BatchAssignUserIdsEcho.java | 19 + .../BatchDictionaryEntriesEcho.java | 19 + .../algolia/utils/echoResponse/BatchEcho.java | 17 + .../utils/echoResponse/BatchRulesEcho.java | 17 + .../utils/echoResponse/BrowseEcho.java | 17 + .../echoResponse/ClearAllSynonymsEcho.java | 19 + .../utils/echoResponse/ClearObjectsEcho.java | 19 + .../utils/echoResponse/ClearRulesEcho.java | 17 + .../utils/echoResponse/DeleteApiKeyEcho.java | 19 + .../utils/echoResponse/DeleteByEcho.java | 17 + .../utils/echoResponse/DeleteIndexEcho.java | 17 + .../utils/echoResponse/DeleteObjectEcho.java | 19 + .../utils/echoResponse/DeleteRuleEcho.java | 17 + .../utils/echoResponse/DeleteSourceEcho.java | 19 + .../utils/echoResponse/DeleteSynonymEcho.java | 19 + .../utils/echoResponse/EchoResponse.java | 5 + .../utils/echoResponse/GetApiKeyEcho.java | 17 + .../GetDictionaryLanguagesEcho.java | 20 + .../GetDictionarySettingsEcho.java | 19 + .../utils/echoResponse/GetLogsEcho.java | 17 + .../utils/echoResponse/GetObjectEcho.java | 20 + .../utils/echoResponse/GetObjectsEcho.java | 17 + .../utils/echoResponse/GetRuleEcho.java | 17 + .../utils/echoResponse/GetSettingsEcho.java | 17 + .../utils/echoResponse/GetSourcesEcho.java | 18 + .../utils/echoResponse/GetSynonymEcho.java | 17 + .../utils/echoResponse/GetTaskEcho.java | 17 + .../utils/echoResponse/GetTopUserIdsEcho.java | 19 + .../utils/echoResponse/GetUserIdEcho.java | 17 + .../echoResponse/HasPendingMappingsEcho.java | 19 + .../utils/echoResponse/ListApiKeysEcho.java | 19 + .../utils/echoResponse/ListClustersEcho.java | 19 + .../utils/echoResponse/ListIndicesEcho.java | 19 + .../utils/echoResponse/ListUserIdsEcho.java | 19 + .../utils/echoResponse/MultipleBatchEcho.java | 19 + .../echoResponse/MultipleQueriesEcho.java | 19 + .../echoResponse/OperationIndexEcho.java | 19 + .../echoResponse/PartialUpdateObjectEcho.java | 19 + .../utils/echoResponse/RemoveUserIdEcho.java | 19 + .../echoResponse/ReplaceSourcesEcho.java | 19 + .../utils/echoResponse/RestoreApiKeyEcho.java | 19 + .../utils/echoResponse/SaveObjectEcho.java | 17 + .../utils/echoResponse/SaveRuleEcho.java | 17 + .../utils/echoResponse/SaveSynonymEcho.java | 19 + .../utils/echoResponse/SaveSynonymsEcho.java | 19 + .../SearchDictionaryEntriesEcho.java | 19 + .../utils/echoResponse/SearchEcho.java | 17 + .../SearchForFacetValuesEcho.java | 19 + .../utils/echoResponse/SearchRulesEcho.java | 19 + .../echoResponse/SearchSynonymsEcho.java | 19 + .../utils/echoResponse/SearchUserIdsEcho.java | 19 + .../SetDictionarySettingsEcho.java | 19 + .../utils/echoResponse/SetSettingsEcho.java | 17 + .../utils/echoResponse/UpdateApiKeyEcho.java | 19 + clients/algoliasearch-client-java-2/pom.xml | 16 - .../utils/CallEcho.java | 57 + .../utils/EchoRequester.java | 4 +- .../utils/HttpRequester.java | 3 +- .../utils/Requester.java | 3 +- .../utils/echoResponse/EchoResponse.java | 5 + scripts/post-gen/java.sh | 24 +- .../libraries/okhttp-gson/ApiClient.mustache | 4 +- .../java/libraries/okhttp-gson/api.mustache | 30 +- .../java/libraries/okhttp-gson/pom.mustache | 16 - 75 files changed, 2084 insertions(+), 977 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/utils/CallEcho.java create mode 100644 clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java diff --git a/Dockerfile b/Dockerfile index a624d90565..1e64e9e2cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM node:$NODE_VERSION-alpine ENV DOCKER=true RUN apk add openjdk11 maven jq bash perl curl +ENV JAVA_HOME=/usr/lib/jvm/default-jvm WORKDIR /app diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java index a2db1445f2..fe63fb8313 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/ApiClient.java @@ -610,10 +610,10 @@ public T handleResponse(Response response, Type returnType) * @param body The request body object * @param headerParams The header parameters * @param callback Callback for upload/download progress - * @return The HTTP call or EchoRequester + * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ - public Object buildCall( + public Call buildCall( String path, String method, List queryParams, diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 6a676bfe9a..30a04ef76c 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -5,62 +5,9 @@ import com.algolia.ApiException; import com.algolia.ApiResponse; import com.algolia.Pair; -import com.algolia.model.AddApiKeyResponse; -import com.algolia.model.ApiKey; -import com.algolia.model.AssignUserIdObject; -import com.algolia.model.BatchAssignUserIdsObject; -import com.algolia.model.BatchDictionaryEntries; -import com.algolia.model.BatchObject; -import com.algolia.model.BatchResponse; -import com.algolia.model.BatchWriteObject; -import com.algolia.model.BrowseRequest; -import com.algolia.model.BrowseResponse; -import com.algolia.model.CreatedAtResponse; -import com.algolia.model.DeleteApiKeyResponse; -import com.algolia.model.DeleteSourceResponse; -import com.algolia.model.DeletedAtResponse; -import com.algolia.model.DictionarySettingsRequest; -import com.algolia.model.GetDictionarySettingsResponse; -import com.algolia.model.GetLogsResponse; -import com.algolia.model.GetObjectsObject; -import com.algolia.model.GetObjectsResponse; -import com.algolia.model.GetTaskResponse; -import com.algolia.model.GetTopUserIdsResponse; -import com.algolia.model.IndexSettings; -import com.algolia.model.KeyObject; -import com.algolia.model.Languages; -import com.algolia.model.ListApiKeysResponse; -import com.algolia.model.ListClustersResponse; -import com.algolia.model.ListIndicesResponse; -import com.algolia.model.ListUserIdsResponse; -import com.algolia.model.MultipleBatchResponse; -import com.algolia.model.MultipleQueriesObject; -import com.algolia.model.MultipleQueriesResponse; -import com.algolia.model.OneOfstringbuiltInOperation; -import com.algolia.model.OperationIndexObject; -import com.algolia.model.RemoveUserIdResponse; -import com.algolia.model.ReplaceSourceResponse; -import com.algolia.model.Rule; -import com.algolia.model.SaveObjectResponse; -import com.algolia.model.SaveSynonymResponse; -import com.algolia.model.SearchDictionaryEntries; -import com.algolia.model.SearchForFacetValuesRequest; -import com.algolia.model.SearchForFacetValuesResponse; -import com.algolia.model.SearchParams; -import com.algolia.model.SearchResponse; -import com.algolia.model.SearchRulesParams; -import com.algolia.model.SearchRulesResponse; -import com.algolia.model.SearchSynonymsResponse; -import com.algolia.model.SearchUserIdsObject; -import com.algolia.model.SearchUserIdsResponse; -import com.algolia.model.Source; -import com.algolia.model.SynonymHit; -import com.algolia.model.UpdateApiKeyResponse; -import com.algolia.model.UpdatedAtResponse; -import com.algolia.model.UpdatedAtWithObjectIdResponse; -import com.algolia.model.UpdatedRuleResponse; -import com.algolia.model.UserId; +import com.algolia.model.*; import com.algolia.utils.*; +import com.algolia.utils.echoResponse.*; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; @@ -84,11 +31,13 @@ public SearchApi(String appId, String apiKey, Requester requester) { * * @param apiKey (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object addApiKeyCall(ApiKey apiKey, final ApiCallback _callback) - throws ApiException { + private Call addApiKeyCall( + ApiKey apiKey, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = apiKey; // create path and map variables @@ -110,9 +59,9 @@ private Object addApiKeyCall(ApiKey apiKey, final ApiCallback _callback) ); } - private Object addApiKeyValidateBeforeCall( + private Call addApiKeyValidateBeforeCall( ApiKey apiKey, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'apiKey' is set if (apiKey == null) { @@ -132,15 +81,15 @@ private Object addApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T addApiKey(ApiKey apiKey) throws ApiException { - Object req = addApiKeyValidateBeforeCall(apiKey, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public AddApiKeyResponse addApiKey(ApiKey apiKey) throws ApiException { + Call req = addApiKeyValidateBeforeCall(apiKey, null); + if (req instanceof CallEcho) { + return new AddApiKeyEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -155,7 +104,7 @@ public Call addApiKeyAsync( ApiKey apiKey, final ApiCallback _callback ) throws ApiException { - Call call = (Call) addApiKeyValidateBeforeCall(apiKey, _callback); + Call call = addApiKeyValidateBeforeCall(apiKey, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -168,14 +117,14 @@ public Call addApiKeyAsync( * @param objectID Unique identifier of an object. (required) * @param body The Algolia object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object addOrUpdateObjectCall( + private Call addOrUpdateObjectCall( String indexName, String objectID, Object body, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = body; @@ -206,11 +155,11 @@ private Object addOrUpdateObjectCall( ); } - private Object addOrUpdateObjectValidateBeforeCall( + private Call addOrUpdateObjectValidateBeforeCall( String indexName, String objectID, Object body, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -247,26 +196,26 @@ private Object addOrUpdateObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T addOrUpdateObject( + public UpdatedAtWithObjectIdResponse addOrUpdateObject( String indexName, String objectID, Object body ) throws ApiException { - Object req = addOrUpdateObjectValidateBeforeCall( + Call req = addOrUpdateObjectValidateBeforeCall( indexName, objectID, body, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new AddOrUpdateObjectEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return res.getData(); } /** @@ -286,7 +235,7 @@ public Call addOrUpdateObjectAsync( Object body, final ApiCallback _callback ) throws ApiException { - Call call = (Call) addOrUpdateObjectValidateBeforeCall( + Call call = addOrUpdateObjectValidateBeforeCall( indexName, objectID, body, @@ -303,11 +252,13 @@ public Call addOrUpdateObjectAsync( * * @param source The source to add. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object appendSourceCall(Source source, final ApiCallback _callback) - throws ApiException { + private Call appendSourceCall( + Source source, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = source; // create path and map variables @@ -329,9 +280,9 @@ private Object appendSourceCall(Source source, final ApiCallback _callback) ); } - private Object appendSourceValidateBeforeCall( + private Call appendSourceValidateBeforeCall( Source source, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'source' is set if (source == null) { @@ -351,15 +302,15 @@ private Object appendSourceValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T appendSource(Source source) throws ApiException { - Object req = appendSourceValidateBeforeCall(source, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public CreatedAtResponse appendSource(Source source) throws ApiException { + Call req = appendSourceValidateBeforeCall(source, null); + if (req instanceof CallEcho) { + return new AppendSourceEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -374,7 +325,7 @@ public Call appendSourceAsync( Source source, final ApiCallback _callback ) throws ApiException { - Call call = (Call) appendSourceValidateBeforeCall(source, _callback); + Call call = appendSourceValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -386,13 +337,13 @@ public Call appendSourceAsync( * @param xAlgoliaUserID userID to assign. (required) * @param assignUserIdObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object assignUserIdCall( + private Call assignUserIdCall( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = assignUserIdObject; @@ -421,10 +372,10 @@ private Object assignUserIdCall( ); } - private Object assignUserIdValidateBeforeCall( + private Call assignUserIdValidateBeforeCall( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'xAlgoliaUserID' is set if (xAlgoliaUserID == null) { @@ -455,22 +406,22 @@ private Object assignUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T assignUserId( + public CreatedAtResponse assignUserId( String xAlgoliaUserID, AssignUserIdObject assignUserIdObject ) throws ApiException { - Object req = assignUserIdValidateBeforeCall( + Call req = assignUserIdValidateBeforeCall( xAlgoliaUserID, assignUserIdObject, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new AssignUserIdEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -490,7 +441,7 @@ public Call assignUserIdAsync( AssignUserIdObject assignUserIdObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) assignUserIdValidateBeforeCall( + Call call = assignUserIdValidateBeforeCall( xAlgoliaUserID, assignUserIdObject, _callback @@ -506,13 +457,13 @@ public Call assignUserIdAsync( * @param indexName The index in which to perform the request. (required) * @param batchWriteObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object batchCall( + private Call batchCall( String indexName, BatchWriteObject batchWriteObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = batchWriteObject; @@ -539,10 +490,10 @@ private Object batchCall( ); } - private Object batchValidateBeforeCall( + private Call batchValidateBeforeCall( String indexName, BatchWriteObject batchWriteObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -570,16 +521,18 @@ private Object batchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T batch(String indexName, BatchWriteObject batchWriteObject) - throws ApiException { - Object req = batchValidateBeforeCall(indexName, batchWriteObject, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public BatchResponse batch( + String indexName, + BatchWriteObject batchWriteObject + ) throws ApiException { + Call req = batchValidateBeforeCall(indexName, batchWriteObject, null); + if (req instanceof CallEcho) { + return new BatchEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -596,11 +549,7 @@ public Call batchAsync( BatchWriteObject batchWriteObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) batchValidateBeforeCall( - indexName, - batchWriteObject, - _callback - ); + Call call = batchValidateBeforeCall(indexName, batchWriteObject, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -612,13 +561,13 @@ public Call batchAsync( * @param xAlgoliaUserID userID to assign. (required) * @param batchAssignUserIdsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object batchAssignUserIdsCall( + private Call batchAssignUserIdsCall( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = batchAssignUserIdsObject; @@ -647,10 +596,10 @@ private Object batchAssignUserIdsCall( ); } - private Object batchAssignUserIdsValidateBeforeCall( + private Call batchAssignUserIdsValidateBeforeCall( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'xAlgoliaUserID' is set if (xAlgoliaUserID == null) { @@ -685,22 +634,22 @@ private Object batchAssignUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T batchAssignUserIds( + public CreatedAtResponse batchAssignUserIds( String xAlgoliaUserID, BatchAssignUserIdsObject batchAssignUserIdsObject ) throws ApiException { - Object req = batchAssignUserIdsValidateBeforeCall( + Call req = batchAssignUserIdsValidateBeforeCall( xAlgoliaUserID, batchAssignUserIdsObject, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new BatchAssignUserIdsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -719,7 +668,7 @@ public Call batchAssignUserIdsAsync( BatchAssignUserIdsObject batchAssignUserIdsObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) batchAssignUserIdsValidateBeforeCall( + Call call = batchAssignUserIdsValidateBeforeCall( xAlgoliaUserID, batchAssignUserIdsObject, _callback @@ -735,13 +684,13 @@ public Call batchAssignUserIdsAsync( * @param dictionaryName The dictionary to search in. (required) * @param batchDictionaryEntries (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object batchDictionaryEntriesCall( + private Call batchDictionaryEntriesCall( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = batchDictionaryEntries; @@ -768,10 +717,10 @@ private Object batchDictionaryEntriesCall( ); } - private Object batchDictionaryEntriesValidateBeforeCall( + private Call batchDictionaryEntriesValidateBeforeCall( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'dictionaryName' is set if (dictionaryName == null) { @@ -805,22 +754,22 @@ private Object batchDictionaryEntriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T batchDictionaryEntries( + public UpdatedAtResponse batchDictionaryEntries( String dictionaryName, BatchDictionaryEntries batchDictionaryEntries ) throws ApiException { - Object req = batchDictionaryEntriesValidateBeforeCall( + Call req = batchDictionaryEntriesValidateBeforeCall( dictionaryName, batchDictionaryEntries, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new BatchDictionaryEntriesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -837,7 +786,7 @@ public Call batchDictionaryEntriesAsync( BatchDictionaryEntries batchDictionaryEntries, final ApiCallback _callback ) throws ApiException { - Call call = (Call) batchDictionaryEntriesValidateBeforeCall( + Call call = batchDictionaryEntriesValidateBeforeCall( dictionaryName, batchDictionaryEntries, _callback @@ -857,15 +806,15 @@ public Call batchDictionaryEntriesAsync( * @param clearExistingRules When true, existing Rules are cleared before adding this batch. When * false, existing Rules are kept. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object batchRulesCall( + private Call batchRulesCall( String indexName, List rule, Boolean forwardToReplicas, Boolean clearExistingRules, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = rule; @@ -904,12 +853,12 @@ private Object batchRulesCall( ); } - private Object batchRulesValidateBeforeCall( + private Call batchRulesValidateBeforeCall( String indexName, List rule, Boolean forwardToReplicas, Boolean clearExistingRules, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -947,26 +896,26 @@ private Object batchRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T batchRules( + public UpdatedAtResponse batchRules( String indexName, List rule, Boolean forwardToReplicas, Boolean clearExistingRules ) throws ApiException { - Object req = batchRulesValidateBeforeCall( + Call req = batchRulesValidateBeforeCall( indexName, rule, forwardToReplicas, clearExistingRules, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new BatchRulesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -989,7 +938,7 @@ public Call batchRulesAsync( Boolean clearExistingRules, final ApiCallback _callback ) throws ApiException { - Call call = (Call) batchRulesValidateBeforeCall( + Call call = batchRulesValidateBeforeCall( indexName, rule, forwardToReplicas, @@ -1007,13 +956,13 @@ public Call batchRulesAsync( * @param indexName The index in which to perform the request. (required) * @param browseRequest (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object browseCall( + private Call browseCall( String indexName, BrowseRequest browseRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = browseRequest; @@ -1040,10 +989,10 @@ private Object browseCall( ); } - private Object browseValidateBeforeCall( + private Call browseValidateBeforeCall( String indexName, BrowseRequest browseRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1069,16 +1018,16 @@ private Object browseValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T browse(String indexName, BrowseRequest browseRequest) + public BrowseResponse browse(String indexName, BrowseRequest browseRequest) throws ApiException { - Object req = browseValidateBeforeCall(indexName, browseRequest, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = browseValidateBeforeCall(indexName, browseRequest, null); + if (req instanceof CallEcho) { + return new BrowseEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1101,11 +1050,7 @@ public Call browseAsync( BrowseRequest browseRequest, final ApiCallback _callback ) throws ApiException { - Call call = (Call) browseValidateBeforeCall( - indexName, - browseRequest, - _callback - ); + Call call = browseValidateBeforeCall(indexName, browseRequest, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1118,13 +1063,13 @@ public Call browseAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object clearAllSynonymsCall( + private Call clearAllSynonymsCall( String indexName, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -1157,10 +1102,10 @@ private Object clearAllSynonymsCall( ); } - private Object clearAllSynonymsValidateBeforeCall( + private Call clearAllSynonymsValidateBeforeCall( String indexName, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1182,20 +1127,22 @@ private Object clearAllSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T clearAllSynonyms(String indexName, Boolean forwardToReplicas) - throws ApiException { - Object req = clearAllSynonymsValidateBeforeCall( + public UpdatedAtResponse clearAllSynonyms( + String indexName, + Boolean forwardToReplicas + ) throws ApiException { + Call req = clearAllSynonymsValidateBeforeCall( indexName, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new ClearAllSynonymsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1213,7 +1160,7 @@ public Call clearAllSynonymsAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) clearAllSynonymsValidateBeforeCall( + Call call = clearAllSynonymsValidateBeforeCall( indexName, forwardToReplicas, _callback @@ -1228,12 +1175,12 @@ public Call clearAllSynonymsAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object clearObjectsCall( + private Call clearObjectsCall( String indexName, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -1260,9 +1207,9 @@ private Object clearObjectsCall( ); } - private Object clearObjectsValidateBeforeCall( + private Call clearObjectsValidateBeforeCall( String indexName, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1282,15 +1229,15 @@ private Object clearObjectsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T clearObjects(String indexName) throws ApiException { - Object req = clearObjectsValidateBeforeCall(indexName, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public UpdatedAtResponse clearObjects(String indexName) throws ApiException { + Call req = clearObjectsValidateBeforeCall(indexName, null); + if (req instanceof CallEcho) { + return new ClearObjectsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1306,7 +1253,7 @@ public Call clearObjectsAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = (Call) clearObjectsValidateBeforeCall(indexName, _callback); + Call call = clearObjectsValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1319,13 +1266,13 @@ public Call clearObjectsAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object clearRulesCall( + private Call clearRulesCall( String indexName, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -1358,10 +1305,10 @@ private Object clearRulesCall( ); } - private Object clearRulesValidateBeforeCall( + private Call clearRulesValidateBeforeCall( String indexName, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1383,20 +1330,18 @@ private Object clearRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T clearRules(String indexName, Boolean forwardToReplicas) - throws ApiException { - Object req = clearRulesValidateBeforeCall( - indexName, - forwardToReplicas, - null - ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public UpdatedAtResponse clearRules( + String indexName, + Boolean forwardToReplicas + ) throws ApiException { + Call req = clearRulesValidateBeforeCall(indexName, forwardToReplicas, null); + if (req instanceof CallEcho) { + return new ClearRulesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1414,7 +1359,7 @@ public Call clearRulesAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) clearRulesValidateBeforeCall( + Call call = clearRulesValidateBeforeCall( indexName, forwardToReplicas, _callback @@ -1429,11 +1374,13 @@ public Call clearRulesAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteApiKeyCall(String key, final ApiCallback _callback) - throws ApiException { + private Call deleteApiKeyCall( + String key, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -1459,9 +1406,9 @@ private Object deleteApiKeyCall(String key, final ApiCallback _callback) ); } - private Object deleteApiKeyValidateBeforeCall( + private Call deleteApiKeyValidateBeforeCall( String key, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'key' is set if (key == null) { @@ -1481,15 +1428,15 @@ private Object deleteApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteApiKey(String key) throws ApiException { - Object req = deleteApiKeyValidateBeforeCall(key, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public DeleteApiKeyResponse deleteApiKey(String key) throws ApiException { + Call req = deleteApiKeyValidateBeforeCall(key, null); + if (req instanceof CallEcho) { + return new DeleteApiKeyEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1504,7 +1451,7 @@ public Call deleteApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteApiKeyValidateBeforeCall(key, _callback); + Call call = deleteApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1516,13 +1463,13 @@ public Call deleteApiKeyAsync( * @param indexName The index in which to perform the request. (required) * @param searchParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteByCall( + private Call deleteByCall( String indexName, SearchParams searchParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchParams; @@ -1549,10 +1496,10 @@ private Object deleteByCall( ); } - private Object deleteByValidateBeforeCall( + private Call deleteByValidateBeforeCall( String indexName, SearchParams searchParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1582,16 +1529,18 @@ private Object deleteByValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteBy(String indexName, SearchParams searchParams) - throws ApiException { - Object req = deleteByValidateBeforeCall(indexName, searchParams, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public DeletedAtResponse deleteBy( + String indexName, + SearchParams searchParams + ) throws ApiException { + Call req = deleteByValidateBeforeCall(indexName, searchParams, null); + if (req instanceof CallEcho) { + return new DeleteByEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1610,11 +1559,7 @@ public Call deleteByAsync( SearchParams searchParams, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteByValidateBeforeCall( - indexName, - searchParams, - _callback - ); + Call call = deleteByValidateBeforeCall(indexName, searchParams, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1625,11 +1570,13 @@ public Call deleteByAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteIndexCall(String indexName, final ApiCallback _callback) - throws ApiException { + private Call deleteIndexCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -1655,9 +1602,9 @@ private Object deleteIndexCall(String indexName, final ApiCallback _callback) ); } - private Object deleteIndexValidateBeforeCall( + private Call deleteIndexValidateBeforeCall( String indexName, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1677,15 +1624,15 @@ private Object deleteIndexValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteIndex(String indexName) throws ApiException { - Object req = deleteIndexValidateBeforeCall(indexName, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public DeletedAtResponse deleteIndex(String indexName) throws ApiException { + Call req = deleteIndexValidateBeforeCall(indexName, null); + if (req instanceof CallEcho) { + return new DeleteIndexEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1700,7 +1647,7 @@ public Call deleteIndexAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteIndexValidateBeforeCall(indexName, _callback); + Call call = deleteIndexValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1712,13 +1659,13 @@ public Call deleteIndexAsync( * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteObjectCall( + private Call deleteObjectCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -1749,10 +1696,10 @@ private Object deleteObjectCall( ); } - private Object deleteObjectValidateBeforeCall( + private Call deleteObjectValidateBeforeCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1780,16 +1727,16 @@ private Object deleteObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteObject(String indexName, String objectID) + public DeletedAtResponse deleteObject(String indexName, String objectID) throws ApiException { - Object req = deleteObjectValidateBeforeCall(indexName, objectID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = deleteObjectValidateBeforeCall(indexName, objectID, null); + if (req instanceof CallEcho) { + return new DeleteObjectEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1806,11 +1753,7 @@ public Call deleteObjectAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteObjectValidateBeforeCall( - indexName, - objectID, - _callback - ); + Call call = deleteObjectValidateBeforeCall(indexName, objectID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -1824,14 +1767,14 @@ public Call deleteObjectAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteRuleCall( + private Call deleteRuleCall( String indexName, String objectID, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -1868,11 +1811,11 @@ private Object deleteRuleCall( ); } - private Object deleteRuleValidateBeforeCall( + private Call deleteRuleValidateBeforeCall( String indexName, String objectID, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -1902,24 +1845,24 @@ private Object deleteRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteRule( + public UpdatedAtResponse deleteRule( String indexName, String objectID, Boolean forwardToReplicas ) throws ApiException { - Object req = deleteRuleValidateBeforeCall( + Call req = deleteRuleValidateBeforeCall( indexName, objectID, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new DeleteRuleEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -1939,7 +1882,7 @@ public Call deleteRuleAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteRuleValidateBeforeCall( + Call call = deleteRuleValidateBeforeCall( indexName, objectID, forwardToReplicas, @@ -1955,11 +1898,13 @@ public Call deleteRuleAsync( * * @param source The IP range of the source. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteSourceCall(String source, final ApiCallback _callback) - throws ApiException { + private Call deleteSourceCall( + String source, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -1985,9 +1930,9 @@ private Object deleteSourceCall(String source, final ApiCallback _callback) ); } - private Object deleteSourceValidateBeforeCall( + private Call deleteSourceValidateBeforeCall( String source, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'source' is set if (source == null) { @@ -2007,15 +1952,15 @@ private Object deleteSourceValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteSource(String source) throws ApiException { - Object req = deleteSourceValidateBeforeCall(source, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public DeleteSourceResponse deleteSource(String source) throws ApiException { + Call req = deleteSourceValidateBeforeCall(source, null); + if (req instanceof CallEcho) { + return new DeleteSourceEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2030,7 +1975,7 @@ public Call deleteSourceAsync( String source, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteSourceValidateBeforeCall(source, _callback); + Call call = deleteSourceValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2044,14 +1989,14 @@ public Call deleteSourceAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object deleteSynonymCall( + private Call deleteSynonymCall( String indexName, String objectID, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -2088,11 +2033,11 @@ private Object deleteSynonymCall( ); } - private Object deleteSynonymValidateBeforeCall( + private Call deleteSynonymValidateBeforeCall( String indexName, String objectID, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -2122,24 +2067,24 @@ private Object deleteSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T deleteSynonym( + public DeletedAtResponse deleteSynonym( String indexName, String objectID, Boolean forwardToReplicas ) throws ApiException { - Object req = deleteSynonymValidateBeforeCall( + Call req = deleteSynonymValidateBeforeCall( indexName, objectID, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new DeleteSynonymEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2159,7 +2104,7 @@ public Call deleteSynonymAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) deleteSynonymValidateBeforeCall( + Call call = deleteSynonymValidateBeforeCall( indexName, objectID, forwardToReplicas, @@ -2175,11 +2120,13 @@ public Call deleteSynonymAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getApiKeyCall(String key, final ApiCallback _callback) - throws ApiException { + private Call getApiKeyCall( + String key, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -2205,9 +2152,9 @@ private Object getApiKeyCall(String key, final ApiCallback _callback) ); } - private Object getApiKeyValidateBeforeCall( + private Call getApiKeyValidateBeforeCall( String key, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'key' is set if (key == null) { @@ -2227,15 +2174,15 @@ private Object getApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getApiKey(String key) throws ApiException { - Object req = getApiKeyValidateBeforeCall(key, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public KeyObject getApiKey(String key) throws ApiException { + Call req = getApiKeyValidateBeforeCall(key, null); + if (req instanceof CallEcho) { + return new GetApiKeyEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2250,7 +2197,7 @@ public Call getApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getApiKeyValidateBeforeCall(key, _callback); + Call call = getApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2260,11 +2207,12 @@ public Call getApiKeyAsync( * Build call for getDictionaryLanguages * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getDictionaryLanguagesCall(final ApiCallback _callback) - throws ApiException { + private Call getDictionaryLanguagesCall( + final ApiCallback> _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -2286,8 +2234,8 @@ private Object getDictionaryLanguagesCall(final ApiCallback _callback) ); } - private Object getDictionaryLanguagesValidateBeforeCall( - final ApiCallback _callback + private Call getDictionaryLanguagesValidateBeforeCall( + final ApiCallback> _callback ) throws ApiException { return getDictionaryLanguagesCall(_callback); } @@ -2299,15 +2247,15 @@ private Object getDictionaryLanguagesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getDictionaryLanguages() throws ApiException { - Object req = getDictionaryLanguagesValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return (T) res.getData(); + public Map getDictionaryLanguages() throws ApiException { + Call req = getDictionaryLanguagesValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new GetDictionaryLanguagesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return res.getData(); } /** @@ -2320,7 +2268,7 @@ public T getDictionaryLanguages() throws ApiException { public Call getDictionaryLanguagesAsync( final ApiCallback> _callback ) throws ApiException { - Call call = (Call) getDictionaryLanguagesValidateBeforeCall(_callback); + Call call = getDictionaryLanguagesValidateBeforeCall(_callback); Type returnType = new TypeToken>() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2330,11 +2278,12 @@ public Call getDictionaryLanguagesAsync( * Build call for getDictionarySettings * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getDictionarySettingsCall(final ApiCallback _callback) - throws ApiException { + private Call getDictionarySettingsCall( + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -2356,8 +2305,8 @@ private Object getDictionarySettingsCall(final ApiCallback _callback) ); } - private Object getDictionarySettingsValidateBeforeCall( - final ApiCallback _callback + private Call getDictionarySettingsValidateBeforeCall( + final ApiCallback _callback ) throws ApiException { return getDictionarySettingsCall(_callback); } @@ -2369,17 +2318,18 @@ private Object getDictionarySettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getDictionarySettings() throws ApiException { - Object req = getDictionarySettingsValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return (T) res.getData(); + public GetDictionarySettingsResponse getDictionarySettings() + throws ApiException { + Call req = getDictionarySettingsValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new GetDictionarySettingsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return res.getData(); } /** @@ -2392,7 +2342,7 @@ public T getDictionarySettings() throws ApiException { public Call getDictionarySettingsAsync( final ApiCallback _callback ) throws ApiException { - Call call = (Call) getDictionarySettingsValidateBeforeCall(_callback); + Call call = getDictionarySettingsValidateBeforeCall(_callback); Type returnType = new TypeToken() {} .getType(); this.executeAsync(call, returnType, _callback); @@ -2411,15 +2361,15 @@ public Call getDictionarySettingsAsync( * @param type Type of log entries to retrieve. When omitted, all log entries are retrieved. * (optional, default to all) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getLogsCall( + private Call getLogsCall( Integer offset, Integer length, String indexName, String type, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -2458,12 +2408,12 @@ private Object getLogsCall( ); } - private Object getLogsValidateBeforeCall( + private Call getLogsValidateBeforeCall( Integer offset, Integer length, String indexName, String type, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { return getLogsCall(offset, length, indexName, type, _callback); } @@ -2483,26 +2433,20 @@ private Object getLogsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getLogs( + public GetLogsResponse getLogs( Integer offset, Integer length, String indexName, String type ) throws ApiException { - Object req = getLogsValidateBeforeCall( - offset, - length, - indexName, - type, - null - ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = getLogsValidateBeforeCall(offset, length, indexName, type, null); + if (req instanceof CallEcho) { + return new GetLogsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2527,7 +2471,7 @@ public Call getLogsAsync( String type, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getLogsValidateBeforeCall( + Call call = getLogsValidateBeforeCall( offset, length, indexName, @@ -2547,14 +2491,14 @@ public Call getLogsAsync( * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable * attributes are returned. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getObjectCall( + private Call getObjectCall( String indexName, String objectID, List attributesToRetrieve, - final ApiCallback _callback + final ApiCallback> _callback ) throws ApiException { Object bodyObj = null; @@ -2591,11 +2535,11 @@ private Object getObjectCall( ); } - private Object getObjectValidateBeforeCall( + private Call getObjectValidateBeforeCall( String indexName, String objectID, List attributesToRetrieve, - final ApiCallback _callback + final ApiCallback> _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -2625,24 +2569,24 @@ private Object getObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getObject( + public Map getObject( String indexName, String objectID, List attributesToRetrieve ) throws ApiException { - Object req = getObjectValidateBeforeCall( + Call req = getObjectValidateBeforeCall( indexName, objectID, attributesToRetrieve, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new GetObjectEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return res.getData(); } /** @@ -2662,7 +2606,7 @@ public Call getObjectAsync( List attributesToRetrieve, final ApiCallback> _callback ) throws ApiException { - Call call = (Call) getObjectValidateBeforeCall( + Call call = getObjectValidateBeforeCall( indexName, objectID, attributesToRetrieve, @@ -2678,12 +2622,12 @@ public Call getObjectAsync( * * @param getObjectsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getObjectsCall( + private Call getObjectsCall( GetObjectsObject getObjectsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = getObjectsObject; @@ -2706,9 +2650,9 @@ private Object getObjectsCall( ); } - private Object getObjectsValidateBeforeCall( + private Call getObjectsValidateBeforeCall( GetObjectsObject getObjectsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'getObjectsObject' is set if (getObjectsObject == null) { @@ -2728,16 +2672,16 @@ private Object getObjectsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getObjects(GetObjectsObject getObjectsObject) + public GetObjectsResponse getObjects(GetObjectsObject getObjectsObject) throws ApiException { - Object req = getObjectsValidateBeforeCall(getObjectsObject, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = getObjectsValidateBeforeCall(getObjectsObject, null); + if (req instanceof CallEcho) { + return new GetObjectsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2753,10 +2697,7 @@ public Call getObjectsAsync( GetObjectsObject getObjectsObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getObjectsValidateBeforeCall( - getObjectsObject, - _callback - ); + Call call = getObjectsValidateBeforeCall(getObjectsObject, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2768,13 +2709,13 @@ public Call getObjectsAsync( * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getRuleCall( + private Call getRuleCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -2805,10 +2746,10 @@ private Object getRuleCall( ); } - private Object getRuleValidateBeforeCall( + private Call getRuleValidateBeforeCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -2836,15 +2777,15 @@ private Object getRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getRule(String indexName, String objectID) throws ApiException { - Object req = getRuleValidateBeforeCall(indexName, objectID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public Rule getRule(String indexName, String objectID) throws ApiException { + Call req = getRuleValidateBeforeCall(indexName, objectID, null); + if (req instanceof CallEcho) { + return new GetRuleEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2861,11 +2802,7 @@ public Call getRuleAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getRuleValidateBeforeCall( - indexName, - objectID, - _callback - ); + Call call = getRuleValidateBeforeCall(indexName, objectID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2876,11 +2813,13 @@ public Call getRuleAsync( * * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getSettingsCall(String indexName, final ApiCallback _callback) - throws ApiException { + private Call getSettingsCall( + String indexName, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -2906,9 +2845,9 @@ private Object getSettingsCall(String indexName, final ApiCallback _callback) ); } - private Object getSettingsValidateBeforeCall( + private Call getSettingsValidateBeforeCall( String indexName, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -2928,15 +2867,15 @@ private Object getSettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getSettings(String indexName) throws ApiException { - Object req = getSettingsValidateBeforeCall(indexName, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public IndexSettings getSettings(String indexName) throws ApiException { + Call req = getSettingsValidateBeforeCall(indexName, null); + if (req instanceof CallEcho) { + return new GetSettingsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -2951,7 +2890,7 @@ public Call getSettingsAsync( String indexName, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getSettingsValidateBeforeCall(indexName, _callback); + Call call = getSettingsValidateBeforeCall(indexName, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -2961,10 +2900,10 @@ public Call getSettingsAsync( * Build call for getSources * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getSourcesCall(final ApiCallback _callback) + private Call getSourcesCall(final ApiCallback> _callback) throws ApiException { Object bodyObj = null; @@ -2987,8 +2926,9 @@ private Object getSourcesCall(final ApiCallback _callback) ); } - private Object getSourcesValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private Call getSourcesValidateBeforeCall( + final ApiCallback> _callback + ) throws ApiException { return getSourcesCall(_callback); } @@ -2999,15 +2939,15 @@ private Object getSourcesValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getSources() throws ApiException { - Object req = getSourcesValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken>() {}.getType(); - ApiResponse> res = this.execute(call, returnType); - return (T) res.getData(); + public List getSources() throws ApiException { + Call req = getSourcesValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new GetSourcesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken>() {}.getType(); + ApiResponse> res = this.execute(call, returnType); + return res.getData(); } /** @@ -3019,7 +2959,7 @@ public T getSources() throws ApiException { */ public Call getSourcesAsync(final ApiCallback> _callback) throws ApiException { - Call call = (Call) getSourcesValidateBeforeCall(_callback); + Call call = getSourcesValidateBeforeCall(_callback); Type returnType = new TypeToken>() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3031,13 +2971,13 @@ public Call getSourcesAsync(final ApiCallback> _callback) * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getSynonymCall( + private Call getSynonymCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -3068,10 +3008,10 @@ private Object getSynonymCall( ); } - private Object getSynonymValidateBeforeCall( + private Call getSynonymValidateBeforeCall( String indexName, String objectID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -3099,16 +3039,16 @@ private Object getSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getSynonym(String indexName, String objectID) + public SynonymHit getSynonym(String indexName, String objectID) throws ApiException { - Object req = getSynonymValidateBeforeCall(indexName, objectID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = getSynonymValidateBeforeCall(indexName, objectID, null); + if (req instanceof CallEcho) { + return new GetSynonymEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3125,11 +3065,7 @@ public Call getSynonymAsync( String objectID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getSynonymValidateBeforeCall( - indexName, - objectID, - _callback - ); + Call call = getSynonymValidateBeforeCall(indexName, objectID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3141,13 +3077,13 @@ public Call getSynonymAsync( * @param indexName The index in which to perform the request. (required) * @param taskID Unique identifier of an task. Numeric value (up to 64bits) (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getTaskCall( + private Call getTaskCall( String indexName, Integer taskID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -3178,10 +3114,10 @@ private Object getTaskCall( ); } - private Object getTaskValidateBeforeCall( + private Call getTaskValidateBeforeCall( String indexName, Integer taskID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -3209,15 +3145,16 @@ private Object getTaskValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getTask(String indexName, Integer taskID) throws ApiException { - Object req = getTaskValidateBeforeCall(indexName, taskID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public GetTaskResponse getTask(String indexName, Integer taskID) + throws ApiException { + Call req = getTaskValidateBeforeCall(indexName, taskID, null); + if (req instanceof CallEcho) { + return new GetTaskEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3234,7 +3171,7 @@ public Call getTaskAsync( Integer taskID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getTaskValidateBeforeCall(indexName, taskID, _callback); + Call call = getTaskValidateBeforeCall(indexName, taskID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3244,11 +3181,12 @@ public Call getTaskAsync( * Build call for getTopUserIds * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getTopUserIdsCall(final ApiCallback _callback) - throws ApiException { + private Call getTopUserIdsCall( + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -3270,8 +3208,9 @@ private Object getTopUserIdsCall(final ApiCallback _callback) ); } - private Object getTopUserIdsValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private Call getTopUserIdsValidateBeforeCall( + final ApiCallback _callback + ) throws ApiException { return getTopUserIdsCall(_callback); } @@ -3285,15 +3224,15 @@ private Object getTopUserIdsValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getTopUserIds() throws ApiException { - Object req = getTopUserIdsValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public GetTopUserIdsResponse getTopUserIds() throws ApiException { + Call req = getTopUserIdsValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new GetTopUserIdsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3309,7 +3248,7 @@ public T getTopUserIds() throws ApiException { public Call getTopUserIdsAsync( final ApiCallback _callback ) throws ApiException { - Call call = (Call) getTopUserIdsValidateBeforeCall(_callback); + Call call = getTopUserIdsValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3320,11 +3259,13 @@ public Call getTopUserIdsAsync( * * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object getUserIdCall(String userID, final ApiCallback _callback) - throws ApiException { + private Call getUserIdCall( + String userID, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -3350,9 +3291,9 @@ private Object getUserIdCall(String userID, final ApiCallback _callback) ); } - private Object getUserIdValidateBeforeCall( + private Call getUserIdValidateBeforeCall( String userID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'userID' is set if (userID == null) { @@ -3375,15 +3316,15 @@ private Object getUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T getUserId(String userID) throws ApiException { - Object req = getUserIdValidateBeforeCall(userID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public UserId getUserId(String userID) throws ApiException { + Call req = getUserIdValidateBeforeCall(userID, null); + if (req instanceof CallEcho) { + return new GetUserIdEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3401,7 +3342,7 @@ public Call getUserIdAsync( String userID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) getUserIdValidateBeforeCall(userID, _callback); + Call call = getUserIdValidateBeforeCall(userID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3412,12 +3353,12 @@ public Call getUserIdAsync( * * @param getClusters Whether to get clusters or not. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object hasPendingMappingsCall( + private Call hasPendingMappingsCall( Boolean getClusters, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -3444,9 +3385,9 @@ private Object hasPendingMappingsCall( ); } - private Object hasPendingMappingsValidateBeforeCall( + private Call hasPendingMappingsValidateBeforeCall( Boolean getClusters, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { return hasPendingMappingsCall(getClusters, _callback); } @@ -3463,15 +3404,16 @@ private Object hasPendingMappingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T hasPendingMappings(Boolean getClusters) throws ApiException { - Object req = hasPendingMappingsValidateBeforeCall(getClusters, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public CreatedAtResponse hasPendingMappings(Boolean getClusters) + throws ApiException { + Call req = hasPendingMappingsValidateBeforeCall(getClusters, null); + if (req instanceof CallEcho) { + return new HasPendingMappingsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3490,10 +3432,7 @@ public Call hasPendingMappingsAsync( Boolean getClusters, final ApiCallback _callback ) throws ApiException { - Call call = (Call) hasPendingMappingsValidateBeforeCall( - getClusters, - _callback - ); + Call call = hasPendingMappingsValidateBeforeCall(getClusters, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3503,11 +3442,12 @@ public Call hasPendingMappingsAsync( * Build call for listApiKeys * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object listApiKeysCall(final ApiCallback _callback) - throws ApiException { + private Call listApiKeysCall( + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -3529,8 +3469,9 @@ private Object listApiKeysCall(final ApiCallback _callback) ); } - private Object listApiKeysValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private Call listApiKeysValidateBeforeCall( + final ApiCallback _callback + ) throws ApiException { return listApiKeysCall(_callback); } @@ -3541,15 +3482,15 @@ private Object listApiKeysValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T listApiKeys() throws ApiException { - Object req = listApiKeysValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public ListApiKeysResponse listApiKeys() throws ApiException { + Call req = listApiKeysValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new ListApiKeysEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3562,7 +3503,7 @@ public T listApiKeys() throws ApiException { public Call listApiKeysAsync( final ApiCallback _callback ) throws ApiException { - Call call = (Call) listApiKeysValidateBeforeCall(_callback); + Call call = listApiKeysValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3572,11 +3513,12 @@ public Call listApiKeysAsync( * Build call for listClusters * * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object listClustersCall(final ApiCallback _callback) - throws ApiException { + private Call listClustersCall( + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -3598,8 +3540,9 @@ private Object listClustersCall(final ApiCallback _callback) ); } - private Object listClustersValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private Call listClustersValidateBeforeCall( + final ApiCallback _callback + ) throws ApiException { return listClustersCall(_callback); } @@ -3611,15 +3554,15 @@ private Object listClustersValidateBeforeCall(final ApiCallback _callback) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T listClusters() throws ApiException { - Object req = listClustersValidateBeforeCall(null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public ListClustersResponse listClusters() throws ApiException { + Call req = listClustersValidateBeforeCall(null); + if (req instanceof CallEcho) { + return new ListClustersEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3633,7 +3576,7 @@ public T listClusters() throws ApiException { public Call listClustersAsync( final ApiCallback _callback ) throws ApiException { - Call call = (Call) listClustersValidateBeforeCall(_callback); + Call call = listClustersValidateBeforeCall(_callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3646,11 +3589,13 @@ public Call listClustersAsync( * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object listIndicesCall(Integer page, final ApiCallback _callback) - throws ApiException { + private Call listIndicesCall( + Integer page, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -3676,9 +3621,9 @@ private Object listIndicesCall(Integer page, final ApiCallback _callback) ); } - private Object listIndicesValidateBeforeCall( + private Call listIndicesValidateBeforeCall( Integer page, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { return listIndicesCall(page, _callback); } @@ -3693,15 +3638,15 @@ private Object listIndicesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T listIndices(Integer page) throws ApiException { - Object req = listIndicesValidateBeforeCall(page, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public ListIndicesResponse listIndices(Integer page) throws ApiException { + Call req = listIndicesValidateBeforeCall(page, null); + if (req instanceof CallEcho) { + return new ListIndicesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3718,7 +3663,7 @@ public Call listIndicesAsync( Integer page, final ApiCallback _callback ) throws ApiException { - Call call = (Call) listIndicesValidateBeforeCall(page, _callback); + Call call = listIndicesValidateBeforeCall(page, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3732,13 +3677,13 @@ public Call listIndicesAsync( * (optional) * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object listUserIdsCall( + private Call listUserIdsCall( Integer page, Integer hitsPerPage, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -3769,10 +3714,10 @@ private Object listUserIdsCall( ); } - private Object listUserIdsValidateBeforeCall( + private Call listUserIdsValidateBeforeCall( Integer page, Integer hitsPerPage, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { return listUserIdsCall(page, hitsPerPage, _callback); } @@ -3791,16 +3736,16 @@ private Object listUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T listUserIds(Integer page, Integer hitsPerPage) + public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) throws ApiException { - Object req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); + if (req instanceof CallEcho) { + return new ListUserIdsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3822,11 +3767,7 @@ public Call listUserIdsAsync( Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { - Call call = (Call) listUserIdsValidateBeforeCall( - page, - hitsPerPage, - _callback - ); + Call call = listUserIdsValidateBeforeCall(page, hitsPerPage, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3837,12 +3778,12 @@ public Call listUserIdsAsync( * * @param batchObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object multipleBatchCall( + private Call multipleBatchCall( BatchObject batchObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = batchObject; @@ -3865,9 +3806,9 @@ private Object multipleBatchCall( ); } - private Object multipleBatchValidateBeforeCall( + private Call multipleBatchValidateBeforeCall( BatchObject batchObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'batchObject' is set if (batchObject == null) { @@ -3888,15 +3829,16 @@ private Object multipleBatchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T multipleBatch(BatchObject batchObject) throws ApiException { - Object req = multipleBatchValidateBeforeCall(batchObject, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public MultipleBatchResponse multipleBatch(BatchObject batchObject) + throws ApiException { + Call req = multipleBatchValidateBeforeCall(batchObject, null); + if (req instanceof CallEcho) { + return new MultipleBatchEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3912,7 +3854,7 @@ public Call multipleBatchAsync( BatchObject batchObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) multipleBatchValidateBeforeCall(batchObject, _callback); + Call call = multipleBatchValidateBeforeCall(batchObject, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -3923,12 +3865,12 @@ public Call multipleBatchAsync( * * @param multipleQueriesObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object multipleQueriesCall( + private Call multipleQueriesCall( MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = multipleQueriesObject; @@ -3951,9 +3893,9 @@ private Object multipleQueriesCall( ); } - private Object multipleQueriesValidateBeforeCall( + private Call multipleQueriesValidateBeforeCall( MultipleQueriesObject multipleQueriesObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'multipleQueriesObject' is set if (multipleQueriesObject == null) { @@ -3974,16 +3916,17 @@ private Object multipleQueriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T multipleQueries(MultipleQueriesObject multipleQueriesObject) - throws ApiException { - Object req = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public MultipleQueriesResponse multipleQueries( + MultipleQueriesObject multipleQueriesObject + ) throws ApiException { + Call req = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); + if (req instanceof CallEcho) { + return new MultipleQueriesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -3998,7 +3941,7 @@ public Call multipleQueriesAsync( MultipleQueriesObject multipleQueriesObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) multipleQueriesValidateBeforeCall( + Call call = multipleQueriesValidateBeforeCall( multipleQueriesObject, _callback ); @@ -4013,13 +3956,13 @@ public Call multipleQueriesAsync( * @param indexName The index in which to perform the request. (required) * @param operationIndexObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object operationIndexCall( + private Call operationIndexCall( String indexName, OperationIndexObject operationIndexObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = operationIndexObject; @@ -4046,10 +3989,10 @@ private Object operationIndexCall( ); } - private Object operationIndexValidateBeforeCall( + private Call operationIndexValidateBeforeCall( String indexName, OperationIndexObject operationIndexObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -4078,22 +4021,22 @@ private Object operationIndexValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T operationIndex( + public UpdatedAtResponse operationIndex( String indexName, OperationIndexObject operationIndexObject ) throws ApiException { - Object req = operationIndexValidateBeforeCall( + Call req = operationIndexValidateBeforeCall( indexName, operationIndexObject, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new OperationIndexEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4110,7 +4053,7 @@ public Call operationIndexAsync( OperationIndexObject operationIndexObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) operationIndexValidateBeforeCall( + Call call = operationIndexValidateBeforeCall( indexName, operationIndexObject, _callback @@ -4129,15 +4072,15 @@ public Call operationIndexAsync( * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object partialUpdateObjectCall( + private Call partialUpdateObjectCall( String indexName, String objectID, List> oneOfstringbuiltInOperation, Boolean createIfNotExists, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = oneOfstringbuiltInOperation; @@ -4174,12 +4117,12 @@ private Object partialUpdateObjectCall( ); } - private Object partialUpdateObjectValidateBeforeCall( + private Call partialUpdateObjectValidateBeforeCall( String indexName, String objectID, List> oneOfstringbuiltInOperation, Boolean createIfNotExists, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -4227,28 +4170,28 @@ private Object partialUpdateObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T partialUpdateObject( + public UpdatedAtWithObjectIdResponse partialUpdateObject( String indexName, String objectID, List> oneOfstringbuiltInOperation, Boolean createIfNotExists ) throws ApiException { - Object req = partialUpdateObjectValidateBeforeCall( + Call req = partialUpdateObjectValidateBeforeCall( indexName, objectID, oneOfstringbuiltInOperation, createIfNotExists, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new PartialUpdateObjectEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return res.getData(); } /** @@ -4273,7 +4216,7 @@ public Call partialUpdateObjectAsync( Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { - Call call = (Call) partialUpdateObjectValidateBeforeCall( + Call call = partialUpdateObjectValidateBeforeCall( indexName, objectID, oneOfstringbuiltInOperation, @@ -4291,11 +4234,13 @@ public Call partialUpdateObjectAsync( * * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object removeUserIdCall(String userID, final ApiCallback _callback) - throws ApiException { + private Call removeUserIdCall( + String userID, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -4321,9 +4266,9 @@ private Object removeUserIdCall(String userID, final ApiCallback _callback) ); } - private Object removeUserIdValidateBeforeCall( + private Call removeUserIdValidateBeforeCall( String userID, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'userID' is set if (userID == null) { @@ -4344,15 +4289,15 @@ private Object removeUserIdValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T removeUserId(String userID) throws ApiException { - Object req = removeUserIdValidateBeforeCall(userID, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public RemoveUserIdResponse removeUserId(String userID) throws ApiException { + Call req = removeUserIdValidateBeforeCall(userID, null); + if (req instanceof CallEcho) { + return new RemoveUserIdEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4368,7 +4313,7 @@ public Call removeUserIdAsync( String userID, final ApiCallback _callback ) throws ApiException { - Call call = (Call) removeUserIdValidateBeforeCall(userID, _callback); + Call call = removeUserIdValidateBeforeCall(userID, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4379,12 +4324,12 @@ public Call removeUserIdAsync( * * @param source The sources to allow. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object replaceSourcesCall( + private Call replaceSourcesCall( List source, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = source; @@ -4407,9 +4352,9 @@ private Object replaceSourcesCall( ); } - private Object replaceSourcesValidateBeforeCall( + private Call replaceSourcesValidateBeforeCall( List source, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'source' is set if (source == null) { @@ -4429,15 +4374,16 @@ private Object replaceSourcesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T replaceSources(List source) throws ApiException { - Object req = replaceSourcesValidateBeforeCall(source, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public ReplaceSourceResponse replaceSources(List source) + throws ApiException { + Call req = replaceSourcesValidateBeforeCall(source, null); + if (req instanceof CallEcho) { + return new ReplaceSourcesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4452,7 +4398,7 @@ public Call replaceSourcesAsync( List source, final ApiCallback _callback ) throws ApiException { - Call call = (Call) replaceSourcesValidateBeforeCall(source, _callback); + Call call = replaceSourcesValidateBeforeCall(source, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4463,11 +4409,13 @@ public Call replaceSourcesAsync( * * @param key API Key string. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object restoreApiKeyCall(String key, final ApiCallback _callback) - throws ApiException { + private Call restoreApiKeyCall( + String key, + final ApiCallback _callback + ) throws ApiException { Object bodyObj = null; // create path and map variables @@ -4493,9 +4441,9 @@ private Object restoreApiKeyCall(String key, final ApiCallback _callback) ); } - private Object restoreApiKeyValidateBeforeCall( + private Call restoreApiKeyValidateBeforeCall( String key, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'key' is set if (key == null) { @@ -4515,15 +4463,15 @@ private Object restoreApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T restoreApiKey(String key) throws ApiException { - Object req = restoreApiKeyValidateBeforeCall(key, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public AddApiKeyResponse restoreApiKey(String key) throws ApiException { + Call req = restoreApiKeyValidateBeforeCall(key, null); + if (req instanceof CallEcho) { + return new RestoreApiKeyEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4538,7 +4486,7 @@ public Call restoreApiKeyAsync( String key, final ApiCallback _callback ) throws ApiException { - Call call = (Call) restoreApiKeyValidateBeforeCall(key, _callback); + Call call = restoreApiKeyValidateBeforeCall(key, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4550,13 +4498,13 @@ public Call restoreApiKeyAsync( * @param indexName The index in which to perform the request. (required) * @param body The Algolia object. (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object saveObjectCall( + private Call saveObjectCall( String indexName, Object body, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = body; @@ -4583,10 +4531,10 @@ private Object saveObjectCall( ); } - private Object saveObjectValidateBeforeCall( + private Call saveObjectValidateBeforeCall( String indexName, Object body, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -4614,15 +4562,16 @@ private Object saveObjectValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T saveObject(String indexName, Object body) throws ApiException { - Object req = saveObjectValidateBeforeCall(indexName, body, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public SaveObjectResponse saveObject(String indexName, Object body) + throws ApiException { + Call req = saveObjectValidateBeforeCall(indexName, body, null); + if (req instanceof CallEcho) { + return new SaveObjectEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4639,7 +4588,7 @@ public Call saveObjectAsync( Object body, final ApiCallback _callback ) throws ApiException { - Call call = (Call) saveObjectValidateBeforeCall(indexName, body, _callback); + Call call = saveObjectValidateBeforeCall(indexName, body, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -4654,15 +4603,15 @@ public Call saveObjectAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object saveRuleCall( + private Call saveRuleCall( String indexName, String objectID, Rule rule, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = rule; @@ -4699,12 +4648,12 @@ private Object saveRuleCall( ); } - private Object saveRuleValidateBeforeCall( + private Call saveRuleValidateBeforeCall( String indexName, String objectID, Rule rule, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -4748,26 +4697,26 @@ private Object saveRuleValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T saveRule( + public UpdatedRuleResponse saveRule( String indexName, String objectID, Rule rule, Boolean forwardToReplicas ) throws ApiException { - Object req = saveRuleValidateBeforeCall( + Call req = saveRuleValidateBeforeCall( indexName, objectID, rule, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SaveRuleEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4789,7 +4738,7 @@ public Call saveRuleAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) saveRuleValidateBeforeCall( + Call call = saveRuleValidateBeforeCall( indexName, objectID, rule, @@ -4810,15 +4759,15 @@ public Call saveRuleAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object saveSynonymCall( + private Call saveSynonymCall( String indexName, String objectID, SynonymHit synonymHit, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = synonymHit; @@ -4855,12 +4804,12 @@ private Object saveSynonymCall( ); } - private Object saveSynonymValidateBeforeCall( + private Call saveSynonymValidateBeforeCall( String indexName, String objectID, SynonymHit synonymHit, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -4904,26 +4853,26 @@ private Object saveSynonymValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T saveSynonym( + public SaveSynonymResponse saveSynonym( String indexName, String objectID, SynonymHit synonymHit, Boolean forwardToReplicas ) throws ApiException { - Object req = saveSynonymValidateBeforeCall( + Call req = saveSynonymValidateBeforeCall( indexName, objectID, synonymHit, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SaveSynonymEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -4946,7 +4895,7 @@ public Call saveSynonymAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) saveSynonymValidateBeforeCall( + Call call = saveSynonymValidateBeforeCall( indexName, objectID, synonymHit, @@ -4968,15 +4917,15 @@ public Call saveSynonymAsync( * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this * request. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object saveSynonymsCall( + private Call saveSynonymsCall( String indexName, List synonymHit, Boolean forwardToReplicas, Boolean replaceExistingSynonyms, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = synonymHit; @@ -5015,12 +4964,12 @@ private Object saveSynonymsCall( ); } - private Object saveSynonymsValidateBeforeCall( + private Call saveSynonymsValidateBeforeCall( String indexName, List synonymHit, Boolean forwardToReplicas, Boolean replaceExistingSynonyms, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -5059,26 +5008,26 @@ private Object saveSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T saveSynonyms( + public UpdatedAtResponse saveSynonyms( String indexName, List synonymHit, Boolean forwardToReplicas, Boolean replaceExistingSynonyms ) throws ApiException { - Object req = saveSynonymsValidateBeforeCall( + Call req = saveSynonymsValidateBeforeCall( indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SaveSynonymsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5102,7 +5051,7 @@ public Call saveSynonymsAsync( Boolean replaceExistingSynonyms, final ApiCallback _callback ) throws ApiException { - Call call = (Call) saveSynonymsValidateBeforeCall( + Call call = saveSynonymsValidateBeforeCall( indexName, synonymHit, forwardToReplicas, @@ -5120,13 +5069,13 @@ public Call saveSynonymsAsync( * @param indexName The index in which to perform the request. (required) * @param searchParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchCall( + private Call searchCall( String indexName, SearchParams searchParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchParams; @@ -5153,10 +5102,10 @@ private Object searchCall( ); } - private Object searchValidateBeforeCall( + private Call searchValidateBeforeCall( String indexName, SearchParams searchParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -5184,16 +5133,16 @@ private Object searchValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T search(String indexName, SearchParams searchParams) + public SearchResponse search(String indexName, SearchParams searchParams) throws ApiException { - Object req = searchValidateBeforeCall(indexName, searchParams, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + Call req = searchValidateBeforeCall(indexName, searchParams, null); + if (req instanceof CallEcho) { + return new SearchEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5210,11 +5159,7 @@ public Call searchAsync( SearchParams searchParams, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchValidateBeforeCall( - indexName, - searchParams, - _callback - ); + Call call = searchValidateBeforeCall(indexName, searchParams, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -5226,13 +5171,13 @@ public Call searchAsync( * @param dictionaryName The dictionary to search in. (required) * @param searchDictionaryEntries (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchDictionaryEntriesCall( + private Call searchDictionaryEntriesCall( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchDictionaryEntries; @@ -5259,10 +5204,10 @@ private Object searchDictionaryEntriesCall( ); } - private Object searchDictionaryEntriesValidateBeforeCall( + private Call searchDictionaryEntriesValidateBeforeCall( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'dictionaryName' is set if (dictionaryName == null) { @@ -5296,22 +5241,22 @@ private Object searchDictionaryEntriesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T searchDictionaryEntries( + public UpdatedAtResponse searchDictionaryEntries( String dictionaryName, SearchDictionaryEntries searchDictionaryEntries ) throws ApiException { - Object req = searchDictionaryEntriesValidateBeforeCall( + Call req = searchDictionaryEntriesValidateBeforeCall( dictionaryName, searchDictionaryEntries, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SearchDictionaryEntriesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5328,7 +5273,7 @@ public Call searchDictionaryEntriesAsync( SearchDictionaryEntries searchDictionaryEntries, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchDictionaryEntriesValidateBeforeCall( + Call call = searchDictionaryEntriesValidateBeforeCall( dictionaryName, searchDictionaryEntries, _callback @@ -5345,14 +5290,14 @@ public Call searchDictionaryEntriesAsync( * @param facetName The facet name. (required) * @param searchForFacetValuesRequest (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchForFacetValuesCall( + private Call searchForFacetValuesCall( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchForFacetValuesRequest; @@ -5383,11 +5328,11 @@ private Object searchForFacetValuesCall( ); } - private Object searchForFacetValuesValidateBeforeCall( + private Call searchForFacetValuesValidateBeforeCall( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -5422,26 +5367,26 @@ private Object searchForFacetValuesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T searchForFacetValues( + public SearchForFacetValuesResponse searchForFacetValues( String indexName, String facetName, SearchForFacetValuesRequest searchForFacetValuesRequest ) throws ApiException { - Object req = searchForFacetValuesValidateBeforeCall( + Call req = searchForFacetValuesValidateBeforeCall( indexName, facetName, searchForFacetValuesRequest, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {} - .getType(); - ApiResponse res = - this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SearchForFacetValuesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {} + .getType(); + ApiResponse res = + this.execute(call, returnType); + return res.getData(); } /** @@ -5461,7 +5406,7 @@ public Call searchForFacetValuesAsync( SearchForFacetValuesRequest searchForFacetValuesRequest, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchForFacetValuesValidateBeforeCall( + Call call = searchForFacetValuesValidateBeforeCall( indexName, facetName, searchForFacetValuesRequest, @@ -5479,13 +5424,13 @@ public Call searchForFacetValuesAsync( * @param indexName The index in which to perform the request. (required) * @param searchRulesParams (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchRulesCall( + private Call searchRulesCall( String indexName, SearchRulesParams searchRulesParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchRulesParams; @@ -5512,10 +5457,10 @@ private Object searchRulesCall( ); } - private Object searchRulesValidateBeforeCall( + private Call searchRulesValidateBeforeCall( String indexName, SearchRulesParams searchRulesParams, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -5543,22 +5488,22 @@ private Object searchRulesValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T searchRules( + public SearchRulesResponse searchRules( String indexName, SearchRulesParams searchRulesParams ) throws ApiException { - Object req = searchRulesValidateBeforeCall( + Call req = searchRulesValidateBeforeCall( indexName, searchRulesParams, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SearchRulesEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5575,7 +5520,7 @@ public Call searchRulesAsync( SearchRulesParams searchRulesParams, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchRulesValidateBeforeCall( + Call call = searchRulesValidateBeforeCall( indexName, searchRulesParams, _callback @@ -5596,16 +5541,16 @@ public Call searchRulesAsync( * (optional, default to 0) * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchSynonymsCall( + private Call searchSynonymsCall( String indexName, String query, String type, Integer page, Integer hitsPerPage, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = null; @@ -5648,13 +5593,13 @@ private Object searchSynonymsCall( ); } - private Object searchSynonymsValidateBeforeCall( + private Call searchSynonymsValidateBeforeCall( String indexName, String query, String type, Integer page, Integer hitsPerPage, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -5687,14 +5632,14 @@ private Object searchSynonymsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T searchSynonyms( + public SearchSynonymsResponse searchSynonyms( String indexName, String query, String type, Integer page, Integer hitsPerPage ) throws ApiException { - Object req = searchSynonymsValidateBeforeCall( + Call req = searchSynonymsValidateBeforeCall( indexName, query, type, @@ -5702,13 +5647,13 @@ public T searchSynonyms( hitsPerPage, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SearchSynonymsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5733,7 +5678,7 @@ public Call searchSynonymsAsync( Integer hitsPerPage, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchSynonymsValidateBeforeCall( + Call call = searchSynonymsValidateBeforeCall( indexName, query, type, @@ -5751,12 +5696,12 @@ public Call searchSynonymsAsync( * * @param searchUserIdsObject (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object searchUserIdsCall( + private Call searchUserIdsCall( SearchUserIdsObject searchUserIdsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = searchUserIdsObject; @@ -5779,9 +5724,9 @@ private Object searchUserIdsCall( ); } - private Object searchUserIdsValidateBeforeCall( + private Call searchUserIdsValidateBeforeCall( SearchUserIdsObject searchUserIdsObject, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'searchUserIdsObject' is set if (searchUserIdsObject == null) { @@ -5807,16 +5752,17 @@ private Object searchUserIdsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T searchUserIds(SearchUserIdsObject searchUserIdsObject) - throws ApiException { - Object req = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public SearchUserIdsResponse searchUserIds( + SearchUserIdsObject searchUserIdsObject + ) throws ApiException { + Call req = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); + if (req instanceof CallEcho) { + return new SearchUserIdsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5837,10 +5783,7 @@ public Call searchUserIdsAsync( SearchUserIdsObject searchUserIdsObject, final ApiCallback _callback ) throws ApiException { - Call call = (Call) searchUserIdsValidateBeforeCall( - searchUserIdsObject, - _callback - ); + Call call = searchUserIdsValidateBeforeCall(searchUserIdsObject, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; @@ -5851,12 +5794,12 @@ public Call searchUserIdsAsync( * * @param dictionarySettingsRequest (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object setDictionarySettingsCall( + private Call setDictionarySettingsCall( DictionarySettingsRequest dictionarySettingsRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = dictionarySettingsRequest; @@ -5879,9 +5822,9 @@ private Object setDictionarySettingsCall( ); } - private Object setDictionarySettingsValidateBeforeCall( + private Call setDictionarySettingsValidateBeforeCall( DictionarySettingsRequest dictionarySettingsRequest, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'dictionarySettingsRequest' is set if (dictionarySettingsRequest == null) { @@ -5902,20 +5845,20 @@ private Object setDictionarySettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T setDictionarySettings( + public UpdatedAtResponse setDictionarySettings( DictionarySettingsRequest dictionarySettingsRequest ) throws ApiException { - Object req = setDictionarySettingsValidateBeforeCall( + Call req = setDictionarySettingsValidateBeforeCall( dictionarySettingsRequest, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SetDictionarySettingsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -5930,7 +5873,7 @@ public Call setDictionarySettingsAsync( DictionarySettingsRequest dictionarySettingsRequest, final ApiCallback _callback ) throws ApiException { - Call call = (Call) setDictionarySettingsValidateBeforeCall( + Call call = setDictionarySettingsValidateBeforeCall( dictionarySettingsRequest, _callback ); @@ -5947,14 +5890,14 @@ public Call setDictionarySettingsAsync( * @param forwardToReplicas When true, changes are also propagated to replicas of the given * indexName. (optional) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object setSettingsCall( + private Call setSettingsCall( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = indexSettings; @@ -5987,11 +5930,11 @@ private Object setSettingsCall( ); } - private Object setSettingsValidateBeforeCall( + private Call setSettingsValidateBeforeCall( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'indexName' is set if (indexName == null) { @@ -6027,24 +5970,24 @@ private Object setSettingsValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T setSettings( + public UpdatedAtResponse setSettings( String indexName, IndexSettings indexSettings, Boolean forwardToReplicas ) throws ApiException { - Object req = setSettingsValidateBeforeCall( + Call req = setSettingsValidateBeforeCall( indexName, indexSettings, forwardToReplicas, null ); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + if (req instanceof CallEcho) { + return new SetSettingsEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -6066,7 +6009,7 @@ public Call setSettingsAsync( Boolean forwardToReplicas, final ApiCallback _callback ) throws ApiException { - Call call = (Call) setSettingsValidateBeforeCall( + Call call = setSettingsValidateBeforeCall( indexName, indexSettings, forwardToReplicas, @@ -6083,13 +6026,13 @@ public Call setSettingsAsync( * @param key API Key string. (required) * @param apiKey (required) * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private Object updateApiKeyCall( + private Call updateApiKeyCall( String key, ApiKey apiKey, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { Object bodyObj = apiKey; @@ -6116,10 +6059,10 @@ private Object updateApiKeyCall( ); } - private Object updateApiKeyValidateBeforeCall( + private Call updateApiKeyValidateBeforeCall( String key, ApiKey apiKey, - final ApiCallback _callback + final ApiCallback _callback ) throws ApiException { // verify the required parameter 'key' is set if (key == null) { @@ -6147,15 +6090,16 @@ private Object updateApiKeyValidateBeforeCall( * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the * response body */ - public T updateApiKey(String key, ApiKey apiKey) throws ApiException { - Object req = updateApiKeyValidateBeforeCall(key, apiKey, null); - if (req instanceof Call) { - Call call = (Call) req; - Type returnType = new TypeToken() {}.getType(); - ApiResponse res = this.execute(call, returnType); - return (T) res.getData(); + public UpdateApiKeyResponse updateApiKey(String key, ApiKey apiKey) + throws ApiException { + Call req = updateApiKeyValidateBeforeCall(key, apiKey, null); + if (req instanceof CallEcho) { + return new UpdateApiKeyEcho(((CallEcho) req).getRequest()); } - return (T) req; + Call call = (Call) req; + Type returnType = new TypeToken() {}.getType(); + ApiResponse res = this.execute(call, returnType); + return res.getData(); } /** @@ -6172,7 +6116,7 @@ public Call updateApiKeyAsync( ApiKey apiKey, final ApiCallback _callback ) throws ApiException { - Call call = (Call) updateApiKeyValidateBeforeCall(key, apiKey, _callback); + Call call = updateApiKeyValidateBeforeCall(key, apiKey, _callback); Type returnType = new TypeToken() {}.getType(); this.executeAsync(call, returnType, _callback); return call; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java new file mode 100644 index 0000000000..47b5fb8f58 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java @@ -0,0 +1,57 @@ +package com.algolia.utils; + +import java.io.IOException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Request; +import okhttp3.Response; +import okio.Timeout; + +public class CallEcho implements Call { + + private Request request; + + public CallEcho(Request request) { + this.request = request; + } + + public Request getRequest() { + return request; + } + + @Override + public Request request() { + return null; + } + + @Override + public void cancel() {} + + @Override + public Call clone() { + return null; + } + + @Override + public void enqueue(Callback arg0) {} + + @Override + public Response execute() throws IOException { + return null; + } + + @Override + public boolean isExecuted() { + return false; + } + + @Override + public boolean isCanceled() { + return false; + } + + @Override + public Timeout timeout() { + return null; + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java index f9a62971ad..7d573fcaae 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java @@ -5,8 +5,8 @@ public class EchoRequester implements Requester { - public Object newCall(Request request) throws ApiException { - return request; + public CallEcho newCall(Request request) throws ApiException { + return new CallEcho(request); } // NO-OP for now diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java index 25a8d29fed..1da39b461e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/HttpRequester.java @@ -5,6 +5,7 @@ import com.algolia.ProgressResponseBody; import java.io.IOException; import java.util.concurrent.TimeUnit; +import okhttp3.Call; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -25,7 +26,7 @@ public HttpRequester() { httpClient = builder.build(); } - public Object newCall(Request request) throws ApiException { + public Call newCall(Request request) throws ApiException { return httpClient.newCall(request); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java index 65f3ac4c35..9f7f262846 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/Requester.java @@ -1,10 +1,11 @@ package com.algolia.utils; import com.algolia.ApiException; +import okhttp3.Call; import okhttp3.Request; public interface Requester { - public Object newCall(Request request) throws ApiException; + public Call newCall(Request request) throws ApiException; /** * Enable/disable debugging for this API client. diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java new file mode 100644 index 0000000000..b9ebb0b865 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class AddApiKeyEcho extends AddApiKeyResponse implements EchoResponse { + + private Request request; + + public AddApiKeyEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java new file mode 100644 index 0000000000..0f97e4e507 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class AddOrUpdateObjectEcho + extends UpdatedAtWithObjectIdResponse + implements EchoResponse { + + private Request request; + + public AddOrUpdateObjectEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java new file mode 100644 index 0000000000..dfb231060b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class AppendSourceEcho + extends CreatedAtResponse + implements EchoResponse { + + private Request request; + + public AppendSourceEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java new file mode 100644 index 0000000000..4200f41855 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class AssignUserIdEcho + extends CreatedAtResponse + implements EchoResponse { + + private Request request; + + public AssignUserIdEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java new file mode 100644 index 0000000000..6889b7f4a4 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class BatchAssignUserIdsEcho + extends CreatedAtResponse + implements EchoResponse { + + private Request request; + + public BatchAssignUserIdsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java new file mode 100644 index 0000000000..3db0be088a --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class BatchDictionaryEntriesEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public BatchDictionaryEntriesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java new file mode 100644 index 0000000000..56ef0cd47d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class BatchEcho extends BatchResponse implements EchoResponse { + + private Request request; + + public BatchEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java new file mode 100644 index 0000000000..02dce3f19d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class BatchRulesEcho extends UpdatedAtResponse implements EchoResponse { + + private Request request; + + public BatchRulesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java new file mode 100644 index 0000000000..bae0c5121e --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class BrowseEcho extends BrowseResponse implements EchoResponse { + + private Request request; + + public BrowseEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java new file mode 100644 index 0000000000..cdd44d474f --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ClearAllSynonymsEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public ClearAllSynonymsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java new file mode 100644 index 0000000000..48c9de8947 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ClearObjectsEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public ClearObjectsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java new file mode 100644 index 0000000000..6635fc2f72 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ClearRulesEcho extends UpdatedAtResponse implements EchoResponse { + + private Request request; + + public ClearRulesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java new file mode 100644 index 0000000000..6ce3846a09 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteApiKeyEcho + extends DeleteApiKeyResponse + implements EchoResponse { + + private Request request; + + public DeleteApiKeyEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java new file mode 100644 index 0000000000..6603c6d7f5 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteByEcho extends DeletedAtResponse implements EchoResponse { + + private Request request; + + public DeleteByEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java new file mode 100644 index 0000000000..3a1e2e715f --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteIndexEcho extends DeletedAtResponse implements EchoResponse { + + private Request request; + + public DeleteIndexEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java new file mode 100644 index 0000000000..091a9f4ab9 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteObjectEcho + extends DeletedAtResponse + implements EchoResponse { + + private Request request; + + public DeleteObjectEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java new file mode 100644 index 0000000000..d6388ab939 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteRuleEcho extends UpdatedAtResponse implements EchoResponse { + + private Request request; + + public DeleteRuleEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java new file mode 100644 index 0000000000..8cbf3cf861 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteSourceEcho + extends DeleteSourceResponse + implements EchoResponse { + + private Request request; + + public DeleteSourceEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java new file mode 100644 index 0000000000..3ab2a79678 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class DeleteSynonymEcho + extends DeletedAtResponse + implements EchoResponse { + + private Request request; + + public DeleteSynonymEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java new file mode 100644 index 0000000000..940c682e07 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java @@ -0,0 +1,5 @@ +package com.algolia.utils.echoResponse; + +public interface EchoResponse { + public String getPath(); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java new file mode 100644 index 0000000000..3bc7053675 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetApiKeyEcho extends KeyObject implements EchoResponse { + + private Request request; + + public GetApiKeyEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java new file mode 100644 index 0000000000..b87db9ea6c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java @@ -0,0 +1,20 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import java.util.HashMap; +import okhttp3.Request; + +public class GetDictionaryLanguagesEcho + extends HashMap + implements EchoResponse { + + private Request request; + + public GetDictionaryLanguagesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java new file mode 100644 index 0000000000..2736bf516c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetDictionarySettingsEcho + extends GetDictionarySettingsResponse + implements EchoResponse { + + private Request request; + + public GetDictionarySettingsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java new file mode 100644 index 0000000000..bd7c2e6e78 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetLogsEcho extends GetLogsResponse implements EchoResponse { + + private Request request; + + public GetLogsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java new file mode 100644 index 0000000000..69a42e6640 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java @@ -0,0 +1,20 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import java.util.HashMap; +import okhttp3.Request; + +public class GetObjectEcho + extends HashMap + implements EchoResponse { + + private Request request; + + public GetObjectEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java new file mode 100644 index 0000000000..946fe8adbd --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetObjectsEcho extends GetObjectsResponse implements EchoResponse { + + private Request request; + + public GetObjectsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java new file mode 100644 index 0000000000..a3a98958b3 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetRuleEcho extends Rule implements EchoResponse { + + private Request request; + + public GetRuleEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java new file mode 100644 index 0000000000..ebc3eafede --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetSettingsEcho extends IndexSettings implements EchoResponse { + + private Request request; + + public GetSettingsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java new file mode 100644 index 0000000000..9b80d44d34 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java @@ -0,0 +1,18 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import java.util.ArrayList; +import okhttp3.Request; + +public class GetSourcesEcho extends ArrayList implements EchoResponse { + + private Request request; + + public GetSourcesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java new file mode 100644 index 0000000000..c8e7686230 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetSynonymEcho extends SynonymHit implements EchoResponse { + + private Request request; + + public GetSynonymEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java new file mode 100644 index 0000000000..2eda445c1e --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetTaskEcho extends GetTaskResponse implements EchoResponse { + + private Request request; + + public GetTaskEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java new file mode 100644 index 0000000000..00f393f1d0 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetTopUserIdsEcho + extends GetTopUserIdsResponse + implements EchoResponse { + + private Request request; + + public GetTopUserIdsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java new file mode 100644 index 0000000000..735f090fd4 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class GetUserIdEcho extends UserId implements EchoResponse { + + private Request request; + + public GetUserIdEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java new file mode 100644 index 0000000000..fae53cc849 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class HasPendingMappingsEcho + extends CreatedAtResponse + implements EchoResponse { + + private Request request; + + public HasPendingMappingsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java new file mode 100644 index 0000000000..1104dd1277 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ListApiKeysEcho + extends ListApiKeysResponse + implements EchoResponse { + + private Request request; + + public ListApiKeysEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java new file mode 100644 index 0000000000..7dfb389b92 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ListClustersEcho + extends ListClustersResponse + implements EchoResponse { + + private Request request; + + public ListClustersEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java new file mode 100644 index 0000000000..5be91e2c5c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ListIndicesEcho + extends ListIndicesResponse + implements EchoResponse { + + private Request request; + + public ListIndicesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java new file mode 100644 index 0000000000..97933949af --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ListUserIdsEcho + extends ListUserIdsResponse + implements EchoResponse { + + private Request request; + + public ListUserIdsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java new file mode 100644 index 0000000000..43be1bd627 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class MultipleBatchEcho + extends MultipleBatchResponse + implements EchoResponse { + + private Request request; + + public MultipleBatchEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java new file mode 100644 index 0000000000..1c84b2e77b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class MultipleQueriesEcho + extends MultipleQueriesResponse + implements EchoResponse { + + private Request request; + + public MultipleQueriesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java new file mode 100644 index 0000000000..1924c6a189 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class OperationIndexEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public OperationIndexEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java new file mode 100644 index 0000000000..2900c7a613 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class PartialUpdateObjectEcho + extends UpdatedAtWithObjectIdResponse + implements EchoResponse { + + private Request request; + + public PartialUpdateObjectEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java new file mode 100644 index 0000000000..e96ce0bee1 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class RemoveUserIdEcho + extends RemoveUserIdResponse + implements EchoResponse { + + private Request request; + + public RemoveUserIdEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java new file mode 100644 index 0000000000..e38158daa3 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class ReplaceSourcesEcho + extends ReplaceSourceResponse + implements EchoResponse { + + private Request request; + + public ReplaceSourcesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java new file mode 100644 index 0000000000..55ade88f9d --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class RestoreApiKeyEcho + extends AddApiKeyResponse + implements EchoResponse { + + private Request request; + + public RestoreApiKeyEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java new file mode 100644 index 0000000000..19e1ee46e7 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SaveObjectEcho extends SaveObjectResponse implements EchoResponse { + + private Request request; + + public SaveObjectEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java new file mode 100644 index 0000000000..6ac7898d12 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SaveRuleEcho extends UpdatedRuleResponse implements EchoResponse { + + private Request request; + + public SaveRuleEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java new file mode 100644 index 0000000000..f3975407ee --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SaveSynonymEcho + extends SaveSynonymResponse + implements EchoResponse { + + private Request request; + + public SaveSynonymEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java new file mode 100644 index 0000000000..b7c508216e --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SaveSynonymsEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public SaveSynonymsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java new file mode 100644 index 0000000000..1d6f48596c --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchDictionaryEntriesEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public SearchDictionaryEntriesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java new file mode 100644 index 0000000000..bf016c8469 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchEcho extends SearchResponse implements EchoResponse { + + private Request request; + + public SearchEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java new file mode 100644 index 0000000000..a580602256 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchForFacetValuesEcho + extends SearchForFacetValuesResponse + implements EchoResponse { + + private Request request; + + public SearchForFacetValuesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java new file mode 100644 index 0000000000..f0cfb6b73b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchRulesEcho + extends SearchRulesResponse + implements EchoResponse { + + private Request request; + + public SearchRulesEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java new file mode 100644 index 0000000000..95159d7e31 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchSynonymsEcho + extends SearchSynonymsResponse + implements EchoResponse { + + private Request request; + + public SearchSynonymsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java new file mode 100644 index 0000000000..9708414ff2 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SearchUserIdsEcho + extends SearchUserIdsResponse + implements EchoResponse { + + private Request request; + + public SearchUserIdsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java new file mode 100644 index 0000000000..39b3e97487 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SetDictionarySettingsEcho + extends UpdatedAtResponse + implements EchoResponse { + + private Request request; + + public SetDictionarySettingsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java new file mode 100644 index 0000000000..fde58ed928 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java @@ -0,0 +1,17 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class SetSettingsEcho extends UpdatedAtResponse implements EchoResponse { + + private Request request; + + public SetSettingsEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java new file mode 100644 index 0000000000..251713d87b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java @@ -0,0 +1,19 @@ +package com.algolia.utils.echoResponse; + +import com.algolia.model.*; +import okhttp3.Request; + +public class UpdateApiKeyEcho + extends UpdateApiKeyResponse + implements EchoResponse { + + private Request request; + + public UpdateApiKeyEcho(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } +} diff --git a/clients/algoliasearch-client-java-2/pom.xml b/clients/algoliasearch-client-java-2/pom.xml index 86b619a5bd..f1d434e47f 100644 --- a/clients/algoliasearch-client-java-2/pom.xml +++ b/clients/algoliasearch-client-java-2/pom.xml @@ -67,22 +67,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M4 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - 10 - - maven-dependency-plugin diff --git a/clients/algoliasearch-client-java-2/utils/CallEcho.java b/clients/algoliasearch-client-java-2/utils/CallEcho.java new file mode 100644 index 0000000000..47b5fb8f58 --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/CallEcho.java @@ -0,0 +1,57 @@ +package com.algolia.utils; + +import java.io.IOException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Request; +import okhttp3.Response; +import okio.Timeout; + +public class CallEcho implements Call { + + private Request request; + + public CallEcho(Request request) { + this.request = request; + } + + public Request getRequest() { + return request; + } + + @Override + public Request request() { + return null; + } + + @Override + public void cancel() {} + + @Override + public Call clone() { + return null; + } + + @Override + public void enqueue(Callback arg0) {} + + @Override + public Response execute() throws IOException { + return null; + } + + @Override + public boolean isExecuted() { + return false; + } + + @Override + public boolean isCanceled() { + return false; + } + + @Override + public Timeout timeout() { + return null; + } +} diff --git a/clients/algoliasearch-client-java-2/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/utils/EchoRequester.java index f9a62971ad..7d573fcaae 100644 --- a/clients/algoliasearch-client-java-2/utils/EchoRequester.java +++ b/clients/algoliasearch-client-java-2/utils/EchoRequester.java @@ -5,8 +5,8 @@ public class EchoRequester implements Requester { - public Object newCall(Request request) throws ApiException { - return request; + public CallEcho newCall(Request request) throws ApiException { + return new CallEcho(request); } // NO-OP for now diff --git a/clients/algoliasearch-client-java-2/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/utils/HttpRequester.java index 25a8d29fed..1da39b461e 100644 --- a/clients/algoliasearch-client-java-2/utils/HttpRequester.java +++ b/clients/algoliasearch-client-java-2/utils/HttpRequester.java @@ -5,6 +5,7 @@ import com.algolia.ProgressResponseBody; import java.io.IOException; import java.util.concurrent.TimeUnit; +import okhttp3.Call; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -25,7 +26,7 @@ public HttpRequester() { httpClient = builder.build(); } - public Object newCall(Request request) throws ApiException { + public Call newCall(Request request) throws ApiException { return httpClient.newCall(request); } diff --git a/clients/algoliasearch-client-java-2/utils/Requester.java b/clients/algoliasearch-client-java-2/utils/Requester.java index 65f3ac4c35..9f7f262846 100644 --- a/clients/algoliasearch-client-java-2/utils/Requester.java +++ b/clients/algoliasearch-client-java-2/utils/Requester.java @@ -1,10 +1,11 @@ package com.algolia.utils; import com.algolia.ApiException; +import okhttp3.Call; import okhttp3.Request; public interface Requester { - public Object newCall(Request request) throws ApiException; + public Call newCall(Request request) throws ApiException; /** * Enable/disable debugging for this API client. diff --git a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java b/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java new file mode 100644 index 0000000000..940c682e07 --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java @@ -0,0 +1,5 @@ +package com.algolia.utils.echoResponse; + +public interface EchoResponse { + public String getPath(); +} diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh index 6e72096941..15fe0d2d96 100755 --- a/scripts/post-gen/java.sh +++ b/scripts/post-gen/java.sh @@ -15,7 +15,29 @@ find "$CLIENT" -type f -name "*.java" | xargs sed -i -e 's~= {}~= new Object()~g echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfintegerstring.java echo "package com.algolia.model;public class OneOfstringbuiltInOperation {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java -cp -R clients/algoliasearch-client-java-2/utils/ $CLIENT/algoliasearch-core/com/algolia/ +cp -R $CLIENT/utils/ $CLIENT/algoliasearch-core/com/algolia/ + +# Generate types for the EchoRequester, to be able to keep the correct response type on the API method. +# Extract the normal response to extend it +responses=($(grep -o 'public .*ApiCallback<.*>' $CLIENT/algoliasearch-core/com/algolia/**/*Api.java | sed 's/public.*ApiCallback$//; s/ //; s/^Map "${CLIENT}/algoliasearch-core/com/algolia/utils/echoResponse/${class}.java" << EOL + package com.algolia.utils.echoResponse; + import com.algolia.model.*; + import okhttp3.Request; + import java.util.ArrayList; + import java.util.HashMap; + public class $class extends $super implements EchoResponse { + private Request request; + public $class(Request request) { this.request = request; } + public String getPath() { return request.url().encodedPath(); } + } +EOL +done + format_client() { echo "> Formatting $GENERATOR..." diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 36bbd89612..991a5644dd 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -580,10 +580,10 @@ public class ApiClient { * @param body The request body object * @param headerParams The header parameters * @param callback Callback for upload/download progress - * @return The HTTP call or EchoRequester + * @return The HTTP call * @throws ApiException If fail to serialize the request body object */ - public Object buildCall(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws ApiException { + public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, body, headerParams, callback); return requester.newCall(request); diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 5c6fadc18d..d58c879b19 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -9,11 +9,11 @@ import {{invokerPackage}}.Pair; import com.google.gson.reflect.TypeToken; import okhttp3.Call; +import okhttp3.Request; import com.algolia.utils.*; - -{{#imports}}import {{import}}; -{{/imports}} +import com.algolia.utils.echoResponse.*; +import com.algolia.model.*; import java.lang.reflect.Type; {{^fullJavaUtil}} @@ -38,7 +38,7 @@ public class {{classname}} extends ApiClient { * Build call for {{operationId}}{{#allParams}} * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param _callback Callback for upload/download progress - * @return Call to execute or EchoRequest + * @return Call to execute * @throws ApiException If fail to serialize the request body object {{#isDeprecated}} * @deprecated @@ -51,7 +51,7 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - private Object {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}> _callback) throws ApiException { Object bodyObj = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; // create path and map variables @@ -82,7 +82,7 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - private Object {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + private Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}> _callback) throws ApiException { {{#allParams}}{{#required}} // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { @@ -109,15 +109,15 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public {{#returnType}} T {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { - Object req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - if(req instanceof Call) { - Call call = (Call)req; - {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); - ApiResponse<{{{.}}}> res = this.execute(call, returnType); - return (T)res.getData();{{/returnType}}{{^returnType}}this.execute(call).getData();{{/returnType}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + Call req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + if (req instanceof CallEcho) { + {{#returnType}}return new {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}Echo(((CallEcho)req).getRequest());{{/returnType}} } - {{#returnType}}return (T)req;{{/returnType}} + Call call = (Call)req; + {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); + ApiResponse<{{{.}}}> res = this.execute(call, returnType); + return res.getData();{{/returnType}}{{^returnType}}this.execute(call).getData();{{/returnType}} } /** * (asynchronously) @@ -138,7 +138,7 @@ public class {{classname}} extends ApiClient { @Deprecated {{/isDeprecated}} public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { - Call call = (Call){{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + Call call = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); {{#returnType}}Type returnType = new TypeToken<{{{returnType}}}>(){}.getType(); this.executeAsync(call, returnType, _callback);{{/returnType}}{{^returnType}}this.executeAsync(call, _callback);{{/returnType}} return call; diff --git a/templates/java/libraries/okhttp-gson/pom.mustache b/templates/java/libraries/okhttp-gson/pom.mustache index c366b27545..7f48155402 100644 --- a/templates/java/libraries/okhttp-gson/pom.mustache +++ b/templates/java/libraries/okhttp-gson/pom.mustache @@ -74,22 +74,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M4 - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - 10 - - maven-dependency-plugin From bf83fc556ab1f146fbeb6c8dc741f9545ba10939 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 18 Jan 2022 16:16:32 +0100 Subject: [PATCH 4/7] use existing request method --- .../com/algolia/search/SearchApi.java | 114 +++++++++--------- .../com/algolia/utils/CallEcho.java | 4 - .../utils/CallEcho.java | 4 - scripts/builds/clients.sh | 2 +- .../java/libraries/okhttp-gson/api.mustache | 2 +- 5 files changed, 59 insertions(+), 67 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 30a04ef76c..343e75deaf 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -84,7 +84,7 @@ private Call addApiKeyValidateBeforeCall( public AddApiKeyResponse addApiKey(ApiKey apiKey) throws ApiException { Call req = addApiKeyValidateBeforeCall(apiKey, null); if (req instanceof CallEcho) { - return new AddApiKeyEcho(((CallEcho) req).getRequest()); + return new AddApiKeyEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -208,7 +208,7 @@ public UpdatedAtWithObjectIdResponse addOrUpdateObject( null ); if (req instanceof CallEcho) { - return new AddOrUpdateObjectEcho(((CallEcho) req).getRequest()); + return new AddOrUpdateObjectEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -305,7 +305,7 @@ private Call appendSourceValidateBeforeCall( public CreatedAtResponse appendSource(Source source) throws ApiException { Call req = appendSourceValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new AppendSourceEcho(((CallEcho) req).getRequest()); + return new AppendSourceEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -416,7 +416,7 @@ public CreatedAtResponse assignUserId( null ); if (req instanceof CallEcho) { - return new AssignUserIdEcho(((CallEcho) req).getRequest()); + return new AssignUserIdEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -527,7 +527,7 @@ public BatchResponse batch( ) throws ApiException { Call req = batchValidateBeforeCall(indexName, batchWriteObject, null); if (req instanceof CallEcho) { - return new BatchEcho(((CallEcho) req).getRequest()); + return new BatchEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -644,7 +644,7 @@ public CreatedAtResponse batchAssignUserIds( null ); if (req instanceof CallEcho) { - return new BatchAssignUserIdsEcho(((CallEcho) req).getRequest()); + return new BatchAssignUserIdsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -764,7 +764,7 @@ public UpdatedAtResponse batchDictionaryEntries( null ); if (req instanceof CallEcho) { - return new BatchDictionaryEntriesEcho(((CallEcho) req).getRequest()); + return new BatchDictionaryEntriesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -910,7 +910,7 @@ public UpdatedAtResponse batchRules( null ); if (req instanceof CallEcho) { - return new BatchRulesEcho(((CallEcho) req).getRequest()); + return new BatchRulesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1022,7 +1022,7 @@ public BrowseResponse browse(String indexName, BrowseRequest browseRequest) throws ApiException { Call req = browseValidateBeforeCall(indexName, browseRequest, null); if (req instanceof CallEcho) { - return new BrowseEcho(((CallEcho) req).getRequest()); + return new BrowseEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1137,7 +1137,7 @@ public UpdatedAtResponse clearAllSynonyms( null ); if (req instanceof CallEcho) { - return new ClearAllSynonymsEcho(((CallEcho) req).getRequest()); + return new ClearAllSynonymsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1232,7 +1232,7 @@ private Call clearObjectsValidateBeforeCall( public UpdatedAtResponse clearObjects(String indexName) throws ApiException { Call req = clearObjectsValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new ClearObjectsEcho(((CallEcho) req).getRequest()); + return new ClearObjectsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1336,7 +1336,7 @@ public UpdatedAtResponse clearRules( ) throws ApiException { Call req = clearRulesValidateBeforeCall(indexName, forwardToReplicas, null); if (req instanceof CallEcho) { - return new ClearRulesEcho(((CallEcho) req).getRequest()); + return new ClearRulesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1431,7 +1431,7 @@ private Call deleteApiKeyValidateBeforeCall( public DeleteApiKeyResponse deleteApiKey(String key) throws ApiException { Call req = deleteApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new DeleteApiKeyEcho(((CallEcho) req).getRequest()); + return new DeleteApiKeyEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1535,7 +1535,7 @@ public DeletedAtResponse deleteBy( ) throws ApiException { Call req = deleteByValidateBeforeCall(indexName, searchParams, null); if (req instanceof CallEcho) { - return new DeleteByEcho(((CallEcho) req).getRequest()); + return new DeleteByEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1627,7 +1627,7 @@ private Call deleteIndexValidateBeforeCall( public DeletedAtResponse deleteIndex(String indexName) throws ApiException { Call req = deleteIndexValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new DeleteIndexEcho(((CallEcho) req).getRequest()); + return new DeleteIndexEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1731,7 +1731,7 @@ public DeletedAtResponse deleteObject(String indexName, String objectID) throws ApiException { Call req = deleteObjectValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new DeleteObjectEcho(((CallEcho) req).getRequest()); + return new DeleteObjectEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1857,7 +1857,7 @@ public UpdatedAtResponse deleteRule( null ); if (req instanceof CallEcho) { - return new DeleteRuleEcho(((CallEcho) req).getRequest()); + return new DeleteRuleEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1955,7 +1955,7 @@ private Call deleteSourceValidateBeforeCall( public DeleteSourceResponse deleteSource(String source) throws ApiException { Call req = deleteSourceValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new DeleteSourceEcho(((CallEcho) req).getRequest()); + return new DeleteSourceEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2079,7 +2079,7 @@ public DeletedAtResponse deleteSynonym( null ); if (req instanceof CallEcho) { - return new DeleteSynonymEcho(((CallEcho) req).getRequest()); + return new DeleteSynonymEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2177,7 +2177,7 @@ private Call getApiKeyValidateBeforeCall( public KeyObject getApiKey(String key) throws ApiException { Call req = getApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new GetApiKeyEcho(((CallEcho) req).getRequest()); + return new GetApiKeyEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2250,7 +2250,7 @@ private Call getDictionaryLanguagesValidateBeforeCall( public Map getDictionaryLanguages() throws ApiException { Call req = getDictionaryLanguagesValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetDictionaryLanguagesEcho(((CallEcho) req).getRequest()); + return new GetDictionaryLanguagesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -2322,7 +2322,7 @@ public GetDictionarySettingsResponse getDictionarySettings() throws ApiException { Call req = getDictionarySettingsValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetDictionarySettingsEcho(((CallEcho) req).getRequest()); + return new GetDictionarySettingsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -2441,7 +2441,7 @@ public GetLogsResponse getLogs( ) throws ApiException { Call req = getLogsValidateBeforeCall(offset, length, indexName, type, null); if (req instanceof CallEcho) { - return new GetLogsEcho(((CallEcho) req).getRequest()); + return new GetLogsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2581,7 +2581,7 @@ public Map getObject( null ); if (req instanceof CallEcho) { - return new GetObjectEcho(((CallEcho) req).getRequest()); + return new GetObjectEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -2676,7 +2676,7 @@ public GetObjectsResponse getObjects(GetObjectsObject getObjectsObject) throws ApiException { Call req = getObjectsValidateBeforeCall(getObjectsObject, null); if (req instanceof CallEcho) { - return new GetObjectsEcho(((CallEcho) req).getRequest()); + return new GetObjectsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2780,7 +2780,7 @@ private Call getRuleValidateBeforeCall( public Rule getRule(String indexName, String objectID) throws ApiException { Call req = getRuleValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new GetRuleEcho(((CallEcho) req).getRequest()); + return new GetRuleEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2870,7 +2870,7 @@ private Call getSettingsValidateBeforeCall( public IndexSettings getSettings(String indexName) throws ApiException { Call req = getSettingsValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new GetSettingsEcho(((CallEcho) req).getRequest()); + return new GetSettingsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2942,7 +2942,7 @@ private Call getSourcesValidateBeforeCall( public List getSources() throws ApiException { Call req = getSourcesValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetSourcesEcho(((CallEcho) req).getRequest()); + return new GetSourcesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -3043,7 +3043,7 @@ public SynonymHit getSynonym(String indexName, String objectID) throws ApiException { Call req = getSynonymValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new GetSynonymEcho(((CallEcho) req).getRequest()); + return new GetSynonymEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3149,7 +3149,7 @@ public GetTaskResponse getTask(String indexName, Integer taskID) throws ApiException { Call req = getTaskValidateBeforeCall(indexName, taskID, null); if (req instanceof CallEcho) { - return new GetTaskEcho(((CallEcho) req).getRequest()); + return new GetTaskEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3227,7 +3227,7 @@ private Call getTopUserIdsValidateBeforeCall( public GetTopUserIdsResponse getTopUserIds() throws ApiException { Call req = getTopUserIdsValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetTopUserIdsEcho(((CallEcho) req).getRequest()); + return new GetTopUserIdsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3319,7 +3319,7 @@ private Call getUserIdValidateBeforeCall( public UserId getUserId(String userID) throws ApiException { Call req = getUserIdValidateBeforeCall(userID, null); if (req instanceof CallEcho) { - return new GetUserIdEcho(((CallEcho) req).getRequest()); + return new GetUserIdEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3408,7 +3408,7 @@ public CreatedAtResponse hasPendingMappings(Boolean getClusters) throws ApiException { Call req = hasPendingMappingsValidateBeforeCall(getClusters, null); if (req instanceof CallEcho) { - return new HasPendingMappingsEcho(((CallEcho) req).getRequest()); + return new HasPendingMappingsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3485,7 +3485,7 @@ private Call listApiKeysValidateBeforeCall( public ListApiKeysResponse listApiKeys() throws ApiException { Call req = listApiKeysValidateBeforeCall(null); if (req instanceof CallEcho) { - return new ListApiKeysEcho(((CallEcho) req).getRequest()); + return new ListApiKeysEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3557,7 +3557,7 @@ private Call listClustersValidateBeforeCall( public ListClustersResponse listClusters() throws ApiException { Call req = listClustersValidateBeforeCall(null); if (req instanceof CallEcho) { - return new ListClustersEcho(((CallEcho) req).getRequest()); + return new ListClustersEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3641,7 +3641,7 @@ private Call listIndicesValidateBeforeCall( public ListIndicesResponse listIndices(Integer page) throws ApiException { Call req = listIndicesValidateBeforeCall(page, null); if (req instanceof CallEcho) { - return new ListIndicesEcho(((CallEcho) req).getRequest()); + return new ListIndicesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3740,7 +3740,7 @@ public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) throws ApiException { Call req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); if (req instanceof CallEcho) { - return new ListUserIdsEcho(((CallEcho) req).getRequest()); + return new ListUserIdsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3833,7 +3833,7 @@ public MultipleBatchResponse multipleBatch(BatchObject batchObject) throws ApiException { Call req = multipleBatchValidateBeforeCall(batchObject, null); if (req instanceof CallEcho) { - return new MultipleBatchEcho(((CallEcho) req).getRequest()); + return new MultipleBatchEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3921,7 +3921,7 @@ public MultipleQueriesResponse multipleQueries( ) throws ApiException { Call req = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); if (req instanceof CallEcho) { - return new MultipleQueriesEcho(((CallEcho) req).getRequest()); + return new MultipleQueriesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4031,7 +4031,7 @@ public UpdatedAtResponse operationIndex( null ); if (req instanceof CallEcho) { - return new OperationIndexEcho(((CallEcho) req).getRequest()); + return new OperationIndexEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4184,7 +4184,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( null ); if (req instanceof CallEcho) { - return new PartialUpdateObjectEcho(((CallEcho) req).getRequest()); + return new PartialUpdateObjectEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -4292,7 +4292,7 @@ private Call removeUserIdValidateBeforeCall( public RemoveUserIdResponse removeUserId(String userID) throws ApiException { Call req = removeUserIdValidateBeforeCall(userID, null); if (req instanceof CallEcho) { - return new RemoveUserIdEcho(((CallEcho) req).getRequest()); + return new RemoveUserIdEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4378,7 +4378,7 @@ public ReplaceSourceResponse replaceSources(List source) throws ApiException { Call req = replaceSourcesValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new ReplaceSourcesEcho(((CallEcho) req).getRequest()); + return new ReplaceSourcesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4466,7 +4466,7 @@ private Call restoreApiKeyValidateBeforeCall( public AddApiKeyResponse restoreApiKey(String key) throws ApiException { Call req = restoreApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new RestoreApiKeyEcho(((CallEcho) req).getRequest()); + return new RestoreApiKeyEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4566,7 +4566,7 @@ public SaveObjectResponse saveObject(String indexName, Object body) throws ApiException { Call req = saveObjectValidateBeforeCall(indexName, body, null); if (req instanceof CallEcho) { - return new SaveObjectEcho(((CallEcho) req).getRequest()); + return new SaveObjectEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4711,7 +4711,7 @@ public UpdatedRuleResponse saveRule( null ); if (req instanceof CallEcho) { - return new SaveRuleEcho(((CallEcho) req).getRequest()); + return new SaveRuleEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4867,7 +4867,7 @@ public SaveSynonymResponse saveSynonym( null ); if (req instanceof CallEcho) { - return new SaveSynonymEcho(((CallEcho) req).getRequest()); + return new SaveSynonymEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5022,7 +5022,7 @@ public UpdatedAtResponse saveSynonyms( null ); if (req instanceof CallEcho) { - return new SaveSynonymsEcho(((CallEcho) req).getRequest()); + return new SaveSynonymsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5137,7 +5137,7 @@ public SearchResponse search(String indexName, SearchParams searchParams) throws ApiException { Call req = searchValidateBeforeCall(indexName, searchParams, null); if (req instanceof CallEcho) { - return new SearchEcho(((CallEcho) req).getRequest()); + return new SearchEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5251,7 +5251,7 @@ public UpdatedAtResponse searchDictionaryEntries( null ); if (req instanceof CallEcho) { - return new SearchDictionaryEntriesEcho(((CallEcho) req).getRequest()); + return new SearchDictionaryEntriesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5379,7 +5379,7 @@ public SearchForFacetValuesResponse searchForFacetValues( null ); if (req instanceof CallEcho) { - return new SearchForFacetValuesEcho(((CallEcho) req).getRequest()); + return new SearchForFacetValuesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -5498,7 +5498,7 @@ public SearchRulesResponse searchRules( null ); if (req instanceof CallEcho) { - return new SearchRulesEcho(((CallEcho) req).getRequest()); + return new SearchRulesEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5648,7 +5648,7 @@ public SearchSynonymsResponse searchSynonyms( null ); if (req instanceof CallEcho) { - return new SearchSynonymsEcho(((CallEcho) req).getRequest()); + return new SearchSynonymsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5757,7 +5757,7 @@ public SearchUserIdsResponse searchUserIds( ) throws ApiException { Call req = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); if (req instanceof CallEcho) { - return new SearchUserIdsEcho(((CallEcho) req).getRequest()); + return new SearchUserIdsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5853,7 +5853,7 @@ public UpdatedAtResponse setDictionarySettings( null ); if (req instanceof CallEcho) { - return new SetDictionarySettingsEcho(((CallEcho) req).getRequest()); + return new SetDictionarySettingsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5982,7 +5982,7 @@ public UpdatedAtResponse setSettings( null ); if (req instanceof CallEcho) { - return new SetSettingsEcho(((CallEcho) req).getRequest()); + return new SetSettingsEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -6094,7 +6094,7 @@ public UpdateApiKeyResponse updateApiKey(String key, ApiKey apiKey) throws ApiException { Call req = updateApiKeyValidateBeforeCall(key, apiKey, null); if (req instanceof CallEcho) { - return new UpdateApiKeyEcho(((CallEcho) req).getRequest()); + return new UpdateApiKeyEcho(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java index 47b5fb8f58..e824cef028 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java @@ -15,10 +15,6 @@ public CallEcho(Request request) { this.request = request; } - public Request getRequest() { - return request; - } - @Override public Request request() { return null; diff --git a/clients/algoliasearch-client-java-2/utils/CallEcho.java b/clients/algoliasearch-client-java-2/utils/CallEcho.java index 47b5fb8f58..e824cef028 100644 --- a/clients/algoliasearch-client-java-2/utils/CallEcho.java +++ b/clients/algoliasearch-client-java-2/utils/CallEcho.java @@ -15,10 +15,6 @@ public CallEcho(Request request) { this.request = request; } - public Request getRequest() { - return request; - } - @Override public Request request() { return null; diff --git a/scripts/builds/clients.sh b/scripts/builds/clients.sh index aabb944e43..0b5cc3ffec 100755 --- a/scripts/builds/clients.sh +++ b/scripts/builds/clients.sh @@ -19,7 +19,7 @@ build_client(){ if [[ $lang == 'javascript' ]]; then yarn workspace $package build elif [[ $lang == 'java' ]]; then - CMD="mvn clean install -f clients/$package/pom.xml" + CMD="mvn install -f clients/$package/pom.xml" if [[ $VERBOSE == "true" ]]; then $CMD else diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index d58c879b19..80ac2a68dc 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -112,7 +112,7 @@ public class {{classname}} extends ApiClient { public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Call req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); if (req instanceof CallEcho) { - {{#returnType}}return new {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}Echo(((CallEcho)req).getRequest());{{/returnType}} + {{#returnType}}return new {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}Echo(((CallEcho)req).request());{{/returnType}} } Call call = (Call)req; {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); From 11b639c6d12f362e2daed17d2a249a85e66593c1 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 18 Jan 2022 16:49:33 +0100 Subject: [PATCH 5/7] fix echo --- .../algoliasearch-core/com/algolia/utils/CallEcho.java | 2 +- clients/algoliasearch-client-java-2/utils/CallEcho.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java index e824cef028..8b09c33532 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java @@ -17,7 +17,7 @@ public CallEcho(Request request) { @Override public Request request() { - return null; + return request; } @Override diff --git a/clients/algoliasearch-client-java-2/utils/CallEcho.java b/clients/algoliasearch-client-java-2/utils/CallEcho.java index e824cef028..8b09c33532 100644 --- a/clients/algoliasearch-client-java-2/utils/CallEcho.java +++ b/clients/algoliasearch-client-java-2/utils/CallEcho.java @@ -17,7 +17,7 @@ public CallEcho(Request request) { @Override public Request request() { - return null; + return request; } @Override From 4a9987bd55de4204c84f41848a8913ad2fb0d9b9 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Thu, 20 Jan 2022 14:56:31 +0100 Subject: [PATCH 6/7] put all echo response in the same file --- .../com/algolia/search/SearchApi.java | 122 +-- .../utils/echoResponse/AddApiKeyEcho.java | 17 - .../echoResponse/AddOrUpdateObjectEcho.java | 19 - .../utils/echoResponse/AppendSourceEcho.java | 19 - .../utils/echoResponse/AssignUserIdEcho.java | 19 - .../echoResponse/BatchAssignUserIdsEcho.java | 19 - .../BatchDictionaryEntriesEcho.java | 19 - .../algolia/utils/echoResponse/BatchEcho.java | 17 - .../utils/echoResponse/BatchRulesEcho.java | 17 - .../utils/echoResponse/BrowseEcho.java | 17 - .../echoResponse/ClearAllSynonymsEcho.java | 19 - .../utils/echoResponse/ClearObjectsEcho.java | 19 - .../utils/echoResponse/ClearRulesEcho.java | 17 - .../utils/echoResponse/DeleteApiKeyEcho.java | 19 - .../utils/echoResponse/DeleteByEcho.java | 17 - .../utils/echoResponse/DeleteIndexEcho.java | 17 - .../utils/echoResponse/DeleteObjectEcho.java | 19 - .../utils/echoResponse/DeleteRuleEcho.java | 17 - .../utils/echoResponse/DeleteSourceEcho.java | 19 - .../utils/echoResponse/DeleteSynonymEcho.java | 19 - .../utils/echoResponse/EchoResponse.java | 861 +++++++++++++++++- .../echoResponse/EchoResponseInterface.java} | 2 +- .../utils/echoResponse/GetApiKeyEcho.java | 17 - .../GetDictionaryLanguagesEcho.java | 20 - .../GetDictionarySettingsEcho.java | 19 - .../utils/echoResponse/GetLogsEcho.java | 17 - .../utils/echoResponse/GetObjectEcho.java | 20 - .../utils/echoResponse/GetObjectsEcho.java | 17 - .../utils/echoResponse/GetRuleEcho.java | 17 - .../utils/echoResponse/GetSettingsEcho.java | 17 - .../utils/echoResponse/GetSourcesEcho.java | 18 - .../utils/echoResponse/GetSynonymEcho.java | 17 - .../utils/echoResponse/GetTaskEcho.java | 17 - .../utils/echoResponse/GetTopUserIdsEcho.java | 19 - .../utils/echoResponse/GetUserIdEcho.java | 17 - .../echoResponse/HasPendingMappingsEcho.java | 19 - .../utils/echoResponse/ListApiKeysEcho.java | 19 - .../utils/echoResponse/ListClustersEcho.java | 19 - .../utils/echoResponse/ListIndicesEcho.java | 19 - .../utils/echoResponse/ListUserIdsEcho.java | 19 - .../utils/echoResponse/MultipleBatchEcho.java | 19 - .../echoResponse/MultipleQueriesEcho.java | 19 - .../echoResponse/OperationIndexEcho.java | 19 - .../echoResponse/PartialUpdateObjectEcho.java | 19 - .../utils/echoResponse/RemoveUserIdEcho.java | 19 - .../echoResponse/ReplaceSourcesEcho.java | 19 - .../utils/echoResponse/RestoreApiKeyEcho.java | 19 - .../utils/echoResponse/SaveObjectEcho.java | 17 - .../utils/echoResponse/SaveRuleEcho.java | 17 - .../utils/echoResponse/SaveSynonymEcho.java | 19 - .../utils/echoResponse/SaveSynonymsEcho.java | 19 - .../SearchDictionaryEntriesEcho.java | 19 - .../utils/echoResponse/SearchEcho.java | 17 - .../SearchForFacetValuesEcho.java | 19 - .../utils/echoResponse/SearchRulesEcho.java | 19 - .../echoResponse/SearchSynonymsEcho.java | 19 - .../utils/echoResponse/SearchUserIdsEcho.java | 19 - .../SetDictionarySettingsEcho.java | 19 - .../utils/echoResponse/SetSettingsEcho.java | 17 - .../utils/echoResponse/UpdateApiKeyEcho.java | 19 - .../echoResponse/EchoResponseInterface.java | 5 + scripts/post-gen/java.sh | 29 +- .../java/libraries/okhttp-gson/api.mustache | 4 +- 63 files changed, 947 insertions(+), 1120 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java rename clients/algoliasearch-client-java-2/{utils/echoResponse/EchoResponse.java => algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java} (63%) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java create mode 100644 clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 343e75deaf..ec36b8d5c9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -7,7 +7,7 @@ import com.algolia.Pair; import com.algolia.model.*; import com.algolia.utils.*; -import com.algolia.utils.echoResponse.*; +import com.algolia.utils.echoResponse.EchoResponse; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; @@ -84,7 +84,7 @@ private Call addApiKeyValidateBeforeCall( public AddApiKeyResponse addApiKey(ApiKey apiKey) throws ApiException { Call req = addApiKeyValidateBeforeCall(apiKey, null); if (req instanceof CallEcho) { - return new AddApiKeyEcho(((CallEcho) req).request()); + return new EchoResponse.AddApiKey(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -208,7 +208,7 @@ public UpdatedAtWithObjectIdResponse addOrUpdateObject( null ); if (req instanceof CallEcho) { - return new AddOrUpdateObjectEcho(((CallEcho) req).request()); + return new EchoResponse.AddOrUpdateObject(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -305,7 +305,7 @@ private Call appendSourceValidateBeforeCall( public CreatedAtResponse appendSource(Source source) throws ApiException { Call req = appendSourceValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new AppendSourceEcho(((CallEcho) req).request()); + return new EchoResponse.AppendSource(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -416,7 +416,7 @@ public CreatedAtResponse assignUserId( null ); if (req instanceof CallEcho) { - return new AssignUserIdEcho(((CallEcho) req).request()); + return new EchoResponse.AssignUserId(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -527,7 +527,7 @@ public BatchResponse batch( ) throws ApiException { Call req = batchValidateBeforeCall(indexName, batchWriteObject, null); if (req instanceof CallEcho) { - return new BatchEcho(((CallEcho) req).request()); + return new EchoResponse.Batch(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -644,7 +644,7 @@ public CreatedAtResponse batchAssignUserIds( null ); if (req instanceof CallEcho) { - return new BatchAssignUserIdsEcho(((CallEcho) req).request()); + return new EchoResponse.BatchAssignUserIds(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -764,7 +764,9 @@ public UpdatedAtResponse batchDictionaryEntries( null ); if (req instanceof CallEcho) { - return new BatchDictionaryEntriesEcho(((CallEcho) req).request()); + return new EchoResponse.BatchDictionaryEntries( + ((CallEcho) req).request() + ); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -910,7 +912,7 @@ public UpdatedAtResponse batchRules( null ); if (req instanceof CallEcho) { - return new BatchRulesEcho(((CallEcho) req).request()); + return new EchoResponse.BatchRules(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1022,7 +1024,7 @@ public BrowseResponse browse(String indexName, BrowseRequest browseRequest) throws ApiException { Call req = browseValidateBeforeCall(indexName, browseRequest, null); if (req instanceof CallEcho) { - return new BrowseEcho(((CallEcho) req).request()); + return new EchoResponse.Browse(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1137,7 +1139,7 @@ public UpdatedAtResponse clearAllSynonyms( null ); if (req instanceof CallEcho) { - return new ClearAllSynonymsEcho(((CallEcho) req).request()); + return new EchoResponse.ClearAllSynonyms(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1232,7 +1234,7 @@ private Call clearObjectsValidateBeforeCall( public UpdatedAtResponse clearObjects(String indexName) throws ApiException { Call req = clearObjectsValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new ClearObjectsEcho(((CallEcho) req).request()); + return new EchoResponse.ClearObjects(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1336,7 +1338,7 @@ public UpdatedAtResponse clearRules( ) throws ApiException { Call req = clearRulesValidateBeforeCall(indexName, forwardToReplicas, null); if (req instanceof CallEcho) { - return new ClearRulesEcho(((CallEcho) req).request()); + return new EchoResponse.ClearRules(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1431,7 +1433,7 @@ private Call deleteApiKeyValidateBeforeCall( public DeleteApiKeyResponse deleteApiKey(String key) throws ApiException { Call req = deleteApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new DeleteApiKeyEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteApiKey(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1535,7 +1537,7 @@ public DeletedAtResponse deleteBy( ) throws ApiException { Call req = deleteByValidateBeforeCall(indexName, searchParams, null); if (req instanceof CallEcho) { - return new DeleteByEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteBy(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1627,7 +1629,7 @@ private Call deleteIndexValidateBeforeCall( public DeletedAtResponse deleteIndex(String indexName) throws ApiException { Call req = deleteIndexValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new DeleteIndexEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteIndex(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1731,7 +1733,7 @@ public DeletedAtResponse deleteObject(String indexName, String objectID) throws ApiException { Call req = deleteObjectValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new DeleteObjectEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteObject(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1857,7 +1859,7 @@ public UpdatedAtResponse deleteRule( null ); if (req instanceof CallEcho) { - return new DeleteRuleEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteRule(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -1955,7 +1957,7 @@ private Call deleteSourceValidateBeforeCall( public DeleteSourceResponse deleteSource(String source) throws ApiException { Call req = deleteSourceValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new DeleteSourceEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteSource(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2079,7 +2081,7 @@ public DeletedAtResponse deleteSynonym( null ); if (req instanceof CallEcho) { - return new DeleteSynonymEcho(((CallEcho) req).request()); + return new EchoResponse.DeleteSynonym(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2177,7 +2179,7 @@ private Call getApiKeyValidateBeforeCall( public KeyObject getApiKey(String key) throws ApiException { Call req = getApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new GetApiKeyEcho(((CallEcho) req).request()); + return new EchoResponse.GetApiKey(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2250,7 +2252,9 @@ private Call getDictionaryLanguagesValidateBeforeCall( public Map getDictionaryLanguages() throws ApiException { Call req = getDictionaryLanguagesValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetDictionaryLanguagesEcho(((CallEcho) req).request()); + return new EchoResponse.GetDictionaryLanguages( + ((CallEcho) req).request() + ); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -2322,7 +2326,7 @@ public GetDictionarySettingsResponse getDictionarySettings() throws ApiException { Call req = getDictionarySettingsValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetDictionarySettingsEcho(((CallEcho) req).request()); + return new EchoResponse.GetDictionarySettings(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -2441,7 +2445,7 @@ public GetLogsResponse getLogs( ) throws ApiException { Call req = getLogsValidateBeforeCall(offset, length, indexName, type, null); if (req instanceof CallEcho) { - return new GetLogsEcho(((CallEcho) req).request()); + return new EchoResponse.GetLogs(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2581,7 +2585,7 @@ public Map getObject( null ); if (req instanceof CallEcho) { - return new GetObjectEcho(((CallEcho) req).request()); + return new EchoResponse.GetObject(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -2676,7 +2680,7 @@ public GetObjectsResponse getObjects(GetObjectsObject getObjectsObject) throws ApiException { Call req = getObjectsValidateBeforeCall(getObjectsObject, null); if (req instanceof CallEcho) { - return new GetObjectsEcho(((CallEcho) req).request()); + return new EchoResponse.GetObjects(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2780,7 +2784,7 @@ private Call getRuleValidateBeforeCall( public Rule getRule(String indexName, String objectID) throws ApiException { Call req = getRuleValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new GetRuleEcho(((CallEcho) req).request()); + return new EchoResponse.GetRule(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2870,7 +2874,7 @@ private Call getSettingsValidateBeforeCall( public IndexSettings getSettings(String indexName) throws ApiException { Call req = getSettingsValidateBeforeCall(indexName, null); if (req instanceof CallEcho) { - return new GetSettingsEcho(((CallEcho) req).request()); + return new EchoResponse.GetSettings(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -2942,7 +2946,7 @@ private Call getSourcesValidateBeforeCall( public List getSources() throws ApiException { Call req = getSourcesValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetSourcesEcho(((CallEcho) req).request()); + return new EchoResponse.GetSources(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken>() {}.getType(); @@ -3043,7 +3047,7 @@ public SynonymHit getSynonym(String indexName, String objectID) throws ApiException { Call req = getSynonymValidateBeforeCall(indexName, objectID, null); if (req instanceof CallEcho) { - return new GetSynonymEcho(((CallEcho) req).request()); + return new EchoResponse.GetSynonym(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3149,7 +3153,7 @@ public GetTaskResponse getTask(String indexName, Integer taskID) throws ApiException { Call req = getTaskValidateBeforeCall(indexName, taskID, null); if (req instanceof CallEcho) { - return new GetTaskEcho(((CallEcho) req).request()); + return new EchoResponse.GetTask(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3227,7 +3231,7 @@ private Call getTopUserIdsValidateBeforeCall( public GetTopUserIdsResponse getTopUserIds() throws ApiException { Call req = getTopUserIdsValidateBeforeCall(null); if (req instanceof CallEcho) { - return new GetTopUserIdsEcho(((CallEcho) req).request()); + return new EchoResponse.GetTopUserIds(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3319,7 +3323,7 @@ private Call getUserIdValidateBeforeCall( public UserId getUserId(String userID) throws ApiException { Call req = getUserIdValidateBeforeCall(userID, null); if (req instanceof CallEcho) { - return new GetUserIdEcho(((CallEcho) req).request()); + return new EchoResponse.GetUserId(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3408,7 +3412,7 @@ public CreatedAtResponse hasPendingMappings(Boolean getClusters) throws ApiException { Call req = hasPendingMappingsValidateBeforeCall(getClusters, null); if (req instanceof CallEcho) { - return new HasPendingMappingsEcho(((CallEcho) req).request()); + return new EchoResponse.HasPendingMappings(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3485,7 +3489,7 @@ private Call listApiKeysValidateBeforeCall( public ListApiKeysResponse listApiKeys() throws ApiException { Call req = listApiKeysValidateBeforeCall(null); if (req instanceof CallEcho) { - return new ListApiKeysEcho(((CallEcho) req).request()); + return new EchoResponse.ListApiKeys(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3557,7 +3561,7 @@ private Call listClustersValidateBeforeCall( public ListClustersResponse listClusters() throws ApiException { Call req = listClustersValidateBeforeCall(null); if (req instanceof CallEcho) { - return new ListClustersEcho(((CallEcho) req).request()); + return new EchoResponse.ListClusters(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3641,7 +3645,7 @@ private Call listIndicesValidateBeforeCall( public ListIndicesResponse listIndices(Integer page) throws ApiException { Call req = listIndicesValidateBeforeCall(page, null); if (req instanceof CallEcho) { - return new ListIndicesEcho(((CallEcho) req).request()); + return new EchoResponse.ListIndices(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3740,7 +3744,7 @@ public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) throws ApiException { Call req = listUserIdsValidateBeforeCall(page, hitsPerPage, null); if (req instanceof CallEcho) { - return new ListUserIdsEcho(((CallEcho) req).request()); + return new EchoResponse.ListUserIds(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3833,7 +3837,7 @@ public MultipleBatchResponse multipleBatch(BatchObject batchObject) throws ApiException { Call req = multipleBatchValidateBeforeCall(batchObject, null); if (req instanceof CallEcho) { - return new MultipleBatchEcho(((CallEcho) req).request()); + return new EchoResponse.MultipleBatch(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -3921,7 +3925,7 @@ public MultipleQueriesResponse multipleQueries( ) throws ApiException { Call req = multipleQueriesValidateBeforeCall(multipleQueriesObject, null); if (req instanceof CallEcho) { - return new MultipleQueriesEcho(((CallEcho) req).request()); + return new EchoResponse.MultipleQueries(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4031,7 +4035,7 @@ public UpdatedAtResponse operationIndex( null ); if (req instanceof CallEcho) { - return new OperationIndexEcho(((CallEcho) req).request()); + return new EchoResponse.OperationIndex(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4184,7 +4188,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( null ); if (req instanceof CallEcho) { - return new PartialUpdateObjectEcho(((CallEcho) req).request()); + return new EchoResponse.PartialUpdateObject(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -4292,7 +4296,7 @@ private Call removeUserIdValidateBeforeCall( public RemoveUserIdResponse removeUserId(String userID) throws ApiException { Call req = removeUserIdValidateBeforeCall(userID, null); if (req instanceof CallEcho) { - return new RemoveUserIdEcho(((CallEcho) req).request()); + return new EchoResponse.RemoveUserId(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4378,7 +4382,7 @@ public ReplaceSourceResponse replaceSources(List source) throws ApiException { Call req = replaceSourcesValidateBeforeCall(source, null); if (req instanceof CallEcho) { - return new ReplaceSourcesEcho(((CallEcho) req).request()); + return new EchoResponse.ReplaceSources(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4466,7 +4470,7 @@ private Call restoreApiKeyValidateBeforeCall( public AddApiKeyResponse restoreApiKey(String key) throws ApiException { Call req = restoreApiKeyValidateBeforeCall(key, null); if (req instanceof CallEcho) { - return new RestoreApiKeyEcho(((CallEcho) req).request()); + return new EchoResponse.RestoreApiKey(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4566,7 +4570,7 @@ public SaveObjectResponse saveObject(String indexName, Object body) throws ApiException { Call req = saveObjectValidateBeforeCall(indexName, body, null); if (req instanceof CallEcho) { - return new SaveObjectEcho(((CallEcho) req).request()); + return new EchoResponse.SaveObject(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4711,7 +4715,7 @@ public UpdatedRuleResponse saveRule( null ); if (req instanceof CallEcho) { - return new SaveRuleEcho(((CallEcho) req).request()); + return new EchoResponse.SaveRule(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -4867,7 +4871,7 @@ public SaveSynonymResponse saveSynonym( null ); if (req instanceof CallEcho) { - return new SaveSynonymEcho(((CallEcho) req).request()); + return new EchoResponse.SaveSynonym(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5022,7 +5026,7 @@ public UpdatedAtResponse saveSynonyms( null ); if (req instanceof CallEcho) { - return new SaveSynonymsEcho(((CallEcho) req).request()); + return new EchoResponse.SaveSynonyms(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5137,7 +5141,7 @@ public SearchResponse search(String indexName, SearchParams searchParams) throws ApiException { Call req = searchValidateBeforeCall(indexName, searchParams, null); if (req instanceof CallEcho) { - return new SearchEcho(((CallEcho) req).request()); + return new EchoResponse.Search(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5251,7 +5255,9 @@ public UpdatedAtResponse searchDictionaryEntries( null ); if (req instanceof CallEcho) { - return new SearchDictionaryEntriesEcho(((CallEcho) req).request()); + return new EchoResponse.SearchDictionaryEntries( + ((CallEcho) req).request() + ); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5379,7 +5385,7 @@ public SearchForFacetValuesResponse searchForFacetValues( null ); if (req instanceof CallEcho) { - return new SearchForFacetValuesEcho(((CallEcho) req).request()); + return new EchoResponse.SearchForFacetValues(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {} @@ -5498,7 +5504,7 @@ public SearchRulesResponse searchRules( null ); if (req instanceof CallEcho) { - return new SearchRulesEcho(((CallEcho) req).request()); + return new EchoResponse.SearchRules(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5648,7 +5654,7 @@ public SearchSynonymsResponse searchSynonyms( null ); if (req instanceof CallEcho) { - return new SearchSynonymsEcho(((CallEcho) req).request()); + return new EchoResponse.SearchSynonyms(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5757,7 +5763,7 @@ public SearchUserIdsResponse searchUserIds( ) throws ApiException { Call req = searchUserIdsValidateBeforeCall(searchUserIdsObject, null); if (req instanceof CallEcho) { - return new SearchUserIdsEcho(((CallEcho) req).request()); + return new EchoResponse.SearchUserIds(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5853,7 +5859,7 @@ public UpdatedAtResponse setDictionarySettings( null ); if (req instanceof CallEcho) { - return new SetDictionarySettingsEcho(((CallEcho) req).request()); + return new EchoResponse.SetDictionarySettings(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -5982,7 +5988,7 @@ public UpdatedAtResponse setSettings( null ); if (req instanceof CallEcho) { - return new SetSettingsEcho(((CallEcho) req).request()); + return new EchoResponse.SetSettings(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); @@ -6094,7 +6100,7 @@ public UpdateApiKeyResponse updateApiKey(String key, ApiKey apiKey) throws ApiException { Call req = updateApiKeyValidateBeforeCall(key, apiKey, null); if (req instanceof CallEcho) { - return new UpdateApiKeyEcho(((CallEcho) req).request()); + return new EchoResponse.UpdateApiKey(((CallEcho) req).request()); } Call call = (Call) req; Type returnType = new TypeToken() {}.getType(); diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java deleted file mode 100644 index b9ebb0b865..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddApiKeyEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class AddApiKeyEcho extends AddApiKeyResponse implements EchoResponse { - - private Request request; - - public AddApiKeyEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java deleted file mode 100644 index 0f97e4e507..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AddOrUpdateObjectEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class AddOrUpdateObjectEcho - extends UpdatedAtWithObjectIdResponse - implements EchoResponse { - - private Request request; - - public AddOrUpdateObjectEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java deleted file mode 100644 index dfb231060b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AppendSourceEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class AppendSourceEcho - extends CreatedAtResponse - implements EchoResponse { - - private Request request; - - public AppendSourceEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java deleted file mode 100644 index 4200f41855..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/AssignUserIdEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class AssignUserIdEcho - extends CreatedAtResponse - implements EchoResponse { - - private Request request; - - public AssignUserIdEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java deleted file mode 100644 index 6889b7f4a4..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchAssignUserIdsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class BatchAssignUserIdsEcho - extends CreatedAtResponse - implements EchoResponse { - - private Request request; - - public BatchAssignUserIdsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java deleted file mode 100644 index 3db0be088a..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchDictionaryEntriesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class BatchDictionaryEntriesEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public BatchDictionaryEntriesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java deleted file mode 100644 index 56ef0cd47d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class BatchEcho extends BatchResponse implements EchoResponse { - - private Request request; - - public BatchEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java deleted file mode 100644 index 02dce3f19d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BatchRulesEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class BatchRulesEcho extends UpdatedAtResponse implements EchoResponse { - - private Request request; - - public BatchRulesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java deleted file mode 100644 index bae0c5121e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/BrowseEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class BrowseEcho extends BrowseResponse implements EchoResponse { - - private Request request; - - public BrowseEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java deleted file mode 100644 index cdd44d474f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearAllSynonymsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ClearAllSynonymsEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public ClearAllSynonymsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java deleted file mode 100644 index 48c9de8947..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearObjectsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ClearObjectsEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public ClearObjectsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java deleted file mode 100644 index 6635fc2f72..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ClearRulesEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ClearRulesEcho extends UpdatedAtResponse implements EchoResponse { - - private Request request; - - public ClearRulesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java deleted file mode 100644 index 6ce3846a09..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteApiKeyEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteApiKeyEcho - extends DeleteApiKeyResponse - implements EchoResponse { - - private Request request; - - public DeleteApiKeyEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java deleted file mode 100644 index 6603c6d7f5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteByEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteByEcho extends DeletedAtResponse implements EchoResponse { - - private Request request; - - public DeleteByEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java deleted file mode 100644 index 3a1e2e715f..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteIndexEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteIndexEcho extends DeletedAtResponse implements EchoResponse { - - private Request request; - - public DeleteIndexEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java deleted file mode 100644 index 091a9f4ab9..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteObjectEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteObjectEcho - extends DeletedAtResponse - implements EchoResponse { - - private Request request; - - public DeleteObjectEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java deleted file mode 100644 index d6388ab939..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteRuleEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteRuleEcho extends UpdatedAtResponse implements EchoResponse { - - private Request request; - - public DeleteRuleEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java deleted file mode 100644 index 8cbf3cf861..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSourceEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteSourceEcho - extends DeleteSourceResponse - implements EchoResponse { - - private Request request; - - public DeleteSourceEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java deleted file mode 100644 index 3ab2a79678..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/DeleteSynonymEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class DeleteSynonymEcho - extends DeletedAtResponse - implements EchoResponse { - - private Request request; - - public DeleteSynonymEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java index 940c682e07..bd1503198e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java @@ -1,5 +1,862 @@ package com.algolia.utils.echoResponse; -public interface EchoResponse { - public String getPath(); +import com.algolia.model.*; +import java.util.ArrayList; +import java.util.HashMap; +import okhttp3.Request; + +public class EchoResponse { + + public static class AddApiKey + extends AddApiKeyResponse + implements EchoResponseInterface { + + private Request request; + + public AddApiKey(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class AddOrUpdateObject + extends UpdatedAtWithObjectIdResponse + implements EchoResponseInterface { + + private Request request; + + public AddOrUpdateObject(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class AppendSource + extends CreatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public AppendSource(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class AssignUserId + extends CreatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public AssignUserId(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class Batch + extends BatchResponse + implements EchoResponseInterface { + + private Request request; + + public Batch(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class BatchAssignUserIds + extends CreatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public BatchAssignUserIds(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class BatchDictionaryEntries + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public BatchDictionaryEntries(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class BatchRules + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public BatchRules(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class Browse + extends BrowseResponse + implements EchoResponseInterface { + + private Request request; + + public Browse(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ClearAllSynonyms + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public ClearAllSynonyms(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ClearObjects + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public ClearObjects(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ClearRules + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public ClearRules(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteApiKey + extends DeleteApiKeyResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteApiKey(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteBy + extends DeletedAtResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteBy(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteIndex + extends DeletedAtResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteIndex(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteObject + extends DeletedAtResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteObject(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteRule + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteRule(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteSource + extends DeleteSourceResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteSource(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class DeleteSynonym + extends DeletedAtResponse + implements EchoResponseInterface { + + private Request request; + + public DeleteSynonym(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetApiKey + extends KeyObject + implements EchoResponseInterface { + + private Request request; + + public GetApiKey(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetDictionaryLanguages + extends HashMap + implements EchoResponseInterface { + + private Request request; + + public GetDictionaryLanguages(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetDictionarySettings + extends GetDictionarySettingsResponse + implements EchoResponseInterface { + + private Request request; + + public GetDictionarySettings(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetLogs + extends GetLogsResponse + implements EchoResponseInterface { + + private Request request; + + public GetLogs(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetObject + extends HashMap + implements EchoResponseInterface { + + private Request request; + + public GetObject(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetObjects + extends GetObjectsResponse + implements EchoResponseInterface { + + private Request request; + + public GetObjects(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetRule extends Rule implements EchoResponseInterface { + + private Request request; + + public GetRule(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetSettings + extends IndexSettings + implements EchoResponseInterface { + + private Request request; + + public GetSettings(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetSources + extends ArrayList + implements EchoResponseInterface { + + private Request request; + + public GetSources(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetSynonym + extends SynonymHit + implements EchoResponseInterface { + + private Request request; + + public GetSynonym(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetTask + extends GetTaskResponse + implements EchoResponseInterface { + + private Request request; + + public GetTask(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetTopUserIds + extends GetTopUserIdsResponse + implements EchoResponseInterface { + + private Request request; + + public GetTopUserIds(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class GetUserId + extends UserId + implements EchoResponseInterface { + + private Request request; + + public GetUserId(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class HasPendingMappings + extends CreatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public HasPendingMappings(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ListApiKeys + extends ListApiKeysResponse + implements EchoResponseInterface { + + private Request request; + + public ListApiKeys(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ListClusters + extends ListClustersResponse + implements EchoResponseInterface { + + private Request request; + + public ListClusters(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ListIndices + extends ListIndicesResponse + implements EchoResponseInterface { + + private Request request; + + public ListIndices(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ListUserIds + extends ListUserIdsResponse + implements EchoResponseInterface { + + private Request request; + + public ListUserIds(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class MultipleBatch + extends MultipleBatchResponse + implements EchoResponseInterface { + + private Request request; + + public MultipleBatch(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class MultipleQueries + extends MultipleQueriesResponse + implements EchoResponseInterface { + + private Request request; + + public MultipleQueries(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class OperationIndex + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public OperationIndex(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class PartialUpdateObject + extends UpdatedAtWithObjectIdResponse + implements EchoResponseInterface { + + private Request request; + + public PartialUpdateObject(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class RemoveUserId + extends RemoveUserIdResponse + implements EchoResponseInterface { + + private Request request; + + public RemoveUserId(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class ReplaceSources + extends ReplaceSourceResponse + implements EchoResponseInterface { + + private Request request; + + public ReplaceSources(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class RestoreApiKey + extends AddApiKeyResponse + implements EchoResponseInterface { + + private Request request; + + public RestoreApiKey(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SaveObject + extends SaveObjectResponse + implements EchoResponseInterface { + + private Request request; + + public SaveObject(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SaveRule + extends UpdatedRuleResponse + implements EchoResponseInterface { + + private Request request; + + public SaveRule(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SaveSynonym + extends SaveSynonymResponse + implements EchoResponseInterface { + + private Request request; + + public SaveSynonym(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SaveSynonyms + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public SaveSynonyms(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class Search + extends SearchResponse + implements EchoResponseInterface { + + private Request request; + + public Search(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SearchDictionaryEntries + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public SearchDictionaryEntries(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SearchForFacetValues + extends SearchForFacetValuesResponse + implements EchoResponseInterface { + + private Request request; + + public SearchForFacetValues(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SearchRules + extends SearchRulesResponse + implements EchoResponseInterface { + + private Request request; + + public SearchRules(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SearchSynonyms + extends SearchSynonymsResponse + implements EchoResponseInterface { + + private Request request; + + public SearchSynonyms(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SearchUserIds + extends SearchUserIdsResponse + implements EchoResponseInterface { + + private Request request; + + public SearchUserIds(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SetDictionarySettings + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public SetDictionarySettings(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class SetSettings + extends UpdatedAtResponse + implements EchoResponseInterface { + + private Request request; + + public SetSettings(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } + + public static class UpdateApiKey + extends UpdateApiKeyResponse + implements EchoResponseInterface { + + private Request request; + + public UpdateApiKey(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + } } diff --git a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java similarity index 63% rename from clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java index 940c682e07..f1b1ba7349 100644 --- a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java @@ -1,5 +1,5 @@ package com.algolia.utils.echoResponse; -public interface EchoResponse { +public interface EchoResponseInterface { public String getPath(); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java deleted file mode 100644 index 3bc7053675..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetApiKeyEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetApiKeyEcho extends KeyObject implements EchoResponse { - - private Request request; - - public GetApiKeyEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java deleted file mode 100644 index b87db9ea6c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionaryLanguagesEcho.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import java.util.HashMap; -import okhttp3.Request; - -public class GetDictionaryLanguagesEcho - extends HashMap - implements EchoResponse { - - private Request request; - - public GetDictionaryLanguagesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java deleted file mode 100644 index 2736bf516c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetDictionarySettingsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetDictionarySettingsEcho - extends GetDictionarySettingsResponse - implements EchoResponse { - - private Request request; - - public GetDictionarySettingsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java deleted file mode 100644 index bd7c2e6e78..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetLogsEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetLogsEcho extends GetLogsResponse implements EchoResponse { - - private Request request; - - public GetLogsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java deleted file mode 100644 index 69a42e6640..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectEcho.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import java.util.HashMap; -import okhttp3.Request; - -public class GetObjectEcho - extends HashMap - implements EchoResponse { - - private Request request; - - public GetObjectEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java deleted file mode 100644 index 946fe8adbd..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetObjectsEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetObjectsEcho extends GetObjectsResponse implements EchoResponse { - - private Request request; - - public GetObjectsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java deleted file mode 100644 index a3a98958b3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetRuleEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetRuleEcho extends Rule implements EchoResponse { - - private Request request; - - public GetRuleEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java deleted file mode 100644 index ebc3eafede..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSettingsEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetSettingsEcho extends IndexSettings implements EchoResponse { - - private Request request; - - public GetSettingsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java deleted file mode 100644 index 9b80d44d34..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSourcesEcho.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import java.util.ArrayList; -import okhttp3.Request; - -public class GetSourcesEcho extends ArrayList implements EchoResponse { - - private Request request; - - public GetSourcesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java deleted file mode 100644 index c8e7686230..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetSynonymEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetSynonymEcho extends SynonymHit implements EchoResponse { - - private Request request; - - public GetSynonymEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java deleted file mode 100644 index 2eda445c1e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTaskEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetTaskEcho extends GetTaskResponse implements EchoResponse { - - private Request request; - - public GetTaskEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java deleted file mode 100644 index 00f393f1d0..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetTopUserIdsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetTopUserIdsEcho - extends GetTopUserIdsResponse - implements EchoResponse { - - private Request request; - - public GetTopUserIdsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java deleted file mode 100644 index 735f090fd4..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/GetUserIdEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class GetUserIdEcho extends UserId implements EchoResponse { - - private Request request; - - public GetUserIdEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java deleted file mode 100644 index fae53cc849..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/HasPendingMappingsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class HasPendingMappingsEcho - extends CreatedAtResponse - implements EchoResponse { - - private Request request; - - public HasPendingMappingsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java deleted file mode 100644 index 1104dd1277..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListApiKeysEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ListApiKeysEcho - extends ListApiKeysResponse - implements EchoResponse { - - private Request request; - - public ListApiKeysEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java deleted file mode 100644 index 7dfb389b92..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListClustersEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ListClustersEcho - extends ListClustersResponse - implements EchoResponse { - - private Request request; - - public ListClustersEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java deleted file mode 100644 index 5be91e2c5c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListIndicesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ListIndicesEcho - extends ListIndicesResponse - implements EchoResponse { - - private Request request; - - public ListIndicesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java deleted file mode 100644 index 97933949af..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ListUserIdsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ListUserIdsEcho - extends ListUserIdsResponse - implements EchoResponse { - - private Request request; - - public ListUserIdsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java deleted file mode 100644 index 43be1bd627..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleBatchEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class MultipleBatchEcho - extends MultipleBatchResponse - implements EchoResponse { - - private Request request; - - public MultipleBatchEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java deleted file mode 100644 index 1c84b2e77b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/MultipleQueriesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class MultipleQueriesEcho - extends MultipleQueriesResponse - implements EchoResponse { - - private Request request; - - public MultipleQueriesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java deleted file mode 100644 index 1924c6a189..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/OperationIndexEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class OperationIndexEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public OperationIndexEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java deleted file mode 100644 index 2900c7a613..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/PartialUpdateObjectEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class PartialUpdateObjectEcho - extends UpdatedAtWithObjectIdResponse - implements EchoResponse { - - private Request request; - - public PartialUpdateObjectEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java deleted file mode 100644 index e96ce0bee1..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RemoveUserIdEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class RemoveUserIdEcho - extends RemoveUserIdResponse - implements EchoResponse { - - private Request request; - - public RemoveUserIdEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java deleted file mode 100644 index e38158daa3..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/ReplaceSourcesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class ReplaceSourcesEcho - extends ReplaceSourceResponse - implements EchoResponse { - - private Request request; - - public ReplaceSourcesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java deleted file mode 100644 index 55ade88f9d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/RestoreApiKeyEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class RestoreApiKeyEcho - extends AddApiKeyResponse - implements EchoResponse { - - private Request request; - - public RestoreApiKeyEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java deleted file mode 100644 index 19e1ee46e7..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveObjectEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SaveObjectEcho extends SaveObjectResponse implements EchoResponse { - - private Request request; - - public SaveObjectEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java deleted file mode 100644 index 6ac7898d12..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveRuleEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SaveRuleEcho extends UpdatedRuleResponse implements EchoResponse { - - private Request request; - - public SaveRuleEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java deleted file mode 100644 index f3975407ee..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SaveSynonymEcho - extends SaveSynonymResponse - implements EchoResponse { - - private Request request; - - public SaveSynonymEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java deleted file mode 100644 index b7c508216e..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SaveSynonymsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SaveSynonymsEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public SaveSynonymsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java deleted file mode 100644 index 1d6f48596c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchDictionaryEntriesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchDictionaryEntriesEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public SearchDictionaryEntriesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java deleted file mode 100644 index bf016c8469..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchEcho extends SearchResponse implements EchoResponse { - - private Request request; - - public SearchEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java deleted file mode 100644 index a580602256..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchForFacetValuesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchForFacetValuesEcho - extends SearchForFacetValuesResponse - implements EchoResponse { - - private Request request; - - public SearchForFacetValuesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java deleted file mode 100644 index f0cfb6b73b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchRulesEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchRulesEcho - extends SearchRulesResponse - implements EchoResponse { - - private Request request; - - public SearchRulesEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java deleted file mode 100644 index 95159d7e31..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchSynonymsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchSynonymsEcho - extends SearchSynonymsResponse - implements EchoResponse { - - private Request request; - - public SearchSynonymsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java deleted file mode 100644 index 9708414ff2..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SearchUserIdsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SearchUserIdsEcho - extends SearchUserIdsResponse - implements EchoResponse { - - private Request request; - - public SearchUserIdsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java deleted file mode 100644 index 39b3e97487..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetDictionarySettingsEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SetDictionarySettingsEcho - extends UpdatedAtResponse - implements EchoResponse { - - private Request request; - - public SetDictionarySettingsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java deleted file mode 100644 index fde58ed928..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/SetSettingsEcho.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class SetSettingsEcho extends UpdatedAtResponse implements EchoResponse { - - private Request request; - - public SetSettingsEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java deleted file mode 100644 index 251713d87b..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/UpdateApiKeyEcho.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.algolia.utils.echoResponse; - -import com.algolia.model.*; -import okhttp3.Request; - -public class UpdateApiKeyEcho - extends UpdateApiKeyResponse - implements EchoResponse { - - private Request request; - - public UpdateApiKeyEcho(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } -} diff --git a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java new file mode 100644 index 0000000000..f1b1ba7349 --- /dev/null +++ b/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java @@ -0,0 +1,5 @@ +package com.algolia.utils.echoResponse; + +public interface EchoResponseInterface { + public String getPath(); +} diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh index 15fe0d2d96..7a2cc6a502 100755 --- a/scripts/post-gen/java.sh +++ b/scripts/post-gen/java.sh @@ -18,25 +18,28 @@ echo "package com.algolia.model;public class OneOfstringbuiltInOperation {}" > $ cp -R $CLIENT/utils/ $CLIENT/algoliasearch-core/com/algolia/ # Generate types for the EchoRequester, to be able to keep the correct response type on the API method. + +# Create the file to hold all the EchoResponse +echo "package com.algolia.utils.echoResponse; \ + import com.algolia.model.*; \ + import okhttp3.Request; \ + import java.util.ArrayList; \ + import java.util.HashMap; \ + public class EchoResponse {" > $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java + # Extract the normal response to extend it responses=($(grep -o 'public .*ApiCallback<.*>' $CLIENT/algoliasearch-core/com/algolia/**/*Api.java | sed 's/public.*ApiCallback$//; s/ //; s/^Map "${CLIENT}/algoliasearch-core/com/algolia/utils/echoResponse/${class}.java" << EOL - package com.algolia.utils.echoResponse; - import com.algolia.model.*; - import okhttp3.Request; - import java.util.ArrayList; - import java.util.HashMap; - public class $class extends $super implements EchoResponse { - private Request request; - public $class(Request request) { this.request = request; } - public String getPath() { return request.url().encodedPath(); } - } -EOL + echo -e "static public class $class extends $super implements EchoResponseInterface { \ + private Request request; \ + public $class(Request request) { this.request = request; } \ + public String getPath() { return request.url().encodedPath(); } \ + }" >> $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java done +echo '}' >> $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java format_client() { diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 80ac2a68dc..313a724e47 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -12,7 +12,7 @@ import okhttp3.Call; import okhttp3.Request; import com.algolia.utils.*; -import com.algolia.utils.echoResponse.*; +import com.algolia.utils.echoResponse.EchoResponse; import com.algolia.model.*; import java.lang.reflect.Type; @@ -112,7 +112,7 @@ public class {{classname}} extends ApiClient { public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { Call req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); if (req instanceof CallEcho) { - {{#returnType}}return new {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}Echo(((CallEcho)req).request());{{/returnType}} + {{#returnType}}return new EchoResponse.{{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}(((CallEcho)req).request());{{/returnType}} } Call call = (Call)req; {{#returnType}}Type returnType = new TypeToken<{{{.}}}>(){}.getType(); From 584b70e361fed74d64f8c6449fea8938f0f1ab34 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Thu, 20 Jan 2022 16:03:39 +0100 Subject: [PATCH 7/7] review and use mustache --- .../com/algolia/search/SearchApi.java | 2 +- .../algolia/utils/{ => echo}/CallEcho.java | 2 +- .../utils/{ => echo}/EchoRequester.java | 3 +- .../{echoResponse => echo}/EchoResponse.java | 471 +++++++++++++++++- .../utils/echo/EchoResponseInterface.java | 9 + .../echoResponse/EchoResponseInterface.java | 5 - .../utils/CallEcho.java | 53 -- .../utils/EchoRequester.java | 33 -- .../utils/HttpRequester.java | 107 ---- .../utils/Requester.java | 61 --- .../echoResponse/EchoResponseInterface.java | 5 - package.json | 5 +- scripts/post-gen/java.sh | 20 +- scripts/post-gen/javaEchoResponse.mustache | 44 ++ .../java/libraries/okhttp-gson/api.mustache | 2 +- tests/package.json | 1 - yarn.lock | 1 + 17 files changed, 536 insertions(+), 288 deletions(-) rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/{ => echo}/CallEcho.java (96%) rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/{ => echo}/EchoRequester.java (89%) rename clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/{echoResponse => echo}/EchoResponse.java (66%) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java delete mode 100644 clients/algoliasearch-client-java-2/utils/CallEcho.java delete mode 100644 clients/algoliasearch-client-java-2/utils/EchoRequester.java delete mode 100644 clients/algoliasearch-client-java-2/utils/HttpRequester.java delete mode 100644 clients/algoliasearch-client-java-2/utils/Requester.java delete mode 100644 clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java create mode 100644 scripts/post-gen/javaEchoResponse.mustache diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index ec36b8d5c9..617174e492 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -7,7 +7,7 @@ import com.algolia.Pair; import com.algolia.model.*; import com.algolia.utils.*; -import com.algolia.utils.echoResponse.EchoResponse; +import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.lang.reflect.Type; import java.util.ArrayList; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java similarity index 96% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java index 8b09c33532..1712669790 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/CallEcho.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/CallEcho.java @@ -1,4 +1,4 @@ -package com.algolia.utils; +package com.algolia.utils.echo; import java.io.IOException; import okhttp3.Call; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java similarity index 89% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java index 7d573fcaae..7719400fcd 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/EchoRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoRequester.java @@ -1,6 +1,7 @@ -package com.algolia.utils; +package com.algolia.utils.echo; import com.algolia.ApiException; +import com.algolia.utils.Requester; import okhttp3.Request; public class EchoRequester implements Requester { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java similarity index 66% rename from clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java index bd1503198e..0994a516b0 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java @@ -1,12 +1,25 @@ -package com.algolia.utils.echoResponse; +package com.algolia.utils.echo; import com.algolia.model.*; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import okhttp3.Request; +import okio.Buffer; public class EchoResponse { + private static String parseRequestBody(Request req) { + try { + final Request copy = req.newBuilder().build(); + final Buffer buffer = new Buffer(); + copy.body().writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + return "error"; + } + } + public static class AddApiKey extends AddApiKeyResponse implements EchoResponseInterface { @@ -20,6 +33,14 @@ public AddApiKey(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class AddOrUpdateObject @@ -35,6 +56,14 @@ public AddOrUpdateObject(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class AppendSource @@ -50,6 +79,14 @@ public AppendSource(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class AssignUserId @@ -65,6 +102,14 @@ public AssignUserId(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class Batch @@ -80,6 +125,14 @@ public Batch(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class BatchAssignUserIds @@ -95,6 +148,14 @@ public BatchAssignUserIds(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class BatchDictionaryEntries @@ -110,6 +171,14 @@ public BatchDictionaryEntries(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class BatchRules @@ -125,6 +194,14 @@ public BatchRules(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class Browse @@ -140,6 +217,14 @@ public Browse(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ClearAllSynonyms @@ -155,6 +240,14 @@ public ClearAllSynonyms(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ClearObjects @@ -170,6 +263,14 @@ public ClearObjects(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ClearRules @@ -185,6 +286,14 @@ public ClearRules(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteApiKey @@ -200,6 +309,14 @@ public DeleteApiKey(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteBy @@ -215,6 +332,14 @@ public DeleteBy(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteIndex @@ -230,6 +355,14 @@ public DeleteIndex(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteObject @@ -245,6 +378,14 @@ public DeleteObject(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteRule @@ -260,6 +401,14 @@ public DeleteRule(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteSource @@ -275,6 +424,14 @@ public DeleteSource(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class DeleteSynonym @@ -290,6 +447,14 @@ public DeleteSynonym(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetApiKey @@ -305,6 +470,14 @@ public GetApiKey(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetDictionaryLanguages @@ -320,6 +493,14 @@ public GetDictionaryLanguages(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetDictionarySettings @@ -335,6 +516,14 @@ public GetDictionarySettings(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetLogs @@ -350,6 +539,14 @@ public GetLogs(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetObject @@ -365,6 +562,14 @@ public GetObject(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetObjects @@ -380,6 +585,14 @@ public GetObjects(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetRule extends Rule implements EchoResponseInterface { @@ -393,6 +606,14 @@ public GetRule(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetSettings @@ -408,6 +629,14 @@ public GetSettings(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetSources @@ -423,6 +652,14 @@ public GetSources(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetSynonym @@ -438,6 +675,14 @@ public GetSynonym(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetTask @@ -453,6 +698,14 @@ public GetTask(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetTopUserIds @@ -468,6 +721,14 @@ public GetTopUserIds(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class GetUserId @@ -483,6 +744,14 @@ public GetUserId(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class HasPendingMappings @@ -498,6 +767,14 @@ public HasPendingMappings(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ListApiKeys @@ -513,6 +790,14 @@ public ListApiKeys(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ListClusters @@ -528,6 +813,14 @@ public ListClusters(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ListIndices @@ -543,6 +836,14 @@ public ListIndices(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ListUserIds @@ -558,6 +859,14 @@ public ListUserIds(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class MultipleBatch @@ -573,6 +882,14 @@ public MultipleBatch(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class MultipleQueries @@ -588,6 +905,14 @@ public MultipleQueries(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class OperationIndex @@ -603,6 +928,14 @@ public OperationIndex(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class PartialUpdateObject @@ -618,6 +951,14 @@ public PartialUpdateObject(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class RemoveUserId @@ -633,6 +974,14 @@ public RemoveUserId(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class ReplaceSources @@ -648,6 +997,14 @@ public ReplaceSources(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class RestoreApiKey @@ -663,6 +1020,14 @@ public RestoreApiKey(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SaveObject @@ -678,6 +1043,14 @@ public SaveObject(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SaveRule @@ -693,6 +1066,14 @@ public SaveRule(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SaveSynonym @@ -708,6 +1089,14 @@ public SaveSynonym(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SaveSynonyms @@ -723,6 +1112,14 @@ public SaveSynonyms(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class Search @@ -738,6 +1135,14 @@ public Search(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SearchDictionaryEntries @@ -753,6 +1158,14 @@ public SearchDictionaryEntries(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SearchForFacetValues @@ -768,6 +1181,14 @@ public SearchForFacetValues(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SearchRules @@ -783,6 +1204,14 @@ public SearchRules(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SearchSynonyms @@ -798,6 +1227,14 @@ public SearchSynonyms(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SearchUserIds @@ -813,6 +1250,14 @@ public SearchUserIds(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SetDictionarySettings @@ -828,6 +1273,14 @@ public SetDictionarySettings(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class SetSettings @@ -843,6 +1296,14 @@ public SetSettings(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } public static class UpdateApiKey @@ -858,5 +1319,13 @@ public UpdateApiKey(Request request) { public String getPath() { return request.url().encodedPath(); } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java new file mode 100644 index 0000000000..60c99a6ec6 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echo/EchoResponseInterface.java @@ -0,0 +1,9 @@ +package com.algolia.utils.echo; + +public interface EchoResponseInterface { + public String getPath(); + + public String getMethod(); + + public String getBody(); +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java deleted file mode 100644 index f1b1ba7349..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponseInterface.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.algolia.utils.echoResponse; - -public interface EchoResponseInterface { - public String getPath(); -} diff --git a/clients/algoliasearch-client-java-2/utils/CallEcho.java b/clients/algoliasearch-client-java-2/utils/CallEcho.java deleted file mode 100644 index 8b09c33532..0000000000 --- a/clients/algoliasearch-client-java-2/utils/CallEcho.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.algolia.utils; - -import java.io.IOException; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Request; -import okhttp3.Response; -import okio.Timeout; - -public class CallEcho implements Call { - - private Request request; - - public CallEcho(Request request) { - this.request = request; - } - - @Override - public Request request() { - return request; - } - - @Override - public void cancel() {} - - @Override - public Call clone() { - return null; - } - - @Override - public void enqueue(Callback arg0) {} - - @Override - public Response execute() throws IOException { - return null; - } - - @Override - public boolean isExecuted() { - return false; - } - - @Override - public boolean isCanceled() { - return false; - } - - @Override - public Timeout timeout() { - return null; - } -} diff --git a/clients/algoliasearch-client-java-2/utils/EchoRequester.java b/clients/algoliasearch-client-java-2/utils/EchoRequester.java deleted file mode 100644 index 7d573fcaae..0000000000 --- a/clients/algoliasearch-client-java-2/utils/EchoRequester.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.algolia.utils; - -import com.algolia.ApiException; -import okhttp3.Request; - -public class EchoRequester implements Requester { - - public CallEcho newCall(Request request) throws ApiException { - return new CallEcho(request); - } - - // NO-OP for now - - public void setDebugging(boolean debugging) {} - - public int getConnectTimeout() { - return 100; - } - - public void setConnectTimeout(int connectionTimeout) {} - - public int getReadTimeout() { - return 100; - } - - public void setReadTimeout(int readTimeout) {} - - public int getWriteTimeout() { - return 100; - } - - public void setWriteTimeout(int writeTimeout) {} -} diff --git a/clients/algoliasearch-client-java-2/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/utils/HttpRequester.java deleted file mode 100644 index 1da39b461e..0000000000 --- a/clients/algoliasearch-client-java-2/utils/HttpRequester.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.algolia.utils; - -import com.algolia.ApiCallback; -import com.algolia.ApiException; -import com.algolia.ProgressResponseBody; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import okhttp3.Call; -import okhttp3.Interceptor; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; - -public class HttpRequester implements Requester { - - private OkHttpClient httpClient; - private HttpLoggingInterceptor loggingInterceptor; - private boolean debugging; - - public HttpRequester() { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - - httpClient = builder.build(); - } - - public Call newCall(Request request) throws ApiException { - return httpClient.newCall(request); - } - - public void 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; - } - - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - public void setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - public void setReadTimeout(int readTimeout) { - httpClient = - httpClient - .newBuilder() - .readTimeout(readTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - public void setWriteTimeout(int writeTimeout) { - httpClient = - httpClient - .newBuilder() - .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS) - .build(); - } - - /** - * 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; - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/utils/Requester.java b/clients/algoliasearch-client-java-2/utils/Requester.java deleted file mode 100644 index 9f7f262846..0000000000 --- a/clients/algoliasearch-client-java-2/utils/Requester.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.algolia.utils; - -import com.algolia.ApiException; -import okhttp3.Call; -import okhttp3.Request; - -public interface Requester { - public Call newCall(Request request) throws ApiException; - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - */ - public void setDebugging(boolean debugging); - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout(); - - /** - * 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 - */ - public void setConnectTimeout(int connectionTimeout); - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout(); - - /** - * 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 - */ - public void setReadTimeout(int readTimeout); - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout(); - - /** - * 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 - */ - public void setWriteTimeout(int writeTimeout); -} diff --git a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java deleted file mode 100644 index f1b1ba7349..0000000000 --- a/clients/algoliasearch-client-java-2/utils/echoResponse/EchoResponseInterface.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.algolia.utils.echoResponse; - -public interface EchoResponseInterface { - public String getPath(); -} diff --git a/package.json b/package.json index 95252af214..87bc173ef8 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "build:clients": "./scripts/multiplexer.sh ${2:-nonverbose} ./scripts/builds/clients.sh ${0:-all} ${1:-all}", "build:specs": "./scripts/builds/specs.sh ${0:-all} ${1:-yml}", "build": "yarn build:specs && yarn build:clients", - "clean": "rm -rf **/dist **/build **/node_modules", - "cts:generate": "yarn workspace tests build && ./scripts/multiplexer.sh ${2:-nonverbose} yarn workspace tests generate ${0:-all} ${1:-all} && yarn workspace tests lint:fix", + "clean": "rm -rf **/dist **/build **/node_modules **/target", + "cts:generate": "yarn workspace tests build && ./scripts/multiplexer.sh ${2:-nonverbose} yarn workspace tests generate ${0:-all} ${1:-all}", "cts:test": "./scripts/multiplexer.sh ${1:-nonverbose} ./scripts/runCTS.sh ${0:-javascript} all", "docker:build": "./scripts/docker/build.sh", "docker:clean": "docker stop dev; docker rm -f dev; docker image rm -f api-clients-automation", @@ -42,6 +42,7 @@ "eslint-plugin-unused-imports": "2.0.0", "eslint-plugin-yml": "0.12.0", "json": "11.0.0", + "mustache": "4.2.0", "prettier": "2.5.1", "prettier-plugin-java": "1.6.0", "typescript": "4.5.4" diff --git a/scripts/post-gen/java.sh b/scripts/post-gen/java.sh index 7a2cc6a502..9cba61f159 100755 --- a/scripts/post-gen/java.sh +++ b/scripts/post-gen/java.sh @@ -15,32 +15,20 @@ find "$CLIENT" -type f -name "*.java" | xargs sed -i -e 's~= {}~= new Object()~g echo "package com.algolia.model;public class OneOfintegerstring {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfintegerstring.java echo "package com.algolia.model;public class OneOfstringbuiltInOperation {}" > $CLIENT/algoliasearch-core/com/algolia/model/OneOfstringbuiltInOperation.java -cp -R $CLIENT/utils/ $CLIENT/algoliasearch-core/com/algolia/ - # Generate types for the EchoRequester, to be able to keep the correct response type on the API method. -# Create the file to hold all the EchoResponse -echo "package com.algolia.utils.echoResponse; \ - import com.algolia.model.*; \ - import okhttp3.Request; \ - import java.util.ArrayList; \ - import java.util.HashMap; \ - public class EchoResponse {" > $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java - # Extract the normal response to extend it responses=($(grep -o 'public .*ApiCallback<.*>' $CLIENT/algoliasearch-core/com/algolia/**/*Api.java | sed 's/public.*ApiCallback$//; s/ //; s/^Map> $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java + + mustacheData=$(echo $mustacheData | jq --arg class $class --arg super $super '.responses |= .+ [{className:$class,superClass:$super}]') done -echo '}' >> $CLIENT/algoliasearch-core/com/algolia/utils/echoResponse/EchoResponse.java +echo $mustacheData | yarn mustache - scripts/post-gen/javaEchoResponse.mustache > $CLIENT/algoliasearch-core/com/algolia/utils/echo/EchoResponse.java format_client() { echo "> Formatting $GENERATOR..." diff --git a/scripts/post-gen/javaEchoResponse.mustache b/scripts/post-gen/javaEchoResponse.mustache new file mode 100644 index 0000000000..8028cb3d8d --- /dev/null +++ b/scripts/post-gen/javaEchoResponse.mustache @@ -0,0 +1,44 @@ +package com.algolia.utils.echo; + +import java.io.IOException; +import com.algolia.model.*; +import okhttp3.Request; +import java.util.ArrayList; +import java.util.HashMap; +import okio.Buffer; + +public class EchoResponse { + + private static String parseRequestBody(Request req) { + try { + final Request copy = req.newBuilder().build(); + final Buffer buffer = new Buffer(); + copy.body().writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + return "error"; + } + } + + {{#responses}} + public static class {{{className}}} extends {{{superClass}}} implements EchoResponseInterface { + private Request request; + + public {{{className}}}(Request request) { + this.request = request; + } + + public String getPath() { + return request.url().encodedPath(); + } + + public String getMethod() { + return request.method(); + } + + public String getBody() { + return parseRequestBody(request); + } + } + {{/responses}} +} diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 313a724e47..d8b4129ca0 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -12,7 +12,7 @@ import okhttp3.Call; import okhttp3.Request; import com.algolia.utils.*; -import com.algolia.utils.echoResponse.EchoResponse; +import com.algolia.utils.echo.*; import com.algolia.model.*; import java.lang.reflect.Type; diff --git a/tests/package.json b/tests/package.json index 82fd1ec450..cdc3063807 100644 --- a/tests/package.json +++ b/tests/package.json @@ -6,7 +6,6 @@ ], "scripts": { "build": "tsc", - "lint:fix": "yarn workspace javascript-tests lint:fix", "generate": "yarn generate:methods:requets ${0:-javascript} ${1:-search}", "generate:methods:requets": "node dist/tests/src/methods/requests/main.js ${0:-javascript} ${1:-search}", "start": "yarn build && yarn generate ${0:-javascript} ${1:-search} && yarn lint:fix" diff --git a/yarn.lock b/yarn.lock index fb69be092b..3a4b9ec327 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,6 +25,7 @@ __metadata: eslint-plugin-unused-imports: 2.0.0 eslint-plugin-yml: 0.12.0 json: 11.0.0 + mustache: 4.2.0 prettier: 2.5.1 prettier-plugin-java: 1.6.0 typescript: 4.5.4