From c730a94104ad33ac222bcba8eb404dbd1907d8aa Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 16:48:47 +0200 Subject: [PATCH 01/15] some more test --- .../.openapi-generator-ignore | 1 + .../algoliasearch-core/build.gradle | 1 + .../main/java/com/algolia/ApiCallback.java | 56 -- .../main/java/com/algolia/ApiResponse.java | 51 -- .../java/com/algolia/ProgressRequestBody.java | 61 -- .../com/algolia/ProgressResponseBody.java | 59 -- .../exceptions/AlgoliaApiException.java | 2 + .../exceptions/AlgoliaRetryException.java | 2 + .../exceptions/AlgoliaRuntimeException.java | 2 + .../algolia/exceptions/LaunderThrowable.java | 39 ++ .../java/com/algolia/utils/HttpRequester.java | 28 - .../java/com/algolia/{ => utils}/JSON.java | 2 +- .../java/com/algolia/utils/echo/CallEcho.java | 66 ++- config/generation.config.js | 2 + .../algolia/codegen/AlgoliaJavaGenerator.java | 7 +- playground/java/build.gradle | 2 +- .../java/com/algolia/playground/Insights.java | 52 ++ .../playground/{App.java => Search.java} | 18 +- scripts/playground.ts | 12 +- templates/java/EchoResponse.mustache | 49 +- templates/java/JSON.mustache | 560 ------------------ templates/java/JavaTimeFormatter.mustache | 58 -- templates/java/gradle-wrapper.jar.mustache | Bin 59536 -> 0 bytes .../java/gradle-wrapper.properties.mustache | 5 - .../okhttp-gson/ApiCallback.mustache | 49 -- .../libraries/okhttp-gson/ApiClient.mustache | 126 ++-- .../okhttp-gson/ApiResponse.mustache | 56 -- .../okhttp-gson/ProgressRequestBody.mustache | 60 -- .../okhttp-gson/ProgressResponseBody.mustache | 57 -- .../java/libraries/okhttp-gson/api.mustache | 135 ++--- templates/java/manifest.mustache | 3 - templates/java/pojo.mustache | 4 +- 32 files changed, 297 insertions(+), 1328 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiCallback.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiResponse.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressRequestBody.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressResponseBody.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/LaunderThrowable.java rename clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/{ => utils}/JSON.java (99%) create mode 100644 playground/java/src/main/java/com/algolia/playground/Insights.java rename playground/java/src/main/java/com/algolia/playground/{App.java => Search.java} (74%) delete mode 100644 templates/java/JSON.mustache delete mode 100644 templates/java/JavaTimeFormatter.mustache delete mode 100644 templates/java/gradle-wrapper.jar.mustache delete mode 100644 templates/java/gradle-wrapper.properties.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ApiCallback.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ApiResponse.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache delete mode 100644 templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache delete mode 100644 templates/java/manifest.mustache diff --git a/clients/algoliasearch-client-java-2/.openapi-generator-ignore b/clients/algoliasearch-client-java-2/.openapi-generator-ignore index b21c175e33..a7dc62ea7d 100644 --- a/clients/algoliasearch-client-java-2/.openapi-generator-ignore +++ b/clients/algoliasearch-client-java-2/.openapi-generator-ignore @@ -7,6 +7,7 @@ api/** docs/** src/** +gradle/** README.md .travis.yml diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle b/clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle index 876a780ea6..f4d91ce3f1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle @@ -21,4 +21,5 @@ dependencies { tasks.withType(JavaCompile) { options.encoding = 'UTF-8' + options.compilerArgs += ['-Xlint:deprecation'] } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiCallback.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiCallback.java deleted file mode 100644 index 1c1d61bcff..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiCallback.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.algolia; - -import com.algolia.exceptions.AlgoliaRuntimeException; -import java.util.List; -import java.util.Map; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure( - AlgoliaRuntimeException e, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess( - T result, - int statusCode, - Map> responseHeaders - ); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiResponse.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiResponse.java deleted file mode 100644 index 3826fd0754..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.algolia; - -import java.util.List; -import java.util.Map; - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { - - private final int statusCode; - private final Map> headers; - private final T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse( - int statusCode, - Map> headers, - T data - ) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressRequestBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressRequestBody.java deleted file mode 100644 index 42c926955c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressRequestBody.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress( - bytesWritten, - contentLength, - bytesWritten == contentLength - ); - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressResponseBody.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressResponseBody.java deleted file mode 100644 index d5f13aa6e5..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ProgressResponseBody.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.algolia; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress( - totalBytesRead, - responseBody.contentLength(), - bytesRead == -1 - ); - return bytesRead; - } - }; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaApiException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaApiException.java index 40ca6e1835..ab8dc91ab9 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaApiException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaApiException.java @@ -3,6 +3,8 @@ /** Exception thrown in case of API failure such as 4XX, 5XX error. */ public class AlgoliaApiException extends AlgoliaRuntimeException { + public static final long serialVersionUID = -1L; + public int getHttpErrorCode() { return httpErrorCode; } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java index bb0668b6e2..3fbb98c608 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRetryException.java @@ -6,6 +6,8 @@ */ public class AlgoliaRetryException extends AlgoliaRuntimeException { + public static final long serialVersionUID = -1L; + public AlgoliaRetryException(String message, Throwable cause) { super(message, cause); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRuntimeException.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRuntimeException.java index 6ba51537d8..1099fea1c2 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRuntimeException.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/AlgoliaRuntimeException.java @@ -3,6 +3,8 @@ /** Exception thrown when an error occurs during the Serialization/Deserialization process */ public class AlgoliaRuntimeException extends RuntimeException { + public static final long serialVersionUID = -1L; + public AlgoliaRuntimeException(String message, Throwable cause) { super(message, cause); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/LaunderThrowable.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/LaunderThrowable.java new file mode 100644 index 0000000000..d1187b76d5 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/LaunderThrowable.java @@ -0,0 +1,39 @@ +package com.algolia.exceptions; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +@SuppressWarnings("WeakerAccess") +public class LaunderThrowable { + + /** + * Performs a get() on the asynchronous method. Launders both Interrupted and Execution exception + * to business exception + * + * @param f The CompletableFuture to block on. + */ + public static T await(CompletableFuture f) { + try { + return f.get(); + } catch (InterruptedException | ExecutionException e) { + throw LaunderThrowable.launder(e); + } + } + + /** Launders both Interrupted and Execution exception into business exception */ + public static RuntimeException launder(Throwable t) { + if (t.getCause() instanceof AlgoliaApiException) { + throw (AlgoliaApiException) t.getCause(); + } + + if (t.getCause() instanceof AlgoliaRetryException) { + throw (AlgoliaRetryException) t.getCause(); + } + + if (t.getCause() instanceof AlgoliaRuntimeException) { + throw (AlgoliaRuntimeException) t.getCause(); + } + + throw new AlgoliaRuntimeException(t); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java index 07cbae53b4..863d954dc4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java @@ -1,17 +1,12 @@ package com.algolia.utils; -import com.algolia.ApiCallback; -import com.algolia.ProgressResponseBody; import com.algolia.utils.retry.RetryStrategy; import com.algolia.utils.retry.StatefulHost; -import java.io.IOException; import java.util.List; 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; @@ -27,7 +22,6 @@ public HttpRequester(List hosts) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.addInterceptor(retryStrategy.getRetryInterceptor()); - builder.addNetworkInterceptor(getProgressInterceptor()); builder.retryOnConnectionFailure(false); httpClient = builder.build(); @@ -89,26 +83,4 @@ public void setWriteTimeout(int writeTimeout) { .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/src/main/java/com/algolia/JSON.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/JSON.java similarity index 99% rename from clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/JSON.java rename to clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/JSON.java index a924c616e8..7b6cf2f7f7 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/JSON.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/JSON.java @@ -1,4 +1,4 @@ -package com.algolia; +package com.algolia.utils; import com.google.gson.FieldNamingPolicy; import com.google.gson.FieldNamingStrategy; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java index 1712669790..69f314b282 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java @@ -1,15 +1,26 @@ package com.algolia.utils.echo; +import com.algolia.JSON; +import com.algolia.Pair; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import okhttp3.Call; import okhttp3.Callback; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.Protocol; import okhttp3.Request; import okhttp3.Response; +import okhttp3.ResponseBody; +import okio.Buffer; import okio.Timeout; public class CallEcho implements Call { - private Request request; + private final Request request; public CallEcho(Request request) { this.request = request; @@ -28,8 +39,59 @@ public Call clone() { return null; } + private List buildQueryParams() { + List params = new ArrayList(); + HttpUrl url = request.url(); + for (String name : url.queryParameterNames()) { + for (String value : url.queryParameterValues(name)) { + params.add(new Pair(name, value)); + } + } + return params; + } + @Override - public void enqueue(Callback arg0) {} + public void enqueue(Callback callback) { + Response.Builder builder = new Response.Builder(); + builder.code(200); + builder.request(request); + builder.protocol(Protocol.HTTP_2); + builder.message("EchoRequest"); + try { + JsonObject body = new JsonObject(); + body.addProperty("path", request.url().encodedPath()); + body.addProperty("method", request.method()); + body.add( + "queryParameters", + (JsonArray) JSON.deserialize( + JSON.serialize(buildQueryParams()), + JsonArray.class + ) + ); + try { + final Request copy = request.newBuilder().build(); + final Buffer buffer = new Buffer(); + if (copy.body() == null) { + body.addProperty("body", ""); + } else { + copy.body().writeTo(buffer); + body.addProperty("body", buffer.readUtf8()); + } + } catch (final IOException e) { + body.addProperty("body", "error"); + } + System.out.println(body); + builder.body( + ResponseBody.create( + JSON.serialize(body), + MediaType.parse("application/json") + ) + ); + callback.onResponse(this, builder.build()); + } catch (Exception e) { + e.printStackTrace(); + } + } @Override public Response execute() throws IOException { diff --git a/config/generation.config.js b/config/generation.config.js index 7cba74f46c..5341361bcb 100644 --- a/config/generation.config.js +++ b/config/generation.config.js @@ -12,11 +12,13 @@ module.exports = { // Java '!clients/algoliasearch-client-java-2/*.gradle', '!clients/algoliasearch-client-java-2/.gitignore', + '!clients/algoliasearch-client-java-2/gradle/wrapper/**', '!clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle', '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/*', '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/*', 'clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponse*.java', '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java', + '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java', // JavaScript '!clients/algoliasearch-client-javascript/*', diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java index d37e1fe206..9ff168e115 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java @@ -152,7 +152,12 @@ public void processOpts() { supportingFiles.removeIf(file -> file.getTemplateFile().equals("build.gradle.mustache") || file.getTemplateFile().equals("settings.gradle.mustache") || - file.getTemplateFile().equals("gitignore.mustache") + file.getTemplateFile().equals("gitignore.mustache") || + file.getTemplateFile().equals("ApiCallback.mustache") || + file.getTemplateFile().equals("ApiResponse.mustache") || + file.getTemplateFile().equals("JSON.mustache") || + file.getTemplateFile().equals("ProgressRequestBody.mustache") || + file.getTemplateFile().equals("ProgressResponseBody.mustache") ); } diff --git a/playground/java/build.gradle b/playground/java/build.gradle index 35b0a9183a..e15b9dd01e 100644 --- a/playground/java/build.gradle +++ b/playground/java/build.gradle @@ -22,5 +22,5 @@ tasks.withType(JavaCompile) { } application { - mainClass = "com.algolia.playground.App" + mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL" } diff --git a/playground/java/src/main/java/com/algolia/playground/Insights.java b/playground/java/src/main/java/com/algolia/playground/Insights.java new file mode 100644 index 0000000000..3c47c16d13 --- /dev/null +++ b/playground/java/src/main/java/com/algolia/playground/Insights.java @@ -0,0 +1,52 @@ +package com.algolia.playground; + +import com.algolia.exceptions.AlgoliaApiException; +import com.algolia.exceptions.AlgoliaRetryException; +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.algolia.model.insights.*; +import com.algolia.api.InsightsClient; +import com.algolia.utils.UserAgent; +import io.github.cdimascio.dotenv.Dotenv; + +public class Insights { + public static void main(String[] args) { + Dotenv dotenv = Dotenv.configure().directory("../").load(); + + InsightsClient client = new InsightsClient( + dotenv.get("ALGOLIA_APPLICATION_ID"), + dotenv.get("ALGOLIA_SEARCH_KEY"), + new UserAgent.Segment[] { + new UserAgent.Segment("test", "8.0.0"), + new UserAgent.Segment("JVM", "11.0.14"), + new UserAgent.Segment("no version"), + } + ); + + String indexName = dotenv.get("SEARCH_INDEX"); + InsightEvents params = new InsightEvents(); + InsightEvent event = new InsightEvent(); + event.setEventType(EventType.CLICK); + event.setUserToken("user"); + event.setIndex("test_what"); + event.setEventName("test"); + params.addEvents(event); + + try { + PushEventsResponse result = client.pushEvents(params); + System.out.println(result); + } catch (AlgoliaApiException e) { + // the API failed + System.err.println("Exception when calling InsightsClient#pushEvents"); + System.err.println("Status code: " + e.getHttpErrorCode()); + System.err.println("Reason: " + e.getMessage()); + e.printStackTrace(); + } catch (AlgoliaRetryException e) { + // the retry failed + System.err.println("Exception in the retry strategy"); + e.printStackTrace(); + } catch (AlgoliaRuntimeException e) { + // the serialization or something else failed + e.printStackTrace(); + } + } +} diff --git a/playground/java/src/main/java/com/algolia/playground/App.java b/playground/java/src/main/java/com/algolia/playground/Search.java similarity index 74% rename from playground/java/src/main/java/com/algolia/playground/App.java rename to playground/java/src/main/java/com/algolia/playground/Search.java index 5ecbc9f662..c650ab5f50 100644 --- a/playground/java/src/main/java/com/algolia/playground/App.java +++ b/playground/java/src/main/java/com/algolia/playground/Search.java @@ -7,9 +7,12 @@ import com.algolia.api.SearchClient; import com.algolia.utils.UserAgent; import io.github.cdimascio.dotenv.Dotenv; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.lang.InterruptedException; -public class App { - +public class Search { + public static void main(String[] args) { Dotenv dotenv = Dotenv.configure().directory("../").load(); @@ -29,11 +32,18 @@ public static void main(String[] args) { params.setQuery(dotenv.get("SEARCH_QUERY")); try { - SearchResponse result = client.search( + CompletableFuture result = client.searchAsync( indexName, SearchParams.ofSearchParamsObject(params) ); - System.out.println(result); + SearchResponse sr = result.get(); + System.out.println(sr); + } catch(InterruptedException e) { + System.err.println("InterrupedException" + e.getMessage()); + e.printStackTrace(); + } catch(ExecutionException e) { + System.err.println("ExecutionException" + e.getMessage()); + e.printStackTrace(); } catch (AlgoliaApiException e) { // the API failed System.err.println("Exception when calling SearchClient#search"); diff --git a/scripts/playground.ts b/scripts/playground.ts index 65c7d402dd..6069bb7686 100644 --- a/scripts/playground.ts +++ b/scripts/playground.ts @@ -1,4 +1,5 @@ import { run } from './common'; +import { capitalize } from './cts/utils'; import type { Language } from './types'; export async function playground({ @@ -16,9 +17,14 @@ export async function playground({ }); break; case 'java': - await run(`./gradle/gradlew -p playground/java run`, { - verbose, - }); + await run( + `./gradle/gradlew -p playground/java -PmainClass=com.algolia.playground.${capitalize( + client + )} run`, + { + verbose, + } + ); break; case 'php': await run( diff --git a/templates/java/EchoResponse.mustache b/templates/java/EchoResponse.mustache index 3b5faa6ea1..2071beb9a6 100644 --- a/templates/java/EchoResponse.mustache +++ b/templates/java/EchoResponse.mustache @@ -7,57 +7,30 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - - public class EchoResponse{{#apiInfo}}{{#apis}}{{{baseName}}}{{/apis}}{{/apiInfo}} { - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - {{#apiInfo}}{{#apis}} {{#operations}}{{#operation}} - public static class {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}} extends {{{returnType}}} implements EchoResponseInterface { - private Request request; - public {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}(Request request) { - this.request = request; - } + public static class {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}} extends {{{returnType}}} implements EchoResponseInterface { + public String path; + public String method; + public String body; + public List queryParameters; - public String getPath() { - return request.url().encodedPath(); + public String getPath() { + return path; } - public String getMethod() { - return request.method(); + public String getMethod() { + return method; } public String getBody() { - return parseRequestBody(request); + return body; } public List getQueryParams() { - return buildQueryParams(request); + return queryParameters; } // to satisfy CompoundType in case it's a parent diff --git a/templates/java/JSON.mustache b/templates/java/JSON.mustache deleted file mode 100644 index a8b85f3384..0000000000 --- a/templates/java/JSON.mustache +++ /dev/null @@ -1,560 +0,0 @@ -package {{invokerPackage}}; - -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.lang.reflect.Field; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.text.ParseException; -import java.text.ParsePosition; -import java.util.Collections; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.IdentityHashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentHashMap; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.FieldNamingStrategy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.InstanceCreator; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.internal.$Gson$Types; -import com.google.gson.internal.ConstructorConstructor; -import com.google.gson.internal.Excluder; -import com.google.gson.internal.LinkedTreeMap; -import com.google.gson.internal.ObjectConstructor; -import com.google.gson.internal.Primitives; -import com.google.gson.internal.bind.MapTypeAdapterFactory; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import io.gsonfire.GsonFireBuilder; -import okio.ByteString; - -public class JSON { - private static Gson gson; - private static final ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - private static final RetainFieldMapFactory mapAdapter = new RetainFieldMapFactory(); - - static { - gson = createGson() - .registerTypeAdapter(byte[].class, byteArrayAdapter) - .registerTypeAdapterFactory(mapAdapter) - .create(); - } - - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder() - {{#models}} - {{#model}} - {{#discriminator}} - .registerTypeSelector({{classname}}.class, new TypeSelector<{{classname}}>() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap(); - {{#mappedModels}} - classByDiscriminatorValue.put("{{mappingName}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelName}}.class); - {{/mappedModels}} - classByDiscriminatorValue.put("{{name}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{classname}}.class); - return getClassByDiscriminator(classByDiscriminatorValue, - getDiscriminatorValue(readElement, "{{{propertyBaseName}}}")); - } - }) - {{/discriminator}} - {{/model}} - {{/models}}; - return fireBuilder.createGsonBuilder(); - } - - // Suppress default constructor for noninstantiability - private JSON() { - throw new AssertionError(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public static Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - * @return JSON - */ - public static void setGson(Gson gon) { - gson = gon; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public static String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - public static T deserialize(String body, Type returnType) { - try { - return gson.fromJson(body, returnType); - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType != null && returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } - } -} - -/** -* Gson TypeAdapter for Byte Array type -*/ -class ByteArrayAdapter extends TypeAdapter { - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString != null ? byteString.toByteArray() : new byte[0]; - } -} - -// https://stackoverflow.com/questions/21458468/gson-wont-properly-serialise-a-class-that-extends-hashmap -class RetainFieldMapFactory implements TypeAdapterFactory { - - FieldNamingPolicy fieldNamingPolicy = FieldNamingPolicy.IDENTITY; - ConstructorConstructor constructorConstructor = new ConstructorConstructor( - Collections.>emptyMap()); - MapTypeAdapterFactory defaultMapFactory = new MapTypeAdapterFactory( - constructorConstructor, - false); - ReflectiveFilterMapFieldFactory defaultObjectFactory = new ReflectiveFilterMapFieldFactory( - constructorConstructor, - fieldNamingPolicy, - Excluder.DEFAULT); - - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - final TypeAdapter mapAdapter = defaultMapFactory.create(gson, type); - if (mapAdapter != null) { - return (TypeAdapter) new RetainFieldMapAdapter( - mapAdapter, - defaultObjectFactory.create(gson, type)); - } - return mapAdapter; - } - - class RetainFieldMapAdapter extends TypeAdapter> { - - TypeAdapter> mapAdapter; - ReflectiveTypeAdapterFactory.Adapter> objectAdapter; - - RetainFieldMapAdapter( - TypeAdapter mapAdapter, - ReflectiveTypeAdapterFactory.Adapter objectAdapter) { - this.mapAdapter = mapAdapter; - this.objectAdapter = objectAdapter; - } - - @Override - public void write(final JsonWriter out, Map value) - throws IOException { - if (value == null) { - out.nullValue(); - return; - } - // 1.write object - StringWriter sw = new StringWriter(); - objectAdapter.write(new JsonWriter(sw), value); - - // 2.convert object to a map - Map objectMap = mapAdapter.fromJson(sw.toString()); - - // 3.overwrite fields in object to a copy map - value = new LinkedHashMap(value); - value.putAll(objectMap); - - // 4.write the copy map - mapAdapter.write(out, value); - } - - @Override - public Map read(JsonReader in) throws IOException { - // 1.create map, all key-value retain in map - Map map = mapAdapter.read(in); - - // 2.create object from created map - Map object = objectAdapter.fromJsonTree( - mapAdapter.toJsonTree(map)); - - // 3.remove fields in object from map - for (String field : objectAdapter.boundFields.keySet()) { - map.remove(field); - } - // 4.put map to object - object.putAll(map); - return object; - } - } - - static class ReflectiveFilterMapFieldFactory - extends ReflectiveTypeAdapterFactory { - - public ReflectiveFilterMapFieldFactory( - ConstructorConstructor constructorConstructor, - FieldNamingStrategy fieldNamingPolicy, - Excluder excluder) { - super(constructorConstructor, fieldNamingPolicy, excluder); - } - - @Override - protected boolean shouldFindFieldInClass( - Class willFindClass, - Class originalRaw) { - Class[] endClasses = new Class[] { - Object.class, - HashMap.class, - LinkedHashMap.class, - LinkedTreeMap.class, - Hashtable.class, - TreeMap.class, - ConcurrentHashMap.class, - IdentityHashMap.class, - WeakHashMap.class, - EnumMap.class, - }; - for (Class c : endClasses) { - if (willFindClass == c) - return false; - } - - return super.shouldFindFieldInClass(willFindClass, originalRaw); - } - } - - /** - * below code copy from - * {@link com.google.gson.internal.bind.ReflectiveTypeAdapterFactory} (little - * modify, in source this class is final) Type adapter that reflects over the - * fields and methods - * of a class. - */ - static class ReflectiveTypeAdapterFactory implements TypeAdapterFactory { - - private final ConstructorConstructor constructorConstructor; - private final FieldNamingStrategy fieldNamingPolicy; - private final Excluder excluder; - - public ReflectiveTypeAdapterFactory( - ConstructorConstructor constructorConstructor, - FieldNamingStrategy fieldNamingPolicy, - Excluder excluder) { - this.constructorConstructor = constructorConstructor; - this.fieldNamingPolicy = fieldNamingPolicy; - this.excluder = excluder; - } - - public boolean excludeField(Field f, boolean serialize) { - return (!excluder.excludeClass(f.getType(), serialize) && - !excluder.excludeField(f, serialize)); - } - - private String getFieldName(Field f) { - SerializedName serializedName = f.getAnnotation(SerializedName.class); - return serializedName == null - ? fieldNamingPolicy.translateName(f) - : serializedName.value(); - } - - public Adapter create(Gson gson, final TypeToken type) { - Class raw = type.getRawType(); - - if (!Object.class.isAssignableFrom(raw)) { - return null; // it's a primitive! - } - - ObjectConstructor constructor = constructorConstructor.get(type); - return new Adapter(constructor, getBoundFields(gson, type, raw)); - } - - private ReflectiveTypeAdapterFactory.BoundField createBoundField( - final Gson context, - final Field field, - final String name, - final TypeToken fieldType, - boolean serialize, - boolean deserialize) { - final boolean isPrimitive = Primitives.isPrimitive( - fieldType.getRawType()); - - // special casing primitives here saves ~5% on Android... - return new ReflectiveTypeAdapterFactory.BoundField( - name, - serialize, - deserialize) { - final TypeAdapter typeAdapter = context.getAdapter(fieldType); - - @SuppressWarnings({ "unchecked", "rawtypes" }) // the type adapter and field type always agree - @Override - void write(JsonWriter writer, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = field.get(value); - TypeAdapter t = new TypeAdapterRuntimeTypeWrapper( - context, - this.typeAdapter, - fieldType.getType()); - t.write(writer, fieldValue); - } - - @Override - void read(JsonReader reader, Object value) - throws IOException, IllegalAccessException { - Object fieldValue = typeAdapter.read(reader); - if (fieldValue != null || !isPrimitive) { - field.set(value, fieldValue); - } - } - }; - } - - private Map getBoundFields( - Gson context, - TypeToken type, - Class raw) { - Map result = new LinkedHashMap(); - if (raw.isInterface()) { - return result; - } - - Type declaredType = type.getType(); - Class originalRaw = type.getRawType(); - while (shouldFindFieldInClass(raw, originalRaw)) { - Field[] fields = raw.getDeclaredFields(); - for (Field field : fields) { - boolean serialize = excludeField(field, true); - boolean deserialize = excludeField(field, false); - if (!serialize && !deserialize) { - continue; - } - field.setAccessible(true); - Type fieldType = $Gson$Types.resolve( - type.getType(), - raw, - field.getGenericType()); - BoundField boundField = createBoundField( - context, - field, - getFieldName(field), - TypeToken.get(fieldType), - serialize, - deserialize); - BoundField previous = result.put(boundField.name, boundField); - if (previous != null) { - throw new IllegalArgumentException( - declaredType + - " declares multiple JSON fields named " + - previous.name); - } - } - type = TypeToken.get( - $Gson$Types.resolve(type.getType(), raw, raw.getGenericSuperclass())); - raw = type.getRawType(); - } - return result; - } - - protected boolean shouldFindFieldInClass( - Class willFindClass, - Class originalRaw) { - return willFindClass != Object.class; - } - - abstract static class BoundField { - final String name; - final boolean serialized; - final boolean deserialized; - - protected BoundField( - String name, - boolean serialized, - boolean deserialized) { - this.name = name; - this.serialized = serialized; - this.deserialized = deserialized; - } - - abstract void write(JsonWriter writer, Object value) - throws IOException, IllegalAccessException; - - abstract void read(JsonReader reader, Object value) - throws IOException, IllegalAccessException; - } - - public static final class Adapter extends TypeAdapter { - private final ObjectConstructor constructor; - private final Map boundFields; - - private Adapter( - ObjectConstructor constructor, - Map boundFields) { - this.constructor = constructor; - this.boundFields = boundFields; - } - - @Override - public T read(JsonReader in) throws IOException { - if (in.peek() == JsonToken.NULL) { - in.nextNull(); - return null; - } - - T instance = constructor.construct(); - - try { - in.beginObject(); - while (in.hasNext()) { - String name = in.nextName(); - BoundField field = boundFields.get(name); - if (field == null || !field.deserialized) { - in.skipValue(); - } else { - field.read(in, instance); - } - } - } catch (IllegalStateException e) { - throw new JsonSyntaxException(e); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - in.endObject(); - return instance; - } - - @Override - public void write(JsonWriter out, T value) throws IOException { - if (value == null) { - out.nullValue(); - return; - } - - out.beginObject(); - try { - for (BoundField boundField : boundFields.values()) { - if (boundField.serialized) { - out.name(boundField.name); - boundField.write(out, value); - } - } - } catch (IllegalAccessException e) { - throw new AssertionError(); - } - out.endObject(); - } - } - } - - static class TypeAdapterRuntimeTypeWrapper extends TypeAdapter { - - private final Gson context; - private final TypeAdapter delegate; - private final Type type; - - TypeAdapterRuntimeTypeWrapper( - Gson context, - TypeAdapter delegate, - Type type) { - this.context = context; - this.delegate = delegate; - this.type = type; - } - - @Override - public T read(JsonReader in) throws IOException { - return delegate.read(in); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void write(JsonWriter out, T value) throws IOException { - // Order of preference for choosing type adapters - // First preference: a type adapter registered for the runtime type - // Second preference: a type adapter registered for the declared type - // Third preference: reflective type adapter for the runtime type (if it is a - // sub class of the declared type) - // Fourth preference: reflective type adapter for the declared type - - TypeAdapter chosen = delegate; - Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value); - if (runtimeType != type) { - TypeAdapter runtimeTypeAdapter = context.getAdapter( - TypeToken.get(runtimeType)); - if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) { - // The user registered a type adapter for the runtime type, so we will use that - chosen = runtimeTypeAdapter; - } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) { - // The user registered a type adapter for Base class, so we prefer it over the - // reflective type adapter for the runtime type - chosen = delegate; - } else { - // Use the type adapter for runtime type - chosen = runtimeTypeAdapter; - } - } - chosen.write(out, value); - } - - /** Finds a compatible runtime type if it is more specific */ - private Type getRuntimeTypeIfMoreSpecific(Type type, Object value) { - if (value != null && - (type == Object.class || - type instanceof TypeVariable || - type instanceof Class)) { - type = value.getClass(); - } - return type; - } - } -} diff --git a/templates/java/JavaTimeFormatter.mustache b/templates/java/JavaTimeFormatter.mustache deleted file mode 100644 index 5850c6425e..0000000000 --- a/templates/java/JavaTimeFormatter.mustache +++ /dev/null @@ -1,58 +0,0 @@ -package {{invokerPackage}}; - -{{^threetenbp}} -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -{{/threetenbp}} -{{#threetenbp}} -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import org.threeten.bp.format.DateTimeParseException; -{{/threetenbp}} - -/** - * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. - * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. - */ -public class JavaTimeFormatter { - - private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; - - /** - * Get the date format used to parse/format {@code OffsetDateTime} parameters. - * @return DateTimeFormatter - */ - public DateTimeFormatter getOffsetDateTimeFormatter() { - return offsetDateTimeFormatter; - } - - /** - * Set the date format used to parse/format {@code OffsetDateTime} parameters. - * @param offsetDateTimeFormatter {@code DateTimeFormatter} - */ - public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { - this.offsetDateTimeFormatter = offsetDateTimeFormatter; - } - - /** - * Parse the given string into {@code OffsetDateTime} object. - * @param str String - * @return {@code OffsetDateTime} - */ - public OffsetDateTime parseOffsetDateTime(String str) { - try { - return OffsetDateTime.parse(str, offsetDateTimeFormatter); - } catch (DateTimeParseException e) { - throw new RuntimeException(e); - } - } - /** - * Format the given {@code OffsetDateTime} object into string. - * @param offsetDateTime {@code OffsetDateTime} - * @return {@code OffsetDateTime} in string format - */ - public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { - return offsetDateTimeFormatter.format(offsetDateTime); - } -} diff --git a/templates/java/gradle-wrapper.jar.mustache b/templates/java/gradle-wrapper.jar.mustache deleted file mode 100644 index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 59536 zcma&NbC71ylI~qywr$(CZQJHswz}-9F59+k+g;UV+cs{`J?GrGXYR~=-ydruB3JCa zB64N^cILAcWk5iofq)<(fq;O7{th4@;QxID0)qN`mJ?GIqLY#rX8-|G{5M0pdVW5^ zzXk$-2kQTAC?_N@B`&6-N-rmVFE=$QD?>*=4<|!MJu@}isLc4AW#{m2if&A5T5g&~ ziuMQeS*U5sL6J698wOd)K@oK@1{peP5&Esut<#VH^u)gp`9H4)`uE!2$>RTctN+^u z=ASkePDZA-X8)rp%D;p*~P?*a_=*Kwc<^>QSH|^<0>o37lt^+Mj1;4YvJ(JR-Y+?%Nu}JAYj5 z_Qc5%Ao#F?q32i?ZaN2OSNhWL;2o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m4B+9E*e((Y89!q?zH|mz_vM>kp*HGXldO0Hg#!EtFhRuOm$u8e~a9 z5(roy7m$Kh+zjW6@zw{&20u?1f2uP&boD}$#Zy)4o&T;vyBoqFiF2t;*g=|1=)PxB z8eM3Mp=l_obbc?I^xyLz?4Y1YDWPa+nm;O<$Cn;@ane616`J9OO2r=rZr{I_Kizyc zP#^^WCdIEp*()rRT+*YZK>V@^Zs=ht32x>Kwe zab)@ZEffz;VM4{XA6e421^h~`ji5r%)B{wZu#hD}f3$y@L0JV9f3g{-RK!A?vBUA}${YF(vO4)@`6f1 z-A|}e#LN{)(eXloDnX4Vs7eH|<@{r#LodP@Nz--$Dg_Par%DCpu2>2jUnqy~|J?eZ zBG4FVsz_A+ibdwv>mLp>P!(t}E>$JGaK$R~;fb{O3($y1ssQQo|5M;^JqC?7qe|hg zu0ZOqeFcp?qVn&Qu7FQJ4hcFi&|nR!*j)MF#b}QO^lN%5)4p*D^H+B){n8%VPUzi! zDihoGcP71a6!ab`l^hK&*dYrVYzJ0)#}xVrp!e;lI!+x+bfCN0KXwUAPU9@#l7@0& QuEJmfE|#`Dqx|px0L@K;Y5)KL diff --git a/templates/java/gradle-wrapper.properties.mustache b/templates/java/gradle-wrapper.properties.mustache deleted file mode 100644 index aa991fceae..0000000000 --- a/templates/java/gradle-wrapper.properties.mustache +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/templates/java/libraries/okhttp-gson/ApiCallback.mustache b/templates/java/libraries/okhttp-gson/ApiCallback.mustache deleted file mode 100644 index abaab5a917..0000000000 --- a/templates/java/libraries/okhttp-gson/ApiCallback.mustache +++ /dev/null @@ -1,49 +0,0 @@ -package {{invokerPackage}}; - -import java.util.Map; -import java.util.List; - -import com.algolia.exceptions.AlgoliaRuntimeException; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(AlgoliaRuntimeException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 62943e4399..6fdc8b9382 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -3,25 +3,25 @@ package {{invokerPackage}}; import com.algolia.utils.Requester; import com.algolia.exceptions.*; import com.algolia.utils.UserAgent; +import com.algolia.utils.JSON; import okhttp3.*; +import com.algolia.utils.echo.EchoRequester; import okhttp3.internal.http.HttpMethod; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.logging.HttpLoggingInterceptor.Level; - import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.net.URLConnection; import java.net.URLEncoder; import java.text.DateFormat; -{{#java8}} import java.time.LocalDate; import java.time.OffsetDateTime; -{{/java8}} import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.concurrent.CompletableFuture; public class ApiClient { @@ -407,81 +407,44 @@ public class ApiClient { } } - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws AlgoliaRuntimeException If fail to execute the call - */ - public ApiResponse execute(Call call) throws AlgoliaRuntimeException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and - * data, which is a Java object deserialized from response body and would be null - * when returnType is null. - * @throws AlgoliaRuntimeException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws AlgoliaRuntimeException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new AlgoliaRuntimeException(e); - } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - /** * Execute HTTP call asynchronously. * * @param Type - * @param call The callback to be executed when the API call finishes * @param returnType Return type - * @param callback ApiCallback * @see #execute(Call, Type) */ - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new AlgoliaRuntimeException(e), 0, null); - } + public CompletableFuture executeAsync(Call call, final Type returnType, String echoResponseClassName) { + final CompletableFuture future = new CompletableFuture<>(); + call.enqueue( + new Callback() { + @Override + public void onFailure(Call call, IOException e) { + future.completeExceptionally(new AlgoliaRuntimeException(e)); + } - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (AlgoliaRuntimeException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure(new AlgoliaRuntimeException(e), response.code(), response.headers().toMultimap()); - return; - } - callback.onSuccess(result, response.code(), response.headers().toMultimap()); + @Override + public void onResponse(Call call, Response response) + throws IOException { + T result; + try { + if(requester instanceof EchoRequester) { + result = (T) handleResponse(response, Class.forName(echoResponseClassName)); + } else { + result = (T) handleResponse(response, returnType); } - }); + } catch (AlgoliaRuntimeException e) { + future.completeExceptionally(e); + return; + } catch (Exception e) { + future.completeExceptionally(new AlgoliaRuntimeException(e)); + return; + } + future.complete(result); + } + } + ); + return future; } /** @@ -530,12 +493,11 @@ public class ApiClient { * @param queryParams The query parameters * @param body The request body object * @param headerParams The header parameters - * @param callback Callback for upload/download progress * @return The HTTP call * @throws AlgoliaRuntimeException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws AlgoliaRuntimeException { - Request request = buildRequest(path, method, queryParams, body, headerParams, callback); + public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { + Request request = buildRequest(path, method, queryParams, body, headerParams); return requester.newCall(request); } @@ -548,11 +510,10 @@ public class ApiClient { * @param queryParams The query parameters * @param body The request body object * @param headerParams The header parameters - * @param callback Callback for upload/download progress * @return The HTTP request * @throws AlgoliaRuntimeException If fail to serialize the request body object */ - public Request buildRequest(String path, String method, List queryParams, Object body, Map headerParams, ApiCallback callback) throws AlgoliaRuntimeException { + public Request buildRequest(String path, String method, List queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { headerParams.put("X-Algolia-Application-Id", this.appId); headerParams.put("X-Algolia-API-Key", this.apiKey); @@ -560,7 +521,7 @@ public class ApiClient { final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); - String contentType = (String) headerParams.get("Content-Type"); + String contentType = headerParams.get("Content-Type"); // ensuring a default content type if (contentType == null) { contentType = "application/json"; @@ -581,20 +542,7 @@ public class ApiClient { reqBody = serialize(body, contentType); } - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; + return reqBuilder.method(method, reqBody).build(); } /** diff --git a/templates/java/libraries/okhttp-gson/ApiResponse.mustache b/templates/java/libraries/okhttp-gson/ApiResponse.mustache deleted file mode 100644 index 0d2c7b1cd7..0000000000 --- a/templates/java/libraries/okhttp-gson/ApiResponse.mustache +++ /dev/null @@ -1,56 +0,0 @@ -package {{invokerPackage}}; - -import java.util.List; -import java.util.Map; -{{#caseInsensitiveResponseHeaders}} -import java.util.Map.Entry; -import java.util.TreeMap; -{{/caseInsensitiveResponseHeaders}} - -/** - * API response returned by API call. - * - * @param The type of data that is deserialized from response body - */ -public class ApiResponse { - final private int statusCode; - final private Map> headers; - final private T data; - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - {{#caseInsensitiveResponseHeaders}} - Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); - for(Entry> entry : headers.entrySet()){ - responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); - } - {{/caseInsensitiveResponseHeaders}} - this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; - this.data = data; - } - - public int getStatusCode() { - return statusCode; - } - - public Map> getHeaders() { - return headers; - } - - public T getData() { - return data; - } -} diff --git a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache b/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache deleted file mode 100644 index b0ac8180e4..0000000000 --- a/templates/java/libraries/okhttp-gson/ProgressRequestBody.mustache +++ /dev/null @@ -1,60 +0,0 @@ -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.RequestBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache b/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache deleted file mode 100644 index 2db7b35157..0000000000 --- a/templates/java/libraries/okhttp-gson/ProgressResponseBody.mustache +++ /dev/null @@ -1,57 +0,0 @@ -package {{invokerPackage}}; - -import okhttp3.MediaType; -import okhttp3.ResponseBody; - -import java.io.IOException; - -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 8c27a5464d..9855a6544f 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -1,8 +1,6 @@ package {{package}}; -import {{invokerPackage}}.ApiCallback; import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.ApiResponse; import {{invokerPackage}}.Pair; import com.google.gson.reflect.TypeToken; @@ -29,6 +27,7 @@ import java.util.Map; {{/fullJavaUtil}} import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.concurrent.CompletableFuture; {{#operations}} public class {{classname}} extends ApiClient { @@ -37,6 +36,10 @@ public class {{classname}} extends ApiClient { public {{classname}}(String appId, String apiKey) { this(appId, apiKey, new HttpRequester(getDefaultHosts(null)), null); } + + public {{classname}}(String appId, String apiKey, UserAgent.Segment[] userAgentSegments) { + this(appId, apiKey, new HttpRequester(getDefaultHosts(null)), userAgentSegments); + } {{/fallbackToAliasHost}} public {{classname}}(String appId, String apiKey, String region) { @@ -95,73 +98,6 @@ public class {{classname}} extends ApiClient { {{/hasRegionalHost}} {{#operation}} - /** - * Build call for {{operationId}} - * @param callback Callback for upload/download progress - * @return Call to execute - * @throws AlgoliaRuntimeException If fail to serialize the request body object - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} - {{#externalDocs}} - * {{&description}} - * @see {{&summary}} Documentation - {{/externalDocs}} - */ - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - private Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}> callback) throws AlgoliaRuntimeException { - Object bodyObj = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - - // create path and map variables - String requestPath = "{{{path}}}"{{#vendorExtensions}}{{#pathParams}}.replaceAll( - {{=<% %>=}}"\\{<%baseName%>\\}"<%={{ }}=%>, - {{#x-is-custom-request}}{{{paramName}}}.toString(){{/x-is-custom-request}}{{^x-is-custom-request}}this.escapeString({{{paramName}}}.toString()){{/x-is-custom-request}} - ){{/pathParams}}{{/vendorExtensions}}; - - {{javaUtilPrefix}}List queryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}Map headers = new {{javaUtilPrefix}}HashMap(); - - {{#vendorExtensions}}{{#queryParams}} - if ({{paramName}} != null) { - {{^x-is-custom-request}} - queryParams.addAll(this.parameterToPair("{{baseName}}", {{paramName}})); - {{/x-is-custom-request}} - {{#x-is-custom-request}} - for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll(this.parameterToPair(parameter.getKey(), parameter.getValue())); - } - {{/x-is-custom-request}} - } - - {{/queryParams}}{{/vendorExtensions}} - {{#headerParams}} - if ({{paramName}} != null) { - headers.put("{{baseName}}", this.parameterToString({{paramName}})); - } - - {{/headerParams}} - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - return this.buildCall(requestPath, "{{httpMethod}}", queryParams, bodyObj, headers, callback); - } - - {{#isDeprecated}} - @Deprecated - {{/isDeprecated}} - private Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}> callback) throws AlgoliaRuntimeException { - {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set - if ({{paramName}} == null) { - throw new AlgoliaRuntimeException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); - } - {{/required}}{{/allParams}} - - return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}callback); - } - /** * {{¬es}}{{#allParams}} * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} @@ -179,14 +115,7 @@ public class {{classname}} extends ApiClient { @Deprecated {{/isDeprecated}} public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws AlgoliaRuntimeException { - Call req = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); - if (req instanceof CallEcho) { - {{#returnType}}return new EchoResponse{{baseName}}.{{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}(((CallEcho)req).request());{{/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}} + return LaunderThrowable.await({{operationId}}Async({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}})); } {{#optionalParams.0}} @@ -199,8 +128,7 @@ public class {{classname}} extends ApiClient { * (asynchronously) * {{notes}}{{#allParams}} * @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} - * @param callback The callback to be executed when the API call finishes - * @return The request call + * @return The awaitable future * @throws AlgoliaRuntimeException If fail to process the API call, e.g. serializing the request body object {{#isDeprecated}} * @deprecated @@ -213,11 +141,50 @@ public class {{classname}} extends ApiClient { {{#isDeprecated}} @Deprecated {{/isDeprecated}} - public Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> callback) throws AlgoliaRuntimeException { - 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; + public CompletableFuture<{{{returnType}}}> {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}},{{/-last}} {{/allParams}}) throws AlgoliaRuntimeException { + {{#allParams}}{{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new AlgoliaRuntimeException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); + } + {{/required}}{{/allParams}} + + Object bodyObj = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + + // create path and map variables + String requestPath = "{{{path}}}"{{#vendorExtensions}}{{#pathParams}}.replaceAll( + {{=<% %>=}}"\\{<%baseName%>\\}"<%={{ }}=%>, + {{#x-is-custom-request}}{{{paramName}}}.toString(){{/x-is-custom-request}}{{^x-is-custom-request}}this.escapeString({{{paramName}}}.toString()){{/x-is-custom-request}} + ){{/pathParams}}{{/vendorExtensions}}; + + {{javaUtilPrefix}}List queryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map headers = new {{javaUtilPrefix}}HashMap(); + + {{#vendorExtensions}}{{#queryParams}} + if ({{paramName}} != null) { + {{^x-is-custom-request}} + queryParams.addAll(this.parameterToPair("{{baseName}}", {{paramName}})); + {{/x-is-custom-request}} + {{#x-is-custom-request}} + for (Map.Entry parameter : parameters.entrySet()) { + queryParams.addAll(this.parameterToPair(parameter.getKey(), parameter.getValue())); + } + {{/x-is-custom-request}} + } + + {{/queryParams}}{{/vendorExtensions}} + {{#headerParams}} + if ({{paramName}} != null) { + headers.put("{{baseName}}", this.parameterToString({{paramName}})); + } + + {{/headerParams}} + headers.put("Accept", "application/json"); + headers.put("Content-Type", "application/json"); + + Call call = this.buildCall(requestPath, "{{httpMethod}}", queryParams, bodyObj, headers); + Type returnType = new TypeToken<{{{returnType}}}>() {}.getType(); + return this.executeAsync(call, returnType, "com.algolia.utils.echo.EchoResponse{{baseName}}${{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}"); } {{/operation}} } diff --git a/templates/java/manifest.mustache b/templates/java/manifest.mustache deleted file mode 100644 index f44bd07d0a..0000000000 --- a/templates/java/manifest.mustache +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/templates/java/pojo.mustache b/templates/java/pojo.mustache index 105d3aa1ff..dd2ed4f44a 100644 --- a/templates/java/pojo.mustache +++ b/templates/java/pojo.mustache @@ -61,7 +61,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ } {{#isArray}} - public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} add{{nameInCamelCase}}({{{items.datatypeWithEnum}}} {{name}}Item) { {{^required}} if (this.{{name}} == null) { this.{{name}} = {{{defaultValue}}}; @@ -73,7 +73,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{ {{/isArray}} {{#isMap}} - public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + public {{classname}} put{{nameInCamelCase}}(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { {{^required}} if (this.{{name}} == null) { this.{{name}} = {{{defaultValue}}}; From a6bbcfa7b3a1218e6a31873daa48550596142883 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 16:56:08 +0200 Subject: [PATCH 02/15] shut off java CTS --- scripts/cts/runCts.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/cts/runCts.ts b/scripts/cts/runCts.ts index f07193c6a0..d8edbff3d6 100644 --- a/scripts/cts/runCts.ts +++ b/scripts/cts/runCts.ts @@ -11,9 +11,11 @@ async function runCtsOne(language: string, verbose: boolean): Promise { await run('yarn workspace javascript-tests test', { verbose }); break; case 'java': + /* await run('./gradle/gradlew --no-daemon -p tests/output/java test', { verbose, }); + */ break; case 'php': { let php = 'php8'; From dd2fbb5fc63bd6ffe4911a6cafcd9a69c119b293 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 16:57:14 +0200 Subject: [PATCH 03/15] json --- templates/java/oneof_interface.mustache | 2 +- tests/CTS/methods/requests/templates/java/requests.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/java/oneof_interface.mustache b/templates/java/oneof_interface.mustache index 790a0409c1..954f5687a0 100644 --- a/templates/java/oneof_interface.mustache +++ b/templates/java/oneof_interface.mustache @@ -1,5 +1,5 @@ import com.algolia.utils.CompoundType; -import com.algolia.JSON; +import com.algolia.utils.JSON; import com.google.gson.TypeAdapter; import com.google.gson.reflect.TypeToken; diff --git a/tests/CTS/methods/requests/templates/java/requests.mustache b/tests/CTS/methods/requests/templates/java/requests.mustache index 524f7c9101..401548ac74 100644 --- a/tests/CTS/methods/requests/templates/java/requests.mustache +++ b/tests/CTS/methods/requests/templates/java/requests.mustache @@ -12,7 +12,7 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.BeforeAll; import com.google.gson.reflect.TypeToken; -import com.algolia.JSON; +import com.algolia.utils.JSON; import com.algolia.Pair; import com.algolia.model.{{import}}.*; import com.algolia.api.{{client}}; From 4fa96b0c287eb2267191427ccc5462d94c306961 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 17:30:51 +0200 Subject: [PATCH 04/15] missed one --- .../src/main/java/com/algolia/utils/echo/CallEcho.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java index 69f314b282..122402224b 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java @@ -1,6 +1,6 @@ package com.algolia.utils.echo; -import com.algolia.JSON; +import com.algolia.utils.JSON; import com.algolia.Pair; import com.google.gson.JsonArray; import com.google.gson.JsonObject; From eb423953dd22cf49cce1eaf4afda74d77c21788a Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 10:06:53 +0200 Subject: [PATCH 05/15] gen cts --- .../test/java/com/algolia/methods/requests/abtesting.test.java | 2 +- .../test/java/com/algolia/methods/requests/analytics.test.java | 2 +- .../test/java/com/algolia/methods/requests/insights.test.java | 2 +- .../java/com/algolia/methods/requests/personalization.test.java | 2 +- .../com/algolia/methods/requests/query-suggestions.test.java | 2 +- .../test/java/com/algolia/methods/requests/recommend.test.java | 2 +- .../src/test/java/com/algolia/methods/requests/search.test.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java index 91bf6d8081..e8e3328ff9 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.AbtestingClient; import com.algolia.model.abtesting.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java index e1f1e7e6c5..dbd4f05d65 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.AnalyticsClient; import com.algolia.model.analytics.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java index 676f86d305..dcc9e7cca7 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.InsightsClient; import com.algolia.model.insights.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java index aa531ea904..c84b2bec16 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.PersonalizationClient; import com.algolia.model.personalization.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java index ccda89787a..5c77d03087 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.QuerySuggestionsClient; import com.algolia.model.querySuggestions.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java index 7c011201f3..ee75feed4a 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.RecommendClient; import com.algolia.model.recommend.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java index 12f276ddc3..3f651619ac 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java @@ -3,10 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; -import com.algolia.JSON; import com.algolia.Pair; import com.algolia.api.SearchClient; import com.algolia.model.search.*; +import com.algolia.utils.JSON; import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; From 7faa913be24a610ab79a73e9713c6ea46296e623 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 13:40:03 +0200 Subject: [PATCH 06/15] finally passing --- .../java/com/algolia/utils/HttpRequester.java | 84 + .../java/com/algolia/utils/Requester.java | 6 + .../utils/echo/EchoResponseAbtesting.java | 315 --- .../utils/echo/EchoResponseAnalytics.java | 699 ------ .../utils/echo/EchoResponseInsights.java | 187 -- .../utils/echo/EchoResponseInterface.java | 14 - .../echo/EchoResponsePersonalization.java | 283 --- .../utils/echo/EchoResponsePredict.java | 187 -- .../echo/EchoResponseQuerySuggestions.java | 379 ---- .../utils/echo/EchoResponseRecommend.java | 187 -- .../utils/echo/EchoResponseSearch.java | 1976 ----------------- .../algolia/codegen/AlgoliaJavaGenerator.java | 35 - scripts/cts/runCts.ts | 2 - .../libraries/okhttp-gson/ApiClient.mustache | 124 +- .../java/libraries/okhttp-gson/api.mustache | 4 +- .../requests/templates/java/requests.mustache | 21 +- .../src/test/java/com/algolia}/CallEcho.java | 47 +- .../test/java/com/algolia}/EchoRequester.java | 25 +- .../test/java/com/algolia/EchoResponse.java | 11 + .../methods/requests/abtesting.test.java | 179 +- .../methods/requests/analytics.test.java | 758 ++++--- .../methods/requests/insights.test.java | 129 +- .../requests/personalization.test.java | 167 +- .../requests/query-suggestions.test.java | 203 +- .../methods/requests/recommend.test.java | 213 +- .../algolia/methods/requests/search.test.java | 1077 +++++---- 26 files changed, 1533 insertions(+), 5779 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAbtesting.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAnalytics.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInsights.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePersonalization.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePredict.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseQuerySuggestions.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseRecommend.java delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseSearch.java rename {clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo => tests/output/java/src/test/java/com/algolia}/CallEcho.java (66%) rename {clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo => tests/output/java/src/test/java/com/algolia}/EchoRequester.java (62%) create mode 100644 tests/output/java/src/test/java/com/algolia/EchoResponse.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java index 863d954dc4..208fb19d90 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java @@ -1,12 +1,17 @@ package com.algolia.utils; +import com.algolia.ApiClient; +import com.algolia.exceptions.*; import com.algolia.utils.retry.RetryStrategy; import com.algolia.utils.retry.StatefulHost; +import java.lang.reflect.Type; import java.util.List; import java.util.concurrent.TimeUnit; import okhttp3.Call; import okhttp3.OkHttpClient; +import java.io.IOException; import okhttp3.Request; +import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.logging.HttpLoggingInterceptor.Level; @@ -31,6 +36,85 @@ public Call newCall(Request request) { return httpClient.newCall(request); } + public T handleResponse(Response response, Type returnType) + throws AlgoliaRuntimeException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new AlgoliaApiException( + response.message(), + e, + response.code() + ); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + if (response.body() != null) { + try { + response.body().string(); + } catch (IOException e) { + throw new AlgoliaApiException(response.message(), e, response.code()); + } + } + throw new AlgoliaApiException(response.message(), response.code()); + } + } + + private T deserialize(Response response, Type returnType) + throws AlgoliaRuntimeException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new AlgoliaRuntimeException(e); + } + } + + String respBody; + try { + if (response.body() != null) respBody = + response.body().string(); else respBody = null; + } catch (IOException e) { + throw new AlgoliaRuntimeException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + contentType = "application/json"; + } + if (ApiClient.isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new AlgoliaApiException( + "Content type \"" + + contentType + + "\" is not supported for type: " + + returnType, + response.code() + ); + } + } + public void setDebugging(boolean debugging) { if (debugging != this.debugging) { if (debugging) { diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java index 919dd7c8bb..1a832def15 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java @@ -1,11 +1,17 @@ package com.algolia.utils; +import java.lang.reflect.Type; import okhttp3.Call; import okhttp3.Request; +import okhttp3.Response; +import com.algolia.exceptions.AlgoliaRuntimeException; public interface Requester { public Call newCall(Request request); + public T handleResponse(Response response, Type returnType) + throws AlgoliaRuntimeException; + /** * Enable/disable debugging for this API client. * diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAbtesting.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAbtesting.java deleted file mode 100644 index 340f1177c9..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAbtesting.java +++ /dev/null @@ -1,315 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.abtesting.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseAbtesting { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class AddABTests - extends ABTestResponse - implements EchoResponseInterface { - - private Request request; - - public AddABTests(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class DeleteABTest - extends ABTestResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteABTest(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetABTest - extends ABTest - implements EchoResponseInterface { - - private Request request; - - public GetABTest(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class ListABTests - extends ListABTestsResponse - implements EchoResponseInterface { - - private Request request; - - public ListABTests(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class StopABTest - extends ABTestResponse - implements EchoResponseInterface { - - private Request request; - - public StopABTest(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAnalytics.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAnalytics.java deleted file mode 100644 index e1edfe5846..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseAnalytics.java +++ /dev/null @@ -1,699 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.analytics.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseAnalytics { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetAverageClickPosition - extends GetAverageClickPositionResponse - implements EchoResponseInterface { - - private Request request; - - public GetAverageClickPosition(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetClickPositions - extends GetClickPositionsResponse - implements EchoResponseInterface { - - private Request request; - - public GetClickPositions(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetClickThroughRate - extends GetClickThroughRateResponse - implements EchoResponseInterface { - - private Request request; - - public GetClickThroughRate(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetConversationRate - extends GetConversationRateResponse - implements EchoResponseInterface { - - private Request request; - - public GetConversationRate(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetNoClickRate - extends GetNoClickRateResponse - implements EchoResponseInterface { - - private Request request; - - public GetNoClickRate(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetNoResultsRate - extends GetNoResultsRateResponse - implements EchoResponseInterface { - - private Request request; - - public GetNoResultsRate(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetSearchesCount - extends GetSearchesCountResponse - implements EchoResponseInterface { - - private Request request; - - public GetSearchesCount(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetSearchesNoClicks - extends GetSearchesNoClicksResponse - implements EchoResponseInterface { - - private Request request; - - public GetSearchesNoClicks(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetSearchesNoResults - extends GetSearchesNoResultsResponse - implements EchoResponseInterface { - - private Request request; - - public GetSearchesNoResults(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetStatus - extends GetStatusResponse - implements EchoResponseInterface { - - private Request request; - - public GetStatus(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopCountries - extends GetTopCountriesResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopCountries(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopFilterAttributes - extends GetTopFilterAttributesResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopFilterAttributes(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopFilterForAttribute - extends GetTopFilterForAttributeResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopFilterForAttribute(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopFiltersNoResults - extends GetTopFiltersNoResultsResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopFiltersNoResults(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopHits - extends GetTopHitsResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopHits(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetTopSearches - extends GetTopSearchesResponse - implements EchoResponseInterface { - - private Request request; - - public GetTopSearches(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetUsersCount - extends GetUsersCountResponse - implements EchoResponseInterface { - - private Request request; - - public GetUsersCount(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInsights.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInsights.java deleted file mode 100644 index f54b64160c..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInsights.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.insights.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseInsights { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class PushEvents - extends PushEventsResponse - implements EchoResponseInterface { - - private Request request; - - public PushEvents(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java deleted file mode 100644 index 1a5ab9cbae..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import java.util.List; - -public interface EchoResponseInterface { - public String getPath(); - - public String getMethod(); - - public String getBody(); - - public List getQueryParams(); -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePersonalization.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePersonalization.java deleted file mode 100644 index 498f62003d..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePersonalization.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.personalization.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponsePersonalization { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class DeleteUserProfile - extends DeleteUserProfileResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteUserProfile(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetPersonalizationStrategy - extends PersonalizationStrategyParams - implements EchoResponseInterface { - - private Request request; - - public GetPersonalizationStrategy(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetUserTokenProfile - extends GetUserTokenResponse - implements EchoResponseInterface { - - private Request request; - - public GetUserTokenProfile(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class SetPersonalizationStrategy - extends SetPersonalizationStrategyResponse - implements EchoResponseInterface { - - private Request request; - - public SetPersonalizationStrategy(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePredict.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePredict.java deleted file mode 100644 index 6c3f7abca2..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponsePredict.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.predict.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponsePredict { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class FetchUserProfile - extends FetchUserProfileResponse - implements EchoResponseInterface { - - private Request request; - - public FetchUserProfile(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseQuerySuggestions.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseQuerySuggestions.java deleted file mode 100644 index 9d1d1eafee..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseQuerySuggestions.java +++ /dev/null @@ -1,379 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.querySuggestions.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseQuerySuggestions { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class CreateConfig - extends SucessResponse - implements EchoResponseInterface { - - private Request request; - - public CreateConfig(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class DeleteConfig - extends SucessResponse - implements EchoResponseInterface { - - private Request request; - - public DeleteConfig(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetAllConfigs - extends ArrayList - implements EchoResponseInterface { - - private Request request; - - public GetAllConfigs(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetConfig - extends QuerySuggestionsIndex - implements EchoResponseInterface { - - private Request request; - - public GetConfig(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetConfigStatus - extends Status - implements EchoResponseInterface { - - private Request request; - - public GetConfigStatus(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetLogFile - extends ArrayList - implements EchoResponseInterface { - - private Request request; - - public GetLogFile(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class UpdateConfig - extends SucessResponse - implements EchoResponseInterface { - - private Request request; - - public UpdateConfig(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseRecommend.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseRecommend.java deleted file mode 100644 index 615e48b344..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseRecommend.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.recommend.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseRecommend { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetRecommendations - extends GetRecommendationsResponse - implements EchoResponseInterface { - - private Request request; - - public GetRecommendations(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseSearch.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseSearch.java deleted file mode 100644 index 15f444dc99..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseSearch.java +++ /dev/null @@ -1,1976 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import com.algolia.model.search.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okio.Buffer; - -public class EchoResponseSearch { - - 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"; - } - } - - private static List buildQueryParams(Request req) { - List params = new ArrayList(); - HttpUrl url = req.url(); - for (String name : url.queryParameterNames()) { - for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); - } - } - return params; - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Del extends Object implements EchoResponseInterface { - - private Request request; - - public Del(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Get extends Object implements EchoResponseInterface { - - private Request request; - - public Get(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class GetApiKey extends Key implements EchoResponseInterface { - - private Request request; - - public GetApiKey(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Post extends Object implements EchoResponseInterface { - - private Request request; - - public Post(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - public static class Put extends Object implements EchoResponseInterface { - - private Request request; - - public Put(Request request) { - this.request = request; - } - - public String getPath() { - return request.url().encodedPath(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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 String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - - 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(); - } - - public String getMethod() { - return request.method(); - } - - public String getBody() { - return parseRequestBody(request); - } - - public List getQueryParams() { - return buildQueryParams(request); - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } -} diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java index 9ff168e115..e6600f1e14 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java @@ -87,41 +87,6 @@ public Map postProcessAllModels(Map objs) { return models; } - @Override - public Map postProcessSupportingFileData( - Map objs - ) { - Map bundle = super.postProcessSupportingFileData(objs); - List> apis = - ((Map>>) bundle.get("apiInfo")).get( - "apis" - ); - - for (Map api : apis) { - String clientName = (String) api.get("baseName"); - supportingFiles.add( - new SupportingFile( - "EchoResponse.mustache", - sourceFolder + "/com/algolia/utils/echo", - "EchoResponse" + clientName + ".java" - ) - ); - - List operations = - ((Map>) api.get("operations")).get( - "operation" - ); - - for (CodegenOperation ope : operations) { - ope.returnType = - ope.returnType - .replace("Map<", "HashMap<") - .replace("List<", "ArrayList<"); - } - } - return bundle; - } - /** * Returns human-friendly help for the generator. Provide the consumer with help tips, parameters * here diff --git a/scripts/cts/runCts.ts b/scripts/cts/runCts.ts index d8edbff3d6..f07193c6a0 100644 --- a/scripts/cts/runCts.ts +++ b/scripts/cts/runCts.ts @@ -11,11 +11,9 @@ async function runCtsOne(language: string, verbose: boolean): Promise { await run('yarn workspace javascript-tests test', { verbose }); break; case 'java': - /* await run('./gradle/gradlew --no-daemon -p tests/output/java test', { verbose, }); - */ break; case 'php': { let php = 'php8'; diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 6fdc8b9382..4d54a6a26a 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -6,7 +6,6 @@ import com.algolia.utils.UserAgent; import com.algolia.utils.JSON; import okhttp3.*; -import com.algolia.utils.echo.EchoRequester; import okhttp3.internal.http.HttpMethod; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.logging.HttpLoggingInterceptor.Level; @@ -306,7 +305,7 @@ public class ApiClient { * @param mime MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ - public boolean isJsonMime(String mime) { + public static boolean isJsonMime(String mime) { String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); } @@ -325,62 +324,6 @@ public class ApiClient { } } - /** - * Deserialize response body to Java object, according to the return type and - * the Content-Type response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws AlgoliaRuntimeException If fail to deserialize response body, i.e. cannot read response body - * or the Content-Type of the response is not supported. - */ - public T deserialize(Response response, Type returnType) throws AlgoliaRuntimeException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new AlgoliaRuntimeException(e); - } - } - - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new AlgoliaRuntimeException(e); - } - - if (respBody == null || "".equals(respBody)) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - if (isJsonMime(contentType)) { - return JSON.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new AlgoliaApiException( - "Content type \"" + contentType + "\" is not supported for type: " + returnType, - response.code()); - } - } - /** * Serialize the given Java object into request body according to the object's * class and the request Content-Type. @@ -414,7 +357,7 @@ public class ApiClient { * @param returnType Return type * @see #execute(Call, Type) */ - public CompletableFuture executeAsync(Call call, final Type returnType, String echoResponseClassName) { + public CompletableFuture executeAsync(Call call, final Type returnType) { final CompletableFuture future = new CompletableFuture<>(); call.enqueue( new Callback() { @@ -426,63 +369,18 @@ public class ApiClient { @Override public void onResponse(Call call, Response response) throws IOException { - T result; - try { - if(requester instanceof EchoRequester) { - result = (T) handleResponse(response, Class.forName(echoResponseClassName)); - } else { - result = (T) handleResponse(response, returnType); + try { + T result = requester.handleResponse(response, returnType); + future.complete(result); + } catch (AlgoliaRuntimeException e) { + future.completeExceptionally(e); + } catch (Exception e) { + future.completeExceptionally(new AlgoliaRuntimeException(e)); } - } catch (AlgoliaRuntimeException e) { - future.completeExceptionally(e); - return; - } catch (Exception e) { - future.completeExceptionally(new AlgoliaRuntimeException(e)); - return; } - future.complete(result); - } - } - ); - return future; - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws AlgoliaRuntimeException If the response has an unsuccessful status code or - * fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws AlgoliaRuntimeException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new AlgoliaApiException(response.message(), e, response.code()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - if (response.body() != null) { - try { - response.body().string(); - } catch (IOException e) { - throw new AlgoliaApiException(response.message(), e, response.code()); - } - } - throw new AlgoliaApiException(response.message(), response.code()); } + ); + return future; } /** diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 9855a6544f..1084d3e89c 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -9,7 +9,6 @@ import okhttp3.Call; import okhttp3.Request; import com.algolia.utils.*; -import com.algolia.utils.echo.*; import {{modelPackage}}.*; import com.algolia.exceptions.*; import com.algolia.utils.retry.CallType; @@ -143,7 +142,6 @@ public class {{classname}} extends ApiClient { {{/isDeprecated}} public CompletableFuture<{{{returnType}}}> {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}},{{/-last}} {{/allParams}}) throws AlgoliaRuntimeException { {{#allParams}}{{#required}} - // verify the required parameter '{{paramName}}' is set if ({{paramName}} == null) { throw new AlgoliaRuntimeException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)"); } @@ -184,7 +182,7 @@ public class {{classname}} extends ApiClient { Call call = this.buildCall(requestPath, "{{httpMethod}}", queryParams, bodyObj, headers); Type returnType = new TypeToken<{{{returnType}}}>() {}.getType(); - return this.executeAsync(call, returnType, "com.algolia.utils.echo.EchoResponse{{baseName}}${{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}}"); + return this.executeAsync(call, returnType); } {{/operation}} } diff --git a/tests/CTS/methods/requests/templates/java/requests.mustache b/tests/CTS/methods/requests/templates/java/requests.mustache index 401548ac74..216e9956b4 100644 --- a/tests/CTS/methods/requests/templates/java/requests.mustache +++ b/tests/CTS/methods/requests/templates/java/requests.mustache @@ -16,17 +16,21 @@ import com.algolia.utils.JSON; import com.algolia.Pair; import com.algolia.model.{{import}}.*; import com.algolia.api.{{client}}; -import com.algolia.utils.echo.*; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; + @TestInstance(TestInstance.Lifecycle.PER_CLASS) class {{client}}Tests { private {{client}} client; + private EchoRequester requester; @BeforeAll void init() { - client = new {{client}}("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new {{client}}("appId", "apiKey", requester); } {{#blocks}} @@ -36,22 +40,23 @@ class {{client}}Tests { void {{method}}Test{{testIndex}}() { {{#parametersWithDataType}}{{> generateParams}}{{/parametersWithDataType}} - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.{{method}}({{#parametersWithDataType}}{{> maybeConvertOneOf}}{{^-last}},{{/-last}}{{/parametersWithDataType}}); + assertDoesNotThrow(() -> { + client.{{method}}({{#parametersWithDataType}}{{> maybeConvertOneOf}}{{^-last}},{{/-last}}{{/parametersWithDataType}}); }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "{{{request.path}}}"); - assertEquals(req.getMethod(), "{{{request.method}}}"); + assertEquals(req.path, "{{{request.path}}}"); + assertEquals(req.method, "{{{request.method}}}"); {{#request.body}} assertDoesNotThrow(() -> { - JSONAssert.assertEquals("{{#lambda.escapequotes}}{{{request.body}}}{{/lambda.escapequotes}}", req.getBody(), JSONCompareMode.STRICT_ORDER); + JSONAssert.assertEquals("{{#lambda.escapequotes}}{{{request.body}}}{{/lambda.escapequotes}}", req.body, JSONCompareMode.STRICT_ORDER); }); {{/request.body}} {{#request.queryParameters}} Map expectedQuery = JSON.deserialize("{{#lambda.escapequotes}}{{{request.queryParameters}}}{{/lambda.escapequotes}}", new TypeToken>() {}.getType()); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java b/tests/output/java/src/test/java/com/algolia/CallEcho.java similarity index 66% rename from clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java rename to tests/output/java/src/test/java/com/algolia/CallEcho.java index 122402224b..cdcebe41d4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java +++ b/tests/output/java/src/test/java/com/algolia/CallEcho.java @@ -1,9 +1,6 @@ -package com.algolia.utils.echo; +package com.algolia; import com.algolia.utils.JSON; -import com.algolia.Pair; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -39,6 +36,20 @@ public Call clone() { return null; } + private String processResponseBody() { + try { + final Request copy = request.newBuilder().build(); + final Buffer buffer = new Buffer(); + if(copy.body() == null) { + return ""; + } + copy.body().writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + return "error"; + } + } + private List buildQueryParams() { List params = new ArrayList(); HttpUrl url = request.url(); @@ -58,29 +69,11 @@ public void enqueue(Callback callback) { builder.protocol(Protocol.HTTP_2); builder.message("EchoRequest"); try { - JsonObject body = new JsonObject(); - body.addProperty("path", request.url().encodedPath()); - body.addProperty("method", request.method()); - body.add( - "queryParameters", - (JsonArray) JSON.deserialize( - JSON.serialize(buildQueryParams()), - JsonArray.class - ) - ); - try { - final Request copy = request.newBuilder().build(); - final Buffer buffer = new Buffer(); - if (copy.body() == null) { - body.addProperty("body", ""); - } else { - copy.body().writeTo(buffer); - body.addProperty("body", buffer.readUtf8()); - } - } catch (final IOException e) { - body.addProperty("body", "error"); - } - System.out.println(body); + EchoResponse body = new EchoResponse(); + body.path = request.url().encodedPath(); + body.method = request.method(); + body.body = processResponseBody(); + body.queryParameters = buildQueryParams(); builder.body( ResponseBody.create( JSON.serialize(body), diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoRequester.java b/tests/output/java/src/test/java/com/algolia/EchoRequester.java similarity index 62% rename from clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoRequester.java rename to tests/output/java/src/test/java/com/algolia/EchoRequester.java index 8e49cf5b13..a5616581ec 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoRequester.java +++ b/tests/output/java/src/test/java/com/algolia/EchoRequester.java @@ -1,12 +1,18 @@ -package com.algolia.utils.echo; +package com.algolia; +import com.algolia.exceptions.*; +import com.algolia.utils.JSON; import com.algolia.utils.Requester; +import java.lang.reflect.Type; import okhttp3.Request; - +import okhttp3.Response; +import java.io.IOException; public class EchoRequester implements Requester { private int connectionTimeout, readTimeout, writeTimeout; + private Response lastResponse; + public EchoRequester() { this.connectionTimeout = 100; this.readTimeout = 100; @@ -17,6 +23,21 @@ public CallEcho newCall(Request request) { return new CallEcho(request); } + public T handleResponse(Response response, Type returnType) + throws AlgoliaRuntimeException { + lastResponse = response; + return null; + } + + public EchoResponse getLastEchoResponse() { + try { + return JSON.deserialize(lastResponse.body().string(), EchoResponse.class); + } catch(IOException e) { + e.printStackTrace(); + return null; + } + } + // NO-OP for now public void setDebugging(boolean debugging) {} diff --git a/tests/output/java/src/test/java/com/algolia/EchoResponse.java b/tests/output/java/src/test/java/com/algolia/EchoResponse.java new file mode 100644 index 0000000000..e19afd4878 --- /dev/null +++ b/tests/output/java/src/test/java/com/algolia/EchoResponse.java @@ -0,0 +1,11 @@ +package com.algolia; + +import java.util.List; + +public class EchoResponse { + + public String path; + public String method; + public String body; + public List queryParameters; +} diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java index e8e3328ff9..754a52b11e 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.AbtestingClient; import com.algolia.model.abtesting.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class AbtestingClientTests { private AbtestingClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new AbtestingClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new AbtestingClient("appId", "apiKey", requester); } @Test @@ -58,18 +61,18 @@ void addABTestsTest0() { addABTestsRequest0.setVariant(variant1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.addABTests(addABTestsRequest0); - } - ); + assertDoesNotThrow(() -> { + client.addABTests(addABTestsRequest0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/abtests"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/2/abtests"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"endAt\":\"2022-12-31T00:00:00.000Z\",\"name\":\"myABTest\",\"variant\":[{\"index\":\"AB_TEST_1\",\"trafficPercentage\":30},{\"index\":\"AB_TEST_2\",\"trafficPercentage\":50}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -80,13 +83,13 @@ void addABTestsTest0() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -99,19 +102,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -123,13 +126,13 @@ void delTest1() { void deleteABTestTest0() { int id0 = 42; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteABTest(id0); - } - ); + assertDoesNotThrow(() -> { + client.deleteABTest(id0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/abtests/42"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/2/abtests/42"); + assertEquals(req.method, "DELETE"); } @Test @@ -137,13 +140,13 @@ void deleteABTestTest0() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -156,19 +159,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -180,13 +183,13 @@ void getTest1() { void getABTestTest0() { int id0 = 42; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getABTest(id0); - } - ); + assertDoesNotThrow(() -> { + client.getABTest(id0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/abtests/42"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/abtests/42"); + assertEquals(req.method, "GET"); } @Test @@ -195,19 +198,19 @@ void listABTestsTest0() { int offset0 = 42; int limit0 = 21; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.listABTests(offset0, limit0); - } - ); + assertDoesNotThrow(() -> { + client.listABTests(offset0, limit0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/abtests"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/abtests"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"offset\":\"42\",\"limit\":\"21\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -219,13 +222,13 @@ void listABTestsTest0() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -243,18 +246,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -263,7 +266,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -275,13 +278,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -299,18 +302,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -319,7 +322,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -331,12 +334,12 @@ void putTest1() { void stopABTestTest0() { int id0 = 42; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.stopABTest(id0); - } - ); + assertDoesNotThrow(() -> { + client.stopABTest(id0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/abtests/42/stop"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/2/abtests/42/stop"); + assertEquals(req.method, "POST"); } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java index dbd4f05d65..504b9c526f 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.AnalyticsClient; import com.algolia.model.analytics.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class AnalyticsClientTests { private AnalyticsClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new AnalyticsClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new AnalyticsClient("appId", "apiKey", requester); } @Test @@ -32,13 +35,13 @@ void init() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -51,19 +54,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -75,13 +78,13 @@ void delTest1() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -94,19 +97,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -118,19 +121,19 @@ void getTest1() { void getAverageClickPositionTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getAverageClickPosition(index0); - } - ); + assertDoesNotThrow(() -> { + client.getAverageClickPosition(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/averageClickPosition"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/averageClickPosition"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -145,24 +148,19 @@ void getAverageClickPositionTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getAverageClickPosition( - index0, - startDate0, - endDate0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getAverageClickPosition(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/averageClickPosition"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/averageClickPosition"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -174,19 +172,19 @@ void getAverageClickPositionTest1() { void getClickPositionsTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getClickPositions(index0); - } - ); + assertDoesNotThrow(() -> { + client.getClickPositions(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/positions"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/positions"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -201,19 +199,19 @@ void getClickPositionsTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getClickPositions(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getClickPositions(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/positions"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/positions"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -225,19 +223,19 @@ void getClickPositionsTest1() { void getClickThroughRateTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getClickThroughRate(index0); - } - ); + assertDoesNotThrow(() -> { + client.getClickThroughRate(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/clickThroughRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/clickThroughRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -252,19 +250,19 @@ void getClickThroughRateTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getClickThroughRate(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getClickThroughRate(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/clicks/clickThroughRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/clicks/clickThroughRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -276,19 +274,19 @@ void getClickThroughRateTest1() { void getConversationRateTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getConversationRate(index0); - } - ); + assertDoesNotThrow(() -> { + client.getConversationRate(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/conversions/conversionRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/conversions/conversionRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -303,19 +301,19 @@ void getConversationRateTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getConversationRate(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getConversationRate(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/conversions/conversionRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/conversions/conversionRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -327,19 +325,19 @@ void getConversationRateTest1() { void getNoClickRateTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getNoClickRate(index0); - } - ); + assertDoesNotThrow(() -> { + client.getNoClickRate(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noClickRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noClickRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -354,19 +352,19 @@ void getNoClickRateTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getNoClickRate(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getNoClickRate(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noClickRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noClickRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -378,19 +376,19 @@ void getNoClickRateTest1() { void getNoResultsRateTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getNoResultsRate(index0); - } - ); + assertDoesNotThrow(() -> { + client.getNoResultsRate(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noResultRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noResultRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -405,19 +403,19 @@ void getNoResultsRateTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getNoResultsRate(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getNoResultsRate(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noResultRate"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noResultRate"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -429,19 +427,19 @@ void getNoResultsRateTest1() { void getSearchesCountTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesCount(index0); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesCount(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/count"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/count"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -456,19 +454,19 @@ void getSearchesCountTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesCount(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesCount(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/count"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/count"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -480,19 +478,19 @@ void getSearchesCountTest1() { void getSearchesNoClicksTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesNoClicks(index0); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesNoClicks(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noClicks"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noClicks"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -509,26 +507,26 @@ void getSearchesNoClicksTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesNoClicks( - index0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesNoClicks( + index0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noClicks"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noClicks"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -540,19 +538,19 @@ void getSearchesNoClicksTest1() { void getSearchesNoResultsTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesNoResults(index0); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesNoResults(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noResults"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noResults"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -569,26 +567,26 @@ void getSearchesNoResultsTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSearchesNoResults( - index0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getSearchesNoResults( + index0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches/noResults"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches/noResults"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -600,19 +598,19 @@ void getSearchesNoResultsTest1() { void getStatusTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getStatus(index0); - } - ); + assertDoesNotThrow(() -> { + client.getStatus(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/status"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/status"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -624,19 +622,19 @@ void getStatusTest0() { void getTopCountriesTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopCountries(index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopCountries(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/countries"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/countries"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -653,26 +651,26 @@ void getTopCountriesTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopCountries( - index0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopCountries( + index0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/countries"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/countries"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -684,19 +682,19 @@ void getTopCountriesTest1() { void getTopFilterAttributesTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterAttributes(index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterAttributes(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -714,27 +712,27 @@ void getTopFilterAttributesTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterAttributes( - index0, - search0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterAttributes( + index0, + search0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -747,19 +745,19 @@ void getTopFilterForAttributeTest0() { String attribute0 = "myAttribute"; String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterForAttribute(attribute0, index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterForAttribute(attribute0, index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/myAttribute"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/myAttribute"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -774,19 +772,19 @@ void getTopFilterForAttributeTest1() { String attribute0 = "myAttribute1,myAttribute2"; String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterForAttribute(attribute0, index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterForAttribute(attribute0, index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/myAttribute1%2CmyAttribute2"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/myAttribute1%2CmyAttribute2"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -805,28 +803,28 @@ void getTopFilterForAttributeTest2() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterForAttribute( - attribute0, - index0, - search0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterForAttribute( + attribute0, + index0, + search0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/myAttribute"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/myAttribute"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -847,28 +845,28 @@ void getTopFilterForAttributeTest3() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFilterForAttribute( - attribute0, - index0, - search0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopFilterForAttribute( + attribute0, + index0, + search0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/myAttribute1%2CmyAttribute2"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/myAttribute1%2CmyAttribute2"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -880,19 +878,19 @@ void getTopFilterForAttributeTest3() { void getTopFiltersNoResultsTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFiltersNoResults(index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopFiltersNoResults(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/noResults"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/noResults"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -910,27 +908,27 @@ void getTopFiltersNoResultsTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopFiltersNoResults( - index0, - search0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopFiltersNoResults( + index0, + search0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/filters/noResults"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/filters/noResults"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -942,19 +940,19 @@ void getTopFiltersNoResultsTest1() { void getTopHitsTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopHits(index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopHits(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/hits"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/hits"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -973,28 +971,28 @@ void getTopHitsTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopHits( - index0, - search0, - clickAnalytics0, - startDate0, - endDate0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopHits( + index0, + search0, + clickAnalytics0, + startDate0, + endDate0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/hits"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/hits"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"search\":\"mySearch\",\"clickAnalytics\":\"true\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1006,19 +1004,19 @@ void getTopHitsTest1() { void getTopSearchesTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopSearches(index0); - } - ); + assertDoesNotThrow(() -> { + client.getTopSearches(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1038,29 +1036,29 @@ void getTopSearchesTest1() { int offset0 = 42; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopSearches( - index0, - clickAnalytics0, - startDate0, - endDate0, - orderBy0, - direction0, - limit0, - offset0, - tags0 - ); - } - ); + assertDoesNotThrow(() -> { + client.getTopSearches( + index0, + clickAnalytics0, + startDate0, + endDate0, + orderBy0, + direction0, + limit0, + offset0, + tags0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/searches"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/searches"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"clickAnalytics\":\"true\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"orderBy\":\"searchCount\",\"direction\":\"asc\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1072,19 +1070,19 @@ void getTopSearchesTest1() { void getUsersCountTest0() { String index0 = "index"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getUsersCount(index0); - } - ); + assertDoesNotThrow(() -> { + client.getUsersCount(index0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/users/count"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/users/count"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1099,19 +1097,19 @@ void getUsersCountTest1() { String endDate0 = "2001-01-01"; String tags0 = "tag"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getUsersCount(index0, startDate0, endDate0, tags0); - } - ); + assertDoesNotThrow(() -> { + client.getUsersCount(index0, startDate0, endDate0, tags0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/2/users/count"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/2/users/count"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1123,13 +1121,13 @@ void getUsersCountTest1() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -1147,18 +1145,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1167,7 +1165,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1179,13 +1177,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -1203,18 +1201,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1223,7 +1221,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java index dcc9e7cca7..c8170ec5c0 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.InsightsClient; import com.algolia.model.insights.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class InsightsClientTests { private InsightsClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new InsightsClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new InsightsClient("appId", "apiKey", requester); } @Test @@ -32,13 +35,13 @@ void init() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -51,19 +54,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -75,13 +78,13 @@ void delTest1() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -94,19 +97,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -118,13 +121,13 @@ void getTest1() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -142,18 +145,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -162,7 +165,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -258,13 +261,13 @@ void pushEventsTest0() { insightEvents0.setEvents(events1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.pushEvents(insightEvents0); - } - ); + assertDoesNotThrow(() -> { + client.pushEvents(insightEvents0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/events"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/events"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( @@ -273,7 +276,7 @@ void pushEventsTest0() { " Detail Page" + " Viewed\",\"index\":\"products\",\"userToken\":\"user-123456\",\"timestamp\":1641290601962,\"objectIDs\":[\"9780545139700\",\"9780439784542\"]},{\"eventType\":\"conversion\",\"eventName\":\"Product" + " Purchased\",\"index\":\"products\",\"userToken\":\"user-123456\",\"timestamp\":1641290601962,\"objectIDs\":[\"9780545139700\",\"9780439784542\"],\"queryID\":\"43b15df305339e827f0ac0bdc5ebcaa7\"}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -284,13 +287,13 @@ void pushEventsTest0() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -308,18 +311,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -328,7 +331,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java index c84b2bec16..f8428c0b06 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.PersonalizationClient; import com.algolia.model.personalization.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class PersonalizationClientTests { private PersonalizationClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new PersonalizationClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new PersonalizationClient("appId", "apiKey", requester); } @Test @@ -32,13 +35,13 @@ void init() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -51,19 +54,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -75,13 +78,13 @@ void delTest1() { void deleteUserProfileTest0() { String userToken0 = "UserToken"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteUserProfile(userToken0); - } - ); + assertDoesNotThrow(() -> { + client.deleteUserProfile(userToken0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/profiles/UserToken"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/profiles/UserToken"); + assertEquals(req.method, "DELETE"); } @Test @@ -89,13 +92,13 @@ void deleteUserProfileTest0() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -108,19 +111,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -130,13 +133,13 @@ void getTest1() { @Test @DisplayName("get getPersonalizationStrategy") void getPersonalizationStrategyTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getPersonalizationStrategy(); - } - ); + assertDoesNotThrow(() -> { + client.getPersonalizationStrategy(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/strategies/personalization"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/strategies/personalization"); + assertEquals(req.method, "GET"); } @Test @@ -144,13 +147,13 @@ void getPersonalizationStrategyTest0() { void getUserTokenProfileTest0() { String userToken0 = "UserToken"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getUserTokenProfile(userToken0); - } - ); + assertDoesNotThrow(() -> { + client.getUserTokenProfile(userToken0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/profiles/personalization/UserToken"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/profiles/personalization/UserToken"); + assertEquals(req.method, "GET"); } @Test @@ -158,13 +161,13 @@ void getUserTokenProfileTest0() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -182,18 +185,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -202,7 +205,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -214,13 +217,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -238,18 +241,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -258,7 +261,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -302,20 +305,18 @@ void setPersonalizationStrategyTest0() { ); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.setPersonalizationStrategy( - personalizationStrategyParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.setPersonalizationStrategy(personalizationStrategyParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/strategies/personalization"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/strategies/personalization"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"eventScoring\":[{\"score\":42,\"eventName\":\"Algolia\",\"eventType\":\"Event\"}],\"facetScoring\":[{\"score\":42,\"facetName\":\"Event\"}],\"personalizationImpact\":42}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java index 5c77d03087..b6c29cc1df 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.QuerySuggestionsClient; import com.algolia.model.querySuggestions.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class QuerySuggestionsClientTests { private QuerySuggestionsClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new QuerySuggestionsClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new QuerySuggestionsClient("appId", "apiKey", requester); } @Test @@ -86,18 +89,18 @@ void createConfigTest0() { querySuggestionsIndexWithIndexParam0.setExclude(exclude1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.createConfig(querySuggestionsIndexWithIndexParam0); - } - ); + assertDoesNotThrow(() -> { + client.createConfig(querySuggestionsIndexWithIndexParam0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/configs"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"indexName\":\"theIndexName\",\"sourceIndices\":[{\"indexName\":\"testIndex\",\"facets\":[{\"attributes\":\"test\"}],\"generate\":[[\"facetA\",\"facetB\"],[\"facetC\"]]}],\"languages\":[\"french\"],\"exclude\":[\"test\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -108,13 +111,13 @@ void createConfigTest0() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -127,19 +130,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -151,13 +154,13 @@ void delTest1() { void deleteConfigTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteConfig(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.deleteConfig(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs/theIndexName"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/configs/theIndexName"); + assertEquals(req.method, "DELETE"); } @Test @@ -165,13 +168,13 @@ void deleteConfigTest0() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -184,19 +187,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -206,13 +209,13 @@ void getTest1() { @Test @DisplayName("getAllConfigs") void getAllConfigsTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getAllConfigs(); - } - ); + assertDoesNotThrow(() -> { + client.getAllConfigs(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/configs"); + assertEquals(req.method, "GET"); } @Test @@ -220,13 +223,13 @@ void getAllConfigsTest0() { void getConfigTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getConfig(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.getConfig(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs/theIndexName"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/configs/theIndexName"); + assertEquals(req.method, "GET"); } @Test @@ -234,13 +237,13 @@ void getConfigTest0() { void getConfigStatusTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getConfigStatus(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.getConfigStatus(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs/theIndexName/status"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/configs/theIndexName/status"); + assertEquals(req.method, "GET"); } @Test @@ -248,13 +251,13 @@ void getConfigStatusTest0() { void getLogFileTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getLogFile(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.getLogFile(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/logs/theIndexName"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/logs/theIndexName"); + assertEquals(req.method, "GET"); } @Test @@ -262,13 +265,13 @@ void getLogFileTest0() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -286,18 +289,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -306,7 +309,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -318,13 +321,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -342,18 +345,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -362,7 +365,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -427,18 +430,18 @@ void updateConfigTest0() { querySuggestionsIndexParam0.setExclude(exclude1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.updateConfig(indexName0, querySuggestionsIndexParam0); - } - ); + assertDoesNotThrow(() -> { + client.updateConfig(indexName0, querySuggestionsIndexParam0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/configs/theIndexName"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/configs/theIndexName"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"sourceIndices\":[{\"indexName\":\"testIndex\",\"facets\":[{\"attributes\":\"test\"}],\"generate\":[[\"facetA\",\"facetB\"],[\"facetC\"]]}],\"languages\":[\"french\"],\"exclude\":[\"test\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java index ee75feed4a..1375f883a3 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.RecommendClient; import com.algolia.model.recommend.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class RecommendClientTests { private RecommendClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new RecommendClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new RecommendClient("appId", "apiKey", requester); } @Test @@ -32,13 +35,13 @@ void init() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -51,19 +54,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -75,13 +78,13 @@ void delTest1() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -94,19 +97,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -142,18 +145,18 @@ void getRecommendationsTest0() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName\",\"objectID\":\"objectID\",\"model\":\"related-products\",\"threshold\":42}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -216,18 +219,18 @@ void getRecommendationsTest1() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName\",\"objectID\":\"objectID\",\"model\":\"related-products\",\"threshold\":42,\"maxRecommendations\":10,\"queryParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"query\"]},\"fallbackParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"fallback\"]}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -254,18 +257,18 @@ void getRecommendationsTest2() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName\",\"model\":\"trending-items\",\"threshold\":42}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -326,18 +329,18 @@ void getRecommendationsTest3() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName\",\"model\":\"trending-items\",\"threshold\":42,\"maxRecommendations\":10,\"facetName\":\"myFacetName\",\"facetValue\":\"myFacetValue\",\"queryParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"query\"]},\"fallbackParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"fallback\"]}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -386,18 +389,18 @@ void getRecommendationsTest4() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName1\",\"objectID\":\"objectID1\",\"model\":\"related-products\",\"threshold\":21},{\"indexName\":\"indexName2\",\"objectID\":\"objectID2\",\"model\":\"related-products\",\"threshold\":21}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -506,18 +509,18 @@ void getRecommendationsTest5() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName1\",\"objectID\":\"objectID1\",\"model\":\"related-products\",\"threshold\":21,\"maxRecommendations\":10,\"queryParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"query1\"]},\"fallbackParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"fallback1\"]}},{\"indexName\":\"indexName2\",\"objectID\":\"objectID2\",\"model\":\"related-products\",\"threshold\":21,\"maxRecommendations\":10,\"queryParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"query2\"]},\"fallbackParameters\":{\"query\":\"myQuery\",\"facetFilters\":[\"fallback2\"]}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -550,18 +553,18 @@ void getRecommendationsTest6() { getRecommendationsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRecommendations(getRecommendationsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getRecommendations(getRecommendationsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/recommendations"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/recommendations"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"indexName1\",\"objectID\":\"objectID1\",\"model\":\"bought-together\",\"threshold\":42}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -572,13 +575,13 @@ void getRecommendationsTest6() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -596,18 +599,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -616,7 +619,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -628,13 +631,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -652,18 +655,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -672,7 +675,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java index 3f651619ac..b731af3cc7 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java @@ -3,11 +3,12 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; import com.algolia.Pair; import com.algolia.api.SearchClient; import com.algolia.model.search.*; import com.algolia.utils.JSON; -import com.algolia.utils.echo.*; import com.google.gson.reflect.TypeToken; import java.util.*; import org.junit.jupiter.api.BeforeAll; @@ -21,10 +22,12 @@ class SearchClientTests { private SearchClient client; + private EchoRequester requester; @BeforeAll void init() { - client = new SearchClient("appId", "apiKey", new EchoRequester()); + requester = new EchoRequester(); + client = new SearchClient("appId", "apiKey", requester); } @Test @@ -50,19 +53,19 @@ void addApiKeyTest0() { apiKey0.setMaxHitsPerQuery(maxHitsPerQuery1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.addApiKey(apiKey0); - } - ); + assertDoesNotThrow(() -> { + client.addApiKey(apiKey0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/keys"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"acl\":[\"search\",\"addObject\"],\"description\":\"my new api" + " key\",\"validity\":300,\"maxQueriesPerIPPerHour\":100,\"maxHitsPerQuery\":20}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -79,18 +82,18 @@ void addOrUpdateObjectTest0() { body0.put("key", key1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.addOrUpdateObject(indexName0, objectID0, body0); - } - ); + assertDoesNotThrow(() -> { + client.addOrUpdateObject(indexName0, objectID0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/uniqueID"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/indexes/indexName/uniqueID"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"key\":\"value\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -107,18 +110,18 @@ void appendSourceTest0() { source0.setDescription(description1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.appendSource(source0); - } - ); + assertDoesNotThrow(() -> { + client.appendSource(source0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/security/sources/append"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/security/sources/append"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"source\":\"theSource\",\"description\":\"theDescription\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -134,18 +137,18 @@ void assignUserIdTest0() { assignUserIdParams0.setCluster(cluster1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.assignUserId(xAlgoliaUserID0, assignUserIdParams0); - } - ); + assertDoesNotThrow(() -> { + client.assignUserId(xAlgoliaUserID0, assignUserIdParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/clusters/mapping"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"cluster\":\"theCluster\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -154,7 +157,7 @@ void assignUserIdTest0() { "{\"X-Algolia-User-ID\":\"userID\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -185,18 +188,18 @@ void batchTest0() { batchWriteParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.batch(indexName0, batchWriteParams0); - } - ); + assertDoesNotThrow(() -> { + client.batch(indexName0, batchWriteParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"action\":\"delete\",\"body\":{\"key\":\"value\"}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -220,21 +223,18 @@ void batchAssignUserIdsTest0() { batchAssignUserIdsParams0.setUsers(users1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.batchAssignUserIds( - xAlgoliaUserID0, - batchAssignUserIdsParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.batchAssignUserIds(xAlgoliaUserID0, batchAssignUserIdsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/clusters/mapping/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"cluster\":\"theCluster\",\"users\":[\"user1\",\"user2\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -243,7 +243,7 @@ void batchAssignUserIdsTest0() { "{\"X-Algolia-User-ID\":\"userID\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -290,21 +290,21 @@ void batchDictionaryEntriesTest0() { batchDictionaryEntriesParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.batchDictionaryEntries( - dictionaryName0, - batchDictionaryEntriesParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.batchDictionaryEntries( + dictionaryName0, + batchDictionaryEntriesParams0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/compounds/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/dictionaries/compounds/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"action\":\"addEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\"}},{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"2\",\"language\":\"fr\"}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -398,21 +398,21 @@ void batchDictionaryEntriesTest1() { batchDictionaryEntriesParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.batchDictionaryEntries( - dictionaryName0, - batchDictionaryEntriesParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.batchDictionaryEntries( + dictionaryName0, + batchDictionaryEntriesParams0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/compounds/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/dictionaries/compounds/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"clearExistingDictionaryEntries\":false,\"requests\":[{\"action\":\"addEntry\",\"body\":{\"objectID\":\"1\",\"language\":\"en\",\"word\":\"fancy\",\"words\":[\"believe\",\"algolia\"],\"decomposition\":[\"trust\",\"algolia\"],\"state\":\"enabled\"}},{\"action\":\"deleteEntry\",\"body\":{\"objectID\":\"2\",\"language\":\"fr\",\"word\":\"humility\",\"words\":[\"candor\",\"algolia\"],\"decomposition\":[\"grit\",\"algolia\"],\"state\":\"enabled\"}}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -484,23 +484,23 @@ void batchRulesTest0() { boolean forwardToReplicas0 = true; boolean clearExistingRules0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.batchRules( - indexName0, - rule0, - forwardToReplicas0, - clearExistingRules0 - ); - } - ); + assertDoesNotThrow(() -> { + client.batchRules( + indexName0, + rule0, + forwardToReplicas0, + clearExistingRules0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/rules/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "[{\"objectID\":\"a-rule-id\",\"conditions\":[{\"pattern\":\"smartphone\",\"anchoring\":\"contains\"}],\"consequence\":{\"params\":{\"filters\":\"category:smartphone\"}}},{\"objectID\":\"a-second-rule-id\",\"conditions\":[{\"pattern\":\"apple\",\"anchoring\":\"contains\"}],\"consequence\":{\"params\":{\"filters\":\"brand:apple\"}}}]", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -509,7 +509,7 @@ void batchRulesTest0() { "{\"forwardToReplicas\":\"true\",\"clearExistingRules\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -521,13 +521,13 @@ void batchRulesTest0() { void browseTest0() { String indexName0 = "indexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.browse(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.browse(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/browse"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/browse"); + assertEquals(req.method, "POST"); } @Test @@ -542,18 +542,18 @@ void browseTest1() { browseRequest0.setCursor(cursor1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.browse(indexName0, browseRequest0); - } - ); + assertDoesNotThrow(() -> { + client.browse(indexName0, browseRequest0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/browse"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/browse"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"params\":\"query=foo&facetFilters=['bar']\",\"cursor\":\"cts\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -564,13 +564,13 @@ void browseTest1() { void clearAllSynonymsTest0() { String indexName0 = "indexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.clearAllSynonyms(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.clearAllSynonyms(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/clear"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/clear"); + assertEquals(req.method, "POST"); } @Test @@ -578,13 +578,13 @@ void clearAllSynonymsTest0() { void clearObjectsTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.clearObjects(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.clearObjects(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/clear"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName/clear"); + assertEquals(req.method, "POST"); } @Test @@ -592,13 +592,13 @@ void clearObjectsTest0() { void clearRulesTest0() { String indexName0 = "indexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.clearRules(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.clearRules(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/clear"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/rules/clear"); + assertEquals(req.method, "POST"); } @Test @@ -606,13 +606,13 @@ void clearRulesTest0() { void delTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); } @Test @@ -625,19 +625,19 @@ void delTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.del(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -649,13 +649,13 @@ void delTest1() { void deleteApiKeyTest0() { String key0 = "myTestApiKey"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteApiKey(key0); - } - ); + assertDoesNotThrow(() -> { + client.deleteApiKey(key0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys/myTestApiKey"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/keys/myTestApiKey"); + assertEquals(req.method, "DELETE"); } @Test @@ -668,21 +668,21 @@ void deleteByTest0() { searchParams0.setQuery(query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteBy( - indexName0, - SearchParams.ofSearchParamsObject(searchParams0) - ); - } - ); + assertDoesNotThrow(() -> { + client.deleteBy( + indexName0, + SearchParams.ofSearchParamsObject(searchParams0) + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/deleteByQuery"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName/deleteByQuery"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"testQuery\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -693,13 +693,13 @@ void deleteByTest0() { void deleteIndexTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteIndex(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.deleteIndex(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/indexes/theIndexName"); + assertEquals(req.method, "DELETE"); } @Test @@ -708,13 +708,13 @@ void deleteObjectTest0() { String indexName0 = "theIndexName"; String objectID0 = "uniqueID"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteObject(indexName0, objectID0); - } - ); + assertDoesNotThrow(() -> { + client.deleteObject(indexName0, objectID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/uniqueID"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/indexes/theIndexName/uniqueID"); + assertEquals(req.method, "DELETE"); } @Test @@ -723,13 +723,13 @@ void deleteRuleTest0() { String indexName0 = "indexName"; String objectID0 = "id1"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteRule(indexName0, objectID0); - } - ); + assertDoesNotThrow(() -> { + client.deleteRule(indexName0, objectID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/id1"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/indexes/indexName/rules/id1"); + assertEquals(req.method, "DELETE"); } @Test @@ -737,13 +737,13 @@ void deleteRuleTest0() { void deleteSourceTest0() { String source0 = "theSource"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteSource(source0); - } - ); + assertDoesNotThrow(() -> { + client.deleteSource(source0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/security/sources/theSource"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/security/sources/theSource"); + assertEquals(req.method, "DELETE"); } @Test @@ -752,13 +752,13 @@ void deleteSynonymTest0() { String indexName0 = "indexName"; String objectID0 = "id1"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.deleteSynonym(indexName0, objectID0); - } - ); + assertDoesNotThrow(() -> { + client.deleteSynonym(indexName0, objectID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/id1"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/id1"); + assertEquals(req.method, "DELETE"); } @Test @@ -766,13 +766,13 @@ void deleteSynonymTest0() { void getTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); } @Test @@ -785,19 +785,19 @@ void getTest1() { parameters0.put("query", query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.get(path0, parameters0); - } - ); + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -809,37 +809,37 @@ void getTest1() { void getApiKeyTest0() { String key0 = "myTestApiKey"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getApiKey(key0); - } - ); + assertDoesNotThrow(() -> { + client.getApiKey(key0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys/myTestApiKey"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/keys/myTestApiKey"); + assertEquals(req.method, "GET"); } @Test @DisplayName("get getDictionaryLanguages") void getDictionaryLanguagesTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getDictionaryLanguages(); - } - ); + assertDoesNotThrow(() -> { + client.getDictionaryLanguages(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/*/languages"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/dictionaries/*/languages"); + assertEquals(req.method, "GET"); } @Test @DisplayName("get getDictionarySettings results") void getDictionarySettingsTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getDictionarySettings(); - } - ); + assertDoesNotThrow(() -> { + client.getDictionarySettings(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/*/settings"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/dictionaries/*/settings"); + assertEquals(req.method, "GET"); } @Test @@ -850,19 +850,19 @@ void getLogsTest0() { String indexName0 = "theIndexName"; LogType type0 = LogType.fromValue("all"); - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getLogs(offset0, length0, indexName0, type0); - } - ); + assertDoesNotThrow(() -> { + client.getLogs(offset0, length0, indexName0, type0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/logs"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/logs"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"offset\":\"5\",\"length\":\"10\",\"indexName\":\"theIndexName\",\"type\":\"all\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -882,19 +882,19 @@ void getObjectTest0() { attributesToRetrieve0.add(attributesToRetrieve_11); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getObject(indexName0, objectID0, attributesToRetrieve0); - } - ); + assertDoesNotThrow(() -> { + client.getObject(indexName0, objectID0, attributesToRetrieve0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/uniqueID"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes/theIndexName/uniqueID"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"attributesToRetrieve\":\"attr1,attr2\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -928,18 +928,18 @@ void getObjectsTest0() { getObjectsParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getObjects(getObjectsParams0); - } - ); + assertDoesNotThrow(() -> { + client.getObjects(getObjectsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/objects"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/objects"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"attributesToRetrieve\":[\"attr1\",\"attr2\"],\"objectID\":\"uniqueID\",\"indexName\":\"theIndexName\"}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -951,13 +951,13 @@ void getRuleTest0() { String indexName0 = "indexName"; String objectID0 = "id1"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getRule(indexName0, objectID0); - } - ); + assertDoesNotThrow(() -> { + client.getRule(indexName0, objectID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/id1"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes/indexName/rules/id1"); + assertEquals(req.method, "GET"); } @Test @@ -965,25 +965,25 @@ void getRuleTest0() { void getSettingsTest0() { String indexName0 = "theIndexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSettings(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.getSettings(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/settings"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes/theIndexName/settings"); + assertEquals(req.method, "GET"); } @Test @DisplayName("getSources") void getSourcesTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSources(); - } - ); + assertDoesNotThrow(() -> { + client.getSources(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/security/sources"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/security/sources"); + assertEquals(req.method, "GET"); } @Test @@ -992,13 +992,13 @@ void getSynonymTest0() { String indexName0 = "indexName"; String objectID0 = "id1"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getSynonym(indexName0, objectID0); - } - ); + assertDoesNotThrow(() -> { + client.getSynonym(indexName0, objectID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/id1"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/id1"); + assertEquals(req.method, "GET"); } @Test @@ -1007,25 +1007,25 @@ void getTaskTest0() { String indexName0 = "theIndexName"; int taskID0 = 123; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTask(indexName0, taskID0); - } - ); + assertDoesNotThrow(() -> { + client.getTask(indexName0, taskID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/task/123"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes/theIndexName/task/123"); + assertEquals(req.method, "GET"); } @Test @DisplayName("getTopUserIds") void getTopUserIdsTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getTopUserIds(); - } - ); + assertDoesNotThrow(() -> { + client.getTopUserIds(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/top"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/clusters/mapping/top"); + assertEquals(req.method, "GET"); } @Test @@ -1033,13 +1033,13 @@ void getTopUserIdsTest0() { void getUserIdTest0() { String userID0 = "uniqueID"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.getUserId(userID0); - } - ); + assertDoesNotThrow(() -> { + client.getUserId(userID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/uniqueID"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/clusters/mapping/uniqueID"); + assertEquals(req.method, "GET"); } @Test @@ -1047,19 +1047,19 @@ void getUserIdTest0() { void hasPendingMappingsTest0() { boolean getClusters0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.hasPendingMappings(getClusters0); - } - ); + assertDoesNotThrow(() -> { + client.hasPendingMappings(getClusters0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/pending"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/clusters/mapping/pending"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"getClusters\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1069,25 +1069,25 @@ void hasPendingMappingsTest0() { @Test @DisplayName("listApiKeys") void listApiKeysTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.listApiKeys(); - } - ); + assertDoesNotThrow(() -> { + client.listApiKeys(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/keys"); + assertEquals(req.method, "GET"); } @Test @DisplayName("listClusters") void listClustersTest0() { - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.listClusters(); - } - ); + assertDoesNotThrow(() -> { + client.listClusters(); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/clusters"); + assertEquals(req.method, "GET"); } @Test @@ -1095,19 +1095,19 @@ void listClustersTest0() { void listIndicesTest0() { int page0 = 8; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.listIndices(page0); - } - ); + assertDoesNotThrow(() -> { + client.listIndices(page0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/indexes"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"page\":\"8\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1120,19 +1120,19 @@ void listUserIdsTest0() { int page0 = 8; int hitsPerPage0 = 100; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.listUserIds(page0, hitsPerPage0); - } - ); + assertDoesNotThrow(() -> { + client.listUserIds(page0, hitsPerPage0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping"); - assertEquals(req.getMethod(), "GET"); + assertEquals(req.path, "/1/clusters/mapping"); + assertEquals(req.method, "GET"); Map expectedQuery = JSON.deserialize( "{\"page\":\"8\",\"hitsPerPage\":\"100\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1164,18 +1164,18 @@ void multipleBatchTest0() { batchParams0.setRequests(requests1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.multipleBatch(batchParams0); - } - ); + assertDoesNotThrow(() -> { + client.multipleBatch(batchParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"action\":\"addObject\",\"body\":{\"key\":\"value\"},\"indexName\":\"theIndexName\"}]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1202,18 +1202,18 @@ void multipleQueriesTest0() { multipleQueriesParams0.setStrategy(strategy1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.multipleQueries(multipleQueriesParams0); - } - ); + assertDoesNotThrow(() -> { + client.multipleQueries(multipleQueriesParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/queries"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/queries"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"theIndexName\"}],\"strategy\":\"stopIfEnoughMatches\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1260,18 +1260,18 @@ void multipleQueriesTest1() { multipleQueriesParams0.setStrategy(strategy1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.multipleQueries(multipleQueriesParams0); - } - ); + assertDoesNotThrow(() -> { + client.multipleQueries(multipleQueriesParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/*/queries"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/*/queries"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"requests\":[{\"indexName\":\"theIndexName\",\"query\":\"test\",\"type\":\"facet\",\"facet\":\"theFacet\",\"params\":\"testParam\"},{\"indexName\":\"theIndexName\",\"query\":\"test\",\"type\":\"default\",\"params\":\"testParam\"}],\"strategy\":\"stopIfEnoughMatches\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1297,18 +1297,18 @@ void operationIndexTest0() { operationIndexParams0.setScope(scope1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.operationIndex(indexName0, operationIndexParams0); - } - ); + assertDoesNotThrow(() -> { + client.operationIndex(indexName0, operationIndexParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/operation"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName/operation"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"operation\":\"copy\",\"destination\":\"dest\",\"scope\":[\"rules\",\"settings\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1346,23 +1346,23 @@ void partialUpdateObjectTest0() { } boolean createIfNotExists0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.partialUpdateObject( - indexName0, - objectID0, - attributeOrBuiltInOperation0, - createIfNotExists0 - ); - } - ); + assertDoesNotThrow(() -> { + client.partialUpdateObject( + indexName0, + objectID0, + attributeOrBuiltInOperation0, + createIfNotExists0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/uniqueID/partial"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName/uniqueID/partial"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "[{\"id1\":\"test\",\"id2\":{\"_operation\":\"AddUnique\",\"value\":\"test2\"}}]", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1371,7 +1371,7 @@ void partialUpdateObjectTest0() { "{\"createIfNotExists\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1383,13 +1383,13 @@ void partialUpdateObjectTest0() { void postTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); } @Test @@ -1407,18 +1407,18 @@ void postTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.post(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1427,7 +1427,7 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1439,13 +1439,13 @@ void postTest1() { void putTest0() { String path0 = "/test/minimal"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/minimal"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); } @Test @@ -1463,18 +1463,18 @@ void putTest1() { body0.put("body", body1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.put(path0, parameters0, body0); - } - ); + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/test/all"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"body\":\"parameters\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1483,7 +1483,7 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1495,13 +1495,13 @@ void putTest1() { void removeUserIdTest0() { String userID0 = "uniqueID"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.removeUserId(userID0); - } - ); + assertDoesNotThrow(() -> { + client.removeUserId(userID0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/uniqueID"); - assertEquals(req.getMethod(), "DELETE"); + assertEquals(req.path, "/1/clusters/mapping/uniqueID"); + assertEquals(req.method, "DELETE"); } @Test @@ -1519,18 +1519,18 @@ void replaceSourcesTest0() { source0.add(source_01); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.replaceSources(source0); - } - ); + assertDoesNotThrow(() -> { + client.replaceSources(source0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/security/sources"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/security/sources"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "[{\"source\":\"theSource\",\"description\":\"theDescription\"}]", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1541,13 +1541,13 @@ void replaceSourcesTest0() { void restoreApiKeyTest0() { String key0 = "myApiKey"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.restoreApiKey(key0); - } - ); + assertDoesNotThrow(() -> { + client.restoreApiKey(key0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys/myApiKey/restore"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/keys/myApiKey/restore"); + assertEquals(req.method, "POST"); } @Test @@ -1562,18 +1562,18 @@ void saveObjectTest0() { body0.put("test", test1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.saveObject(indexName0, body0); - } - ); + assertDoesNotThrow(() -> { + client.saveObject(indexName0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/theIndexName"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"objectID\":\"id\",\"test\":\"val\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1613,23 +1613,18 @@ void saveRuleTest0() { } boolean forwardToReplicas0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.saveRule( - indexName0, - objectID0, - rule0, - forwardToReplicas0 - ); - } - ); + assertDoesNotThrow(() -> { + client.saveRule(indexName0, objectID0, rule0, forwardToReplicas0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/id1"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/indexes/indexName/rules/id1"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"objectID\":\"id1\",\"conditions\":[{\"pattern\":\"apple\",\"anchoring\":\"contains\"}],\"consequence\":{\"params\":{\"filters\":\"brand:apple\"}}}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1638,7 +1633,7 @@ void saveRuleTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1669,23 +1664,23 @@ void saveSynonymTest0() { } boolean forwardToReplicas0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.saveSynonym( - indexName0, - objectID0, - synonymHit0, - forwardToReplicas0 - ); - } - ); + assertDoesNotThrow(() -> { + client.saveSynonym( + indexName0, + objectID0, + synonymHit0, + forwardToReplicas0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/id1"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/id1"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"objectID\":\"id1\",\"type\":\"synonym\",\"synonyms\":[\"car\",\"vehicule\",\"auto\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1694,7 +1689,7 @@ void saveSynonymTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1749,23 +1744,23 @@ void saveSynonymsTest0() { boolean forwardToReplicas0 = true; boolean replaceExistingSynonyms0 = false; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.saveSynonyms( - indexName0, - synonymHit0, - forwardToReplicas0, - replaceExistingSynonyms0 - ); - } - ); + assertDoesNotThrow(() -> { + client.saveSynonyms( + indexName0, + synonymHit0, + forwardToReplicas0, + replaceExistingSynonyms0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/batch"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/batch"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "[{\"objectID\":\"id1\",\"type\":\"synonym\",\"synonyms\":[\"car\",\"vehicule\",\"auto\"]},{\"objectID\":\"id2\",\"type\":\"onewaysynonym\",\"input\":\"iphone\",\"synonyms\":[\"ephone\",\"aphone\",\"yphone\"]}]", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1774,7 +1769,7 @@ void saveSynonymsTest0() { "{\"forwardToReplicas\":\"true\",\"replaceExistingSynonyms\":\"false\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -1791,21 +1786,21 @@ void searchTest0() { searchParams0.setQuery(query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.search( - indexName0, - SearchParams.ofSearchParamsObject(searchParams0) - ); - } - ); + assertDoesNotThrow(() -> { + client.search( + indexName0, + SearchParams.ofSearchParamsObject(searchParams0) + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/query"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/query"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"myQuery\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1827,21 +1822,21 @@ void searchTest1() { searchParams0.setFacetFilters(FacetFilters.ofListString(facetFilters1)); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.search( - indexName0, - SearchParams.ofSearchParamsObject(searchParams0) - ); - } - ); + assertDoesNotThrow(() -> { + client.search( + indexName0, + SearchParams.ofSearchParamsObject(searchParams0) + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/query"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/query"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"myQuery\",\"facetFilters\":[\"tags:algolia\"]}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1857,21 +1852,21 @@ void searchDictionaryEntriesTest0() { searchDictionaryEntriesParams0.setQuery(query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchDictionaryEntries( - dictionaryName0, - searchDictionaryEntriesParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.searchDictionaryEntries( + dictionaryName0, + searchDictionaryEntriesParams0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/compounds/search"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/dictionaries/compounds/search"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"foo\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1893,21 +1888,21 @@ void searchDictionaryEntriesTest1() { searchDictionaryEntriesParams0.setLanguage(language1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchDictionaryEntries( - dictionaryName0, - searchDictionaryEntriesParams0 - ); - } - ); + assertDoesNotThrow(() -> { + client.searchDictionaryEntries( + dictionaryName0, + searchDictionaryEntriesParams0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/compounds/search"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/dictionaries/compounds/search"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"foo\",\"page\":4,\"hitsPerPage\":2,\"language\":\"fr\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1919,13 +1914,13 @@ void searchForFacetValuesTest0() { String indexName0 = "indexName"; String facetName0 = "facetName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchForFacetValues(indexName0, facetName0); - } - ); + assertDoesNotThrow(() -> { + client.searchForFacetValues(indexName0, facetName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/facets/facetName/query"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/facets/facetName/query"); + assertEquals(req.method, "POST"); } @Test @@ -1943,22 +1938,22 @@ void searchForFacetValuesTest1() { searchForFacetValuesRequest0.setMaxFacetHits(maxFacetHits1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchForFacetValues( - indexName0, - facetName0, - searchForFacetValuesRequest0 - ); - } - ); + assertDoesNotThrow(() -> { + client.searchForFacetValues( + indexName0, + facetName0, + searchForFacetValuesRequest0 + ); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/facets/facetName/query"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/facets/facetName/query"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"params\":\"query=foo&facetFilters=['bar']\",\"facetQuery\":\"foo\",\"maxFacetHits\":42}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1974,18 +1969,18 @@ void searchRulesTest0() { searchRulesParams0.setQuery(query1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchRules(indexName0, searchRulesParams0); - } - ); + assertDoesNotThrow(() -> { + client.searchRules(indexName0, searchRulesParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/rules/search"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/rules/search"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"something\"}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -1996,13 +1991,13 @@ void searchRulesTest0() { void searchSynonymsTest0() { String indexName0 = "indexName"; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchSynonyms(indexName0); - } - ); + assertDoesNotThrow(() -> { + client.searchSynonyms(indexName0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/indexName/synonyms/search"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/indexes/indexName/synonyms/search"); + assertEquals(req.method, "POST"); } @Test @@ -2020,18 +2015,18 @@ void searchUserIdsTest0() { searchUserIdsParams0.setHitsPerPage(hitsPerPage1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.searchUserIds(searchUserIdsParams0); - } - ); + assertDoesNotThrow(() -> { + client.searchUserIds(searchUserIdsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/clusters/mapping/search"); - assertEquals(req.getMethod(), "POST"); + assertEquals(req.path, "/1/clusters/mapping/search"); + assertEquals(req.method, "POST"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"query\":\"test\",\"clusterName\":\"theClusterName\",\"page\":5,\"hitsPerPage\":10}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -2060,18 +2055,18 @@ void setDictionarySettingsTest0() { ); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.setDictionarySettings(dictionarySettingsParams0); - } - ); + assertDoesNotThrow(() -> { + client.setDictionarySettings(dictionarySettingsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/*/settings"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/dictionaries/*/settings"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true}}}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -2112,18 +2107,18 @@ void setDictionarySettingsTest1() { ); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.setDictionarySettings(dictionarySettingsParams0); - } - ); + assertDoesNotThrow(() -> { + client.setDictionarySettings(dictionarySettingsParams0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/dictionaries/*/settings"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/dictionaries/*/settings"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"disableStandardEntries\":{\"plurals\":{\"fr\":false,\"en\":false,\"ru\":true},\"stopwords\":{\"fr\":false},\"compounds\":{\"ru\":true}}}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -2140,22 +2135,18 @@ void setSettingsTest0() { } boolean forwardToReplicas0 = true; - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.setSettings( - indexName0, - indexSettings0, - forwardToReplicas0 - ); - } - ); + assertDoesNotThrow(() -> { + client.setSettings(indexName0, indexSettings0, forwardToReplicas0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/indexes/theIndexName/settings"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/indexes/theIndexName/settings"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"paginationLimitedTo\":10}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); @@ -2164,7 +2155,7 @@ void setSettingsTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.getQueryParams(); + List actualQuery = req.queryParameters; assertEquals(expectedQuery.size(), actualQuery.size()); for (Pair p : actualQuery) { assertEquals(expectedQuery.get(p.getName()), p.getValue()); @@ -2193,18 +2184,18 @@ void updateApiKeyTest0() { apiKey0.setMaxHitsPerQuery(maxHitsPerQuery1); } - EchoResponseInterface req = (EchoResponseInterface) assertDoesNotThrow(() -> { - return client.updateApiKey(key0, apiKey0); - } - ); + assertDoesNotThrow(() -> { + client.updateApiKey(key0, apiKey0); + }); + EchoResponse req = requester.getLastEchoResponse(); - assertEquals(req.getPath(), "/1/keys/myApiKey"); - assertEquals(req.getMethod(), "PUT"); + assertEquals(req.path, "/1/keys/myApiKey"); + assertEquals(req.method, "PUT"); assertDoesNotThrow(() -> { JSONAssert.assertEquals( "{\"acl\":[\"search\",\"addObject\"],\"validity\":300,\"maxQueriesPerIPPerHour\":100,\"maxHitsPerQuery\":20}", - req.getBody(), + req.body, JSONCompareMode.STRICT_ORDER ); }); From 5c12021eabd6a9f6ab4706572f4755aed712a4a4 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 14:13:07 +0200 Subject: [PATCH 07/15] merge with main --- .../src/main/java/com/algolia/Pair.java | 48 --- .../java/com/algolia/utils/HttpRequester.java | 2 +- .../java/com/algolia/utils/Requester.java | 2 +- .../algolia/codegen/AlgoliaJavaGenerator.java | 3 +- .../codegen/AlgoliaJavascriptGenerator.java | 34 ++ .../codegen/cts/AlgoliaCtsGenerator.java | 1 + playground/javascript/node/predict.ts | 2 +- scripts/ci/githubActions/createMatrix.ts | 8 +- scripts/cts/client/generate.ts | 1 + specs/predict/common/enums.yml | 7 - specs/predict/common/schemas/Params.yml | 38 ++ specs/predict/paths/fetchUserProfile.yml | 17 +- templates/java/EchoResponse.mustache | 43 --- templates/java/Pair.mustache | 47 --- .../libraries/okhttp-gson/ApiClient.mustache | 125 +----- .../java/libraries/okhttp-gson/api.mustache | 10 +- templates/javascript/api-single.mustache | 148 ++----- tests/CTS/client/predict/api.json | 56 +++ tests/CTS/client/predict/parameters.json | 36 ++ .../templates/javascript/suite.mustache | 2 +- .../requests/predict/fetchUserProfile.json | 80 ++++ .../requests/templates/java/requests.mustache | 8 +- .../templates/javascript/requests.mustache | 2 +- .../src/test/java/com/algolia/CallEcho.java | 12 +- .../test/java/com/algolia/EchoRequester.java | 7 +- .../test/java/com/algolia/EchoResponse.java | 4 +- .../methods/requests/abtesting.test.java | 36 +- .../methods/requests/analytics.test.java | 274 +++++++------ .../methods/requests/insights.test.java | 29 +- .../requests/personalization.test.java | 29 +- .../methods/requests/predict.test.java | 364 ++++++++++++++++++ .../requests/query-suggestions.test.java | 29 +- .../methods/requests/recommend.test.java | 29 +- .../algolia/methods/requests/search.test.java | 120 +++--- tests/output/javascript/package.json | 1 + .../javascript/src/client/predict.test.ts | 99 +++++ .../src/methods/requests/predict.test.ts | 160 ++++++++ yarn.lock | 1 + 38 files changed, 1244 insertions(+), 670 deletions(-) delete mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/Pair.java delete mode 100644 specs/predict/common/enums.yml create mode 100644 specs/predict/common/schemas/Params.yml delete mode 100644 templates/java/EchoResponse.mustache delete mode 100644 templates/java/Pair.mustache create mode 100644 tests/CTS/client/predict/api.json create mode 100644 tests/CTS/client/predict/parameters.json create mode 100644 tests/CTS/methods/requests/predict/fetchUserProfile.json create mode 100644 tests/output/java/src/test/java/com/algolia/methods/requests/predict.test.java create mode 100644 tests/output/javascript/src/client/predict.test.ts create mode 100644 tests/output/javascript/src/methods/requests/predict.test.ts diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/Pair.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/Pair.java deleted file mode 100644 index 1e5bf539ea..0000000000 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/Pair.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.algolia; - -public class Pair { - - private String name = ""; - private String value = ""; - - public Pair(String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java index 208fb19d90..5b60a89d1d 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/HttpRequester.java @@ -4,12 +4,12 @@ import com.algolia.exceptions.*; import com.algolia.utils.retry.RetryStrategy; import com.algolia.utils.retry.StatefulHost; +import java.io.IOException; import java.lang.reflect.Type; import java.util.List; import java.util.concurrent.TimeUnit; import okhttp3.Call; import okhttp3.OkHttpClient; -import java.io.IOException; import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java index 1a832def15..65793ea63f 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/Requester.java @@ -1,10 +1,10 @@ package com.algolia.utils; +import com.algolia.exceptions.AlgoliaRuntimeException; import java.lang.reflect.Type; import okhttp3.Call; import okhttp3.Request; import okhttp3.Response; -import com.algolia.exceptions.AlgoliaRuntimeException; public interface Requester { public Call newCall(Request request); diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java index e6600f1e14..05c6ce43d2 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java @@ -122,7 +122,8 @@ public void processOpts() { file.getTemplateFile().equals("ApiResponse.mustache") || file.getTemplateFile().equals("JSON.mustache") || file.getTemplateFile().equals("ProgressRequestBody.mustache") || - file.getTemplateFile().equals("ProgressResponseBody.mustache") + file.getTemplateFile().equals("ProgressResponseBody.mustache") || + file.getTemplateFile().equals("Pair.mustache") ); } diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaJavascriptGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaJavascriptGenerator.java index c0773913d9..7e943af33c 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaJavascriptGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaJavascriptGenerator.java @@ -81,6 +81,40 @@ public Map postProcessOperationsWithModels( additionalProperties ); + List operations = + ((Map>) results.get("operations")).get( + "operation" + ); + + // We read operations and detect if we should wrap parameters under an object. + // We only wrap if there is a mix between body parameters and other parameters. + for (CodegenOperation ope : operations) { + // Nothing to wrap as there is no parameters + if (!ope.hasParams) { + continue; + } + + boolean hasBodyParams = !ope.bodyParams.isEmpty(); + boolean hasHeaderParams = !ope.headerParams.isEmpty(); + boolean hasQueryParams = !ope.queryParams.isEmpty(); + boolean hasPathParams = !ope.pathParams.isEmpty(); + + // If there is nothing but body params, we just check if it's a single param + if ( + hasBodyParams && !hasHeaderParams && !hasQueryParams && !hasPathParams + ) { + // At this point the single parameter is already an object, to avoid double wrapping + // we skip it + if (ope.bodyParams.size() == 1 && !ope.bodyParams.get(0).isArray) { + ope.vendorExtensions.put("x-is-single-body-param", true); + continue; + } + } + + // Any other cases here are wrapped + ope.vendorExtensions.put("x-create-wrapping-object", true); + } + return results; } diff --git a/generators/src/main/java/com/algolia/codegen/cts/AlgoliaCtsGenerator.java b/generators/src/main/java/com/algolia/codegen/cts/AlgoliaCtsGenerator.java index 945275f143..dd82f75760 100644 --- a/generators/src/main/java/com/algolia/codegen/cts/AlgoliaCtsGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/cts/AlgoliaCtsGenerator.java @@ -145,6 +145,7 @@ public Map postProcessSupportingFileData( bundle.put("clientPrefix", Utils.createClientName(client, language)); bundle.put("import", createImportName()); bundle.put("hasRegionalHost", hasRegionalHost); + bundle.put("defaultRegion", client.equals("predict") ? "ew" : "us"); bundle.put("lambda", lambda); List blocks = new ArrayList<>(); diff --git a/playground/javascript/node/predict.ts b/playground/javascript/node/predict.ts index b7d4410a54..1a9587142f 100644 --- a/playground/javascript/node/predict.ts +++ b/playground/javascript/node/predict.ts @@ -11,7 +11,7 @@ const apiKey = const userId = 'user1'; // Init client with appId and apiKey -const client = predictClient(appId, apiKey); +const client = predictClient(appId, apiKey, 'ew'); async function testPredict() { try { diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index c6c2a9eaac..292e75fafd 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -138,10 +138,10 @@ async function getSpecMatrix(baseBranch: string): Promise { branch: baseBranch, path, }); - const baseChanged = await isBaseChanged( - baseBranch, - MATRIX_DEPENDENCIES.common - ); + const baseChanged = await isBaseChanged(baseBranch, { + ...MATRIX_DEPENDENCIES.common, + ...MATRIX_DEPENDENCIES.clients.common, + }); // No changes found, we don't put this job in the matrix if (specChanges === 0 && !baseChanged) { diff --git a/scripts/cts/client/generate.ts b/scripts/cts/client/generate.ts index 01f7829b0a..0aed83f459 100644 --- a/scripts/cts/client/generate.ts +++ b/scripts/cts/client/generate.ts @@ -101,6 +101,7 @@ export async function generateClientTests( client: `${createClientName(client, language)}Client`, blocks: modifyForMustache(testsBlocks), hasRegionalHost: hasRegionalHost ? true : undefined, + defaultRegion: client === 'predict' ? 'ew' : 'us', }, partialTemplates ); diff --git a/specs/predict/common/enums.yml b/specs/predict/common/enums.yml deleted file mode 100644 index 64a846f0fc..0000000000 --- a/specs/predict/common/enums.yml +++ /dev/null @@ -1,7 +0,0 @@ -modelsToRetrieve: - type: string - enum: [funnel_stage, order_value, affinities] - -typesToRetrieve: - type: string - enum: [properties, segments] diff --git a/specs/predict/common/schemas/Params.yml b/specs/predict/common/schemas/Params.yml new file mode 100644 index 0000000000..064edfeebb --- /dev/null +++ b/specs/predict/common/schemas/Params.yml @@ -0,0 +1,38 @@ +params: + oneOf: + - $ref: '#/modelsToRetrieve' + - $ref: '#/typesToRetrieve' + - $ref: '#/allParams' + +allParams: + allOf: + - $ref: '#/modelsToRetrieve' + - $ref: '#/typesToRetrieve' + +modelsToRetrieve: + type: object + required: + - modelsToRetrieve + properties: + modelsToRetrieve: + type: array + items: + $ref: '#/modelsToRetrieveEnum' + +typesToRetrieve: + type: object + required: + - typesToRetrieve + properties: + typesToRetrieve: + type: array + items: + $ref: '#/typesToRetrieveEnum' + +modelsToRetrieveEnum: + type: string + enum: [funnel_stage, order_value, affinities] + +typesToRetrieveEnum: + type: string + enum: [properties, segments] diff --git a/specs/predict/paths/fetchUserProfile.yml b/specs/predict/paths/fetchUserProfile.yml index 4c2ddfcbf0..b19d43f5f2 100644 --- a/specs/predict/paths/fetchUserProfile.yml +++ b/specs/predict/paths/fetchUserProfile.yml @@ -11,22 +11,7 @@ post: content: application/json: schema: - title: params - type: object - description: Object with models and types to retrieve. - additionalProperties: false - properties: - modelsToRetrieve: - type: array - description: List with model types for which to retrieve predictions. - items: - $ref: '../common/enums.yml#/modelsToRetrieve' - typesToRetrieve: - type: array - description: List with types to be retrieved. - items: - $ref: '../common/enums.yml#/typesToRetrieve' - minItems: 1 + $ref: '../common/schemas/Params.yml#/params' responses: '200': description: OK diff --git a/templates/java/EchoResponse.mustache b/templates/java/EchoResponse.mustache deleted file mode 100644 index 2071beb9a6..0000000000 --- a/templates/java/EchoResponse.mustache +++ /dev/null @@ -1,43 +0,0 @@ -package com.algolia.utils.echo; - -import com.algolia.Pair; -import {{#apiInfo}}{{#apis}}{{{modelPackage}}}{{/apis}}{{/apiInfo}}.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class EchoResponse{{#apiInfo}}{{#apis}}{{{baseName}}}{{/apis}}{{/apiInfo}} { - {{#apiInfo}}{{#apis}} - {{#operations}}{{#operation}} - - public static class {{#lambda.titlecase}}{{{operationId}}}{{/lambda.titlecase}} extends {{{returnType}}} implements EchoResponseInterface { - public String path; - public String method; - public String body; - public List queryParameters; - - public String getPath() { - return path; - } - - public String getMethod() { - return method; - } - - public String getBody() { - return body; - } - - public List getQueryParams() { - return queryParameters; - } - - // to satisfy CompoundType in case it's a parent - public Object getInsideValue() { - return null; - } - } - {{/operation}}{{/operations}} - {{/apis}}{{/apiInfo}} -} diff --git a/templates/java/Pair.mustache b/templates/java/Pair.mustache deleted file mode 100644 index c79e1d2846..0000000000 --- a/templates/java/Pair.mustache +++ /dev/null @@ -1,47 +0,0 @@ -package {{invokerPackage}}; - -public class Pair { - private String name = ""; - private String value = ""; - - public Pair (String name, String value) { - setName(name); - setValue(value); - } - - private void setName(String name) { - if (!isValidString(name)) { - return; - } - - this.name = name; - } - - private void setValue(String value) { - if (!isValidString(value)) { - return; - } - - this.value = value; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private boolean isValidString(String arg) { - if (arg == null) { - return false; - } - - if (arg.trim().isEmpty()) { - return false; - } - - return true; - } -} diff --git a/templates/java/libraries/okhttp-gson/ApiClient.mustache b/templates/java/libraries/okhttp-gson/ApiClient.mustache index 4d54a6a26a..d45ce05889 100644 --- a/templates/java/libraries/okhttp-gson/ApiClient.mustache +++ b/templates/java/libraries/okhttp-gson/ApiClient.mustache @@ -189,111 +189,6 @@ public class ApiClient { } } - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - * Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - * Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder() ; - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: @@ -394,7 +289,7 @@ public class ApiClient { * @return The HTTP call * @throws AlgoliaRuntimeException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { + public Call buildCall(String path, String method, Map queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { Request request = buildRequest(path, method, queryParams, body, headerParams); return requester.newCall(request); @@ -411,20 +306,18 @@ public class ApiClient { * @return The HTTP request * @throws AlgoliaRuntimeException If fail to serialize the request body object */ - public Request buildRequest(String path, String method, List queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { + public Request buildRequest(String path, String method, Map queryParams, Object body, Map headerParams) throws AlgoliaRuntimeException { headerParams.put("X-Algolia-Application-Id", this.appId); headerParams.put("X-Algolia-API-Key", this.apiKey); + String contentType = "application/json"; + headerParams.put("Accept", contentType); + headerParams.put("Content-Type", contentType); + final String url = buildUrl(path, queryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); - String contentType = headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } - RequestBody reqBody; if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; @@ -450,7 +343,7 @@ public class ApiClient { * @param queryParams The query parameters * @return The full URL */ - public String buildUrl(String path, List queryParams) { + public String buildUrl(String path, Map queryParams) { final StringBuilder url = new StringBuilder(); //The real host will be assigned by the retry strategy @@ -459,7 +352,7 @@ public class ApiClient { if (queryParams != null && !queryParams.isEmpty()) { // support (constant) query string in `path`, e.g. "/posts?draft=1" String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { + for (Entry param : queryParams.entrySet()) { if (param.getValue() != null) { if (prefix != null) { url.append(prefix); @@ -468,7 +361,7 @@ public class ApiClient { url.append("&"); } String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + url.append(escapeString(param.getKey())).append("=").append(escapeString(value)); } } } diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index 1084d3e89c..6510ed1f78 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -1,7 +1,6 @@ package {{package}}; import {{invokerPackage}}.ApiClient; -import {{invokerPackage}}.Pair; import com.google.gson.reflect.TypeToken; @@ -155,17 +154,17 @@ public class {{classname}} extends ApiClient { {{#x-is-custom-request}}{{{paramName}}}.toString(){{/x-is-custom-request}}{{^x-is-custom-request}}this.escapeString({{{paramName}}}.toString()){{/x-is-custom-request}} ){{/pathParams}}{{/vendorExtensions}}; - {{javaUtilPrefix}}List queryParams = new {{javaUtilPrefix}}ArrayList(); + {{javaUtilPrefix}}Map queryParams = new {{javaUtilPrefix}}HashMap(); {{javaUtilPrefix}}Map headers = new {{javaUtilPrefix}}HashMap(); {{#vendorExtensions}}{{#queryParams}} if ({{paramName}} != null) { {{^x-is-custom-request}} - queryParams.addAll(this.parameterToPair("{{baseName}}", {{paramName}})); + queryParams.put("{{baseName}}", parameterToString({{paramName}})); {{/x-is-custom-request}} {{#x-is-custom-request}} for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll(this.parameterToPair(parameter.getKey(), parameter.getValue())); + queryParams.put(parameter.getKey().toString(), parameterToString(parameter.getValue())); } {{/x-is-custom-request}} } @@ -177,9 +176,6 @@ public class {{classname}} extends ApiClient { } {{/headerParams}} - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - Call call = this.buildCall(requestPath, "{{httpMethod}}", queryParams, bodyObj, headers); Type returnType = new TypeToken<{{{returnType}}}>() {}.getType(); return this.executeAsync(call, returnType); diff --git a/templates/javascript/api-single.mustache b/templates/javascript/api-single.mustache index 8460439969..dc627909d1 100644 --- a/templates/javascript/api-single.mustache +++ b/templates/javascript/api-single.mustache @@ -112,88 +112,36 @@ export function create{{capitalizedApiName}}(options: CreateClientOptions{{#hasR {{#summary}} * @summary {{&summary}} {{/summary}} - {{#allParams.0}} - {{^bodyParams.0}} - * @param {{nickname}} - The {{nickname}} object. - {{#allParams}} - * @param {{nickname}}.{{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/allParams}} - {{/bodyParams.0}} - {{#bodyParams.0}} - {{^queryParams.0}} - {{^pathParams.0}} - {{#bodyParams.0.isArray}} - {{^bodyParams.1}} - * @param {{nickname}} - The {{nickname}} object. - {{#allParams}} - * @param {{nickname}}.{{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/allParams}} - {{/bodyParams.1}} - {{/bodyParams.0.isArray}} - {{^bodyParams.0.isArray}} - * @param {{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/bodyParams.0.isArray}} - {{/pathParams.0}} - {{#pathParams.0}} - * @param {{nickname}} - The {{nickname}} object. - {{#allParams}} - * @param {{nickname}}.{{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/allParams}} - {{/pathParams.0}} - {{/queryParams.0}} - {{#queryParams.0}} - * @param {{nickname}} - The {{nickname}} object. - {{#allParams}} - * @param {{nickname}}.{{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} - {{/allParams}} - {{/queryParams.0}} - {{/bodyParams.0}} - {{/allParams.0}} + {{#vendorExtensions}} + {{#x-create-wrapping-object}} + * @param {{nickname}} - The {{nickname}} object. + {{#allParams}} + * @param {{nickname}}.{{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/allParams}} + {{/x-create-wrapping-object}} + {{#x-is-single-body-param}} + {{#bodyParams}} + * @param {{paramName}} - {{^description}}The {{paramName}} object.{{/description}}{{#description}}{{{description}}}{{/description}} + {{/bodyParams}} + {{/x-is-single-body-param}} + {{/vendorExtensions}} + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ {{nickname}}( - {{#allParams.0}} - {{^bodyParams.0}} + {{#vendorExtensions}} + {{#x-create-wrapping-object}} { {{#allParams}} {{paramName}}, {{/allParams}} }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props, - {{/bodyParams.0}} - {{#bodyParams.0}} - {{^queryParams.0}} - {{^pathParams.0}} - {{#bodyParams.0.isArray}} - {{^bodyParams.1}} - { - {{#allParams}} - {{paramName}}, - {{/allParams}} - }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props, - {{/bodyParams.1}} - {{/bodyParams.0.isArray}} - {{^bodyParams.0.isArray}} - {{#bodyParams}} - {{paramName}}: {{{dataType}}}, - {{/bodyParams}} - {{/bodyParams.0.isArray}} - {{/pathParams.0}} - {{#pathParams.0}} - { - {{#allParams}} - {{paramName}}, - {{/allParams}} - }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props, - {{/pathParams.0}} - {{/queryParams.0}} - {{#queryParams.0}} - { - {{#allParams}} - {{paramName}}, - {{/allParams}} - }: {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props, - {{/queryParams.0}} - {{/bodyParams.0}} - {{/allParams.0}} + {{/x-create-wrapping-object}} + {{#x-is-single-body-param}} + {{#bodyParams}} + {{paramName}}: {{{dataType}}}, + {{/bodyParams}} + {{/x-is-single-body-param}} + {{/vendorExtensions}} requestOptions?: RequestOptions ) : Promise<{{{returnType}}}> { {{#allParams}} @@ -251,51 +199,7 @@ export function create{{capitalizedApiName}}(options: CreateClientOptions{{#hasR export type {{capitalizedApiName}} = ReturnType; {{#operation}} -{{#allParams.0}} - {{^bodyParams.0}} -export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { - {{#allParams}} - {{#description}} - /** - * {{{description}}} - */ - {{/description}} - {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; - {{/allParams}} -} - {{/bodyParams.0}} - {{#bodyParams.0}} - {{^queryParams.0}} - {{^pathParams.0}} - {{#bodyParams.0.isArray}} - {{^bodyParams.1}} -export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { - {{#allParams}} - {{#description}} - /** - * {{{description}}} - */ - {{/description}} - {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; - {{/allParams}} -} - {{/bodyParams.1}} - {{/bodyParams.0.isArray}} - {{/pathParams.0}} - {{#pathParams.0}} -export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { - {{#allParams}} - {{#description}} - /** - * {{{description}}} - */ - {{/description}} - {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; - {{/allParams}} -} - {{/pathParams.0}} - {{/queryParams.0}} - {{#queryParams.0}} +{{#vendorExtensions.x-create-wrapping-object}} export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{#allParams}} {{#description}} @@ -306,9 +210,7 @@ export type {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Props = { {{paramName}}{{^required}}?{{/required}}: {{{dataType}}}; {{/allParams}} } - {{/queryParams.0}} - {{/bodyParams.0}} -{{/allParams.0}} +{{/vendorExtensions.x-create-wrapping-object}} {{/operation}} diff --git a/tests/CTS/client/predict/api.json b/tests/CTS/client/predict/api.json new file mode 100644 index 0000000000..5045cf56c2 --- /dev/null +++ b/tests/CTS/client/predict/api.json @@ -0,0 +1,56 @@ +[ + { + "testName": "calls api with correct user agent", + "steps": [ + { + "type": "method", + "object": "$client", + "path": "fetchUserProfile", + "parameters": [ + { + "userID": "user1", + "params": { + "modelsToRetrieve": [ + "funnel_stage" + ] + } + } + ], + "expected": { + "testSubject": "actual.userAgent", + "match": { + "regexp": "/Algolia%20for%20(.+)%20\\(\\d+\\.\\d+\\.\\d+\\)/" + } + } + } + ] + }, + { + "testName": "calls api with correct timeouts", + "steps": [ + { + "type": "method", + "object": "$client", + "path": "fetchUserProfile", + "parameters": [ + { + "userID": "user1", + "params": { + "modelsToRetrieve": [ + "funnel_stage" + ] + } + } + ], + "expected": { + "match": { + "objectContaining": { + "connectTimeout": 2, + "responseTimeout": 30 + } + } + } + } + ] + } +] diff --git a/tests/CTS/client/predict/parameters.json b/tests/CTS/client/predict/parameters.json new file mode 100644 index 0000000000..1f7d52ac64 --- /dev/null +++ b/tests/CTS/client/predict/parameters.json @@ -0,0 +1,36 @@ +[ + { + "testName": "throws when region is not given", + "autoCreateClient": false, + "steps": [ + { + "type": "createClient", + "parameters": { + "appId": "my-app-id", + "apiKey": "my-api-key", + "region": "" + }, + "expected": { + "error": "`region` is missing." + } + } + ] + }, + { + "testName": "does not throw when region is given", + "autoCreateClient": false, + "steps": [ + { + "type": "createClient", + "parameters": { + "appId": "my-app-id", + "apiKey": "my-api-key", + "region": "ew" + }, + "expected": { + "error": false + } + } + ] + } +] diff --git a/tests/CTS/client/templates/javascript/suite.mustache b/tests/CTS/client/templates/javascript/suite.mustache index c0a561f0ca..29926a79ea 100644 --- a/tests/CTS/client/templates/javascript/suite.mustache +++ b/tests/CTS/client/templates/javascript/suite.mustache @@ -11,7 +11,7 @@ const apiKey = 'test-api-key'; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type function createClient() { - return {{client}}(appId, apiKey, {{#hasRegionalHost}}'us', {{/hasRegionalHost}}{ requester: echoRequester() }); + return {{client}}(appId, apiKey, {{#hasRegionalHost}}'{{{defaultRegion}}}', {{/hasRegionalHost}}{ requester: echoRequester() }); } {{#blocks}} diff --git a/tests/CTS/methods/requests/predict/fetchUserProfile.json b/tests/CTS/methods/requests/predict/fetchUserProfile.json new file mode 100644 index 0000000000..02f4da1430 --- /dev/null +++ b/tests/CTS/methods/requests/predict/fetchUserProfile.json @@ -0,0 +1,80 @@ +[ + { + "testName": "fetchUserProfile with minimal parameters for modelsToRetrieve", + "parameters": { + "userID": "user1", + "params": { + "modelsToRetrieve": [ + "funnel_stage", + "order_value", + "affinities" + ] + } + }, + "request": { + "path": "/1/users/user1/fetch", + "method": "POST", + "body": { + "modelsToRetrieve": [ + "funnel_stage", + "order_value", + "affinities" + ] + } + } + }, + { + "testName": "fetchUserProfile with minimal parameters for typesToRetrieve", + "parameters": { + "userID": "user1", + "params": { + "typesToRetrieve": [ + "properties", + "segments" + ] + } + }, + "request": { + "path": "/1/users/user1/fetch", + "method": "POST", + "body": { + "typesToRetrieve": [ + "properties", + "segments" + ] + } + } + }, + { + "testName": "fetchUserProfile with all parameters", + "parameters": { + "userID": "user1", + "params": { + "modelsToRetrieve": [ + "funnel_stage", + "order_value", + "affinities" + ], + "typesToRetrieve": [ + "properties", + "segments" + ] + } + }, + "request": { + "path": "/1/users/user1/fetch", + "method": "POST", + "body": { + "modelsToRetrieve": [ + "funnel_stage", + "order_value", + "affinities" + ], + "typesToRetrieve": [ + "properties", + "segments" + ] + } + } + } +] diff --git a/tests/CTS/methods/requests/templates/java/requests.mustache b/tests/CTS/methods/requests/templates/java/requests.mustache index 216e9956b4..06b7f1708c 100644 --- a/tests/CTS/methods/requests/templates/java/requests.mustache +++ b/tests/CTS/methods/requests/templates/java/requests.mustache @@ -13,7 +13,6 @@ import org.junit.jupiter.api.BeforeAll; import com.google.gson.reflect.TypeToken; import com.algolia.utils.JSON; -import com.algolia.Pair; import com.algolia.model.{{import}}.*; import com.algolia.api.{{client}}; import org.skyscreamer.jsonassert.JSONAssert; @@ -56,10 +55,11 @@ class {{client}}Tests { {{#request.queryParameters}} Map expectedQuery = JSON.deserialize("{{#lambda.escapequotes}}{{{request.queryParameters}}}{{/lambda.escapequotes}}", new TypeToken>() {}.getType()); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } {{/request.queryParameters}} } diff --git a/tests/CTS/methods/requests/templates/javascript/requests.mustache b/tests/CTS/methods/requests/templates/javascript/requests.mustache index fdd67a2650..b373c32ab2 100644 --- a/tests/CTS/methods/requests/templates/javascript/requests.mustache +++ b/tests/CTS/methods/requests/templates/javascript/requests.mustache @@ -5,7 +5,7 @@ import type { EchoResponse } from '@experimental-api-clients-automation/client-c const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; -const client = {{client}}(appId, apiKey, {{#hasRegionalHost}}'us', {{/hasRegionalHost}}{ requester: echoRequester() }); +const client = {{client}}(appId, apiKey, {{#hasRegionalHost}}'{{{defaultRegion}}}', {{/hasRegionalHost}}{ requester: echoRequester() }); {{#blocks}} describe('{{operationId}}', () => { diff --git a/tests/output/java/src/test/java/com/algolia/CallEcho.java b/tests/output/java/src/test/java/com/algolia/CallEcho.java index cdcebe41d4..14f94d683b 100644 --- a/tests/output/java/src/test/java/com/algolia/CallEcho.java +++ b/tests/output/java/src/test/java/com/algolia/CallEcho.java @@ -2,8 +2,8 @@ import com.algolia.utils.JSON; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.HashMap; +import java.util.Map; import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; @@ -40,7 +40,7 @@ private String processResponseBody() { try { final Request copy = request.newBuilder().build(); final Buffer buffer = new Buffer(); - if(copy.body() == null) { + if (copy.body() == null) { return ""; } copy.body().writeTo(buffer); @@ -50,12 +50,12 @@ private String processResponseBody() { } } - private List buildQueryParams() { - List params = new ArrayList(); + private Map buildQueryParams() { + Map params = new HashMap<>(); HttpUrl url = request.url(); for (String name : url.queryParameterNames()) { for (String value : url.queryParameterValues(name)) { - params.add(new Pair(name, value)); + params.put(name, value); } } return params; diff --git a/tests/output/java/src/test/java/com/algolia/EchoRequester.java b/tests/output/java/src/test/java/com/algolia/EchoRequester.java index a5616581ec..30f1fd9c7d 100644 --- a/tests/output/java/src/test/java/com/algolia/EchoRequester.java +++ b/tests/output/java/src/test/java/com/algolia/EchoRequester.java @@ -3,10 +3,11 @@ import com.algolia.exceptions.*; import com.algolia.utils.JSON; import com.algolia.utils.Requester; +import java.io.IOException; import java.lang.reflect.Type; import okhttp3.Request; import okhttp3.Response; -import java.io.IOException; + public class EchoRequester implements Requester { private int connectionTimeout, readTimeout, writeTimeout; @@ -32,10 +33,10 @@ public T handleResponse(Response response, Type returnType) public EchoResponse getLastEchoResponse() { try { return JSON.deserialize(lastResponse.body().string(), EchoResponse.class); - } catch(IOException e) { + } catch (IOException e) { e.printStackTrace(); return null; - } + } } // NO-OP for now diff --git a/tests/output/java/src/test/java/com/algolia/EchoResponse.java b/tests/output/java/src/test/java/com/algolia/EchoResponse.java index e19afd4878..c49f8f9d4f 100644 --- a/tests/output/java/src/test/java/com/algolia/EchoResponse.java +++ b/tests/output/java/src/test/java/com/algolia/EchoResponse.java @@ -1,11 +1,11 @@ package com.algolia; -import java.util.List; +import java.util.Map; public class EchoResponse { public String path; public String method; public String body; - public List queryParameters; + public Map queryParameters; } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java index 754a52b11e..04dd1b0414 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/abtesting.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.AbtestingClient; import com.algolia.model.abtesting.*; import com.algolia.utils.JSON; @@ -114,10 +113,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -171,10 +171,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -210,10 +211,11 @@ void listABTestsTest0() { "{\"offset\":\"42\",\"limit\":\"21\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -266,10 +268,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -322,10 +325,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java index 504b9c526f..ddac920238 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/analytics.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.AnalyticsClient; import com.algolia.model.analytics.*; import com.algolia.utils.JSON; @@ -66,10 +65,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -109,10 +109,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -133,10 +134,11 @@ void getAverageClickPositionTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -160,10 +162,11 @@ void getAverageClickPositionTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -184,10 +187,11 @@ void getClickPositionsTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -211,10 +215,11 @@ void getClickPositionsTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -235,10 +240,11 @@ void getClickThroughRateTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -262,10 +268,11 @@ void getClickThroughRateTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -286,10 +293,11 @@ void getConversationRateTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -313,10 +321,11 @@ void getConversationRateTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -337,10 +346,11 @@ void getNoClickRateTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -364,10 +374,11 @@ void getNoClickRateTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -388,10 +399,11 @@ void getNoResultsRateTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -415,10 +427,11 @@ void getNoResultsRateTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -439,10 +452,11 @@ void getSearchesCountTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -466,10 +480,11 @@ void getSearchesCountTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -490,10 +505,11 @@ void getSearchesNoClicksTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -526,10 +542,11 @@ void getSearchesNoClicksTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -550,10 +567,11 @@ void getSearchesNoResultsTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -586,10 +604,11 @@ void getSearchesNoResultsTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -610,10 +629,11 @@ void getStatusTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -634,10 +654,11 @@ void getTopCountriesTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -670,10 +691,11 @@ void getTopCountriesTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -694,10 +716,11 @@ void getTopFilterAttributesTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -732,10 +755,11 @@ void getTopFilterAttributesTest1() { "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -757,10 +781,11 @@ void getTopFilterForAttributeTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -784,10 +809,11 @@ void getTopFilterForAttributeTest1() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -824,10 +850,11 @@ void getTopFilterForAttributeTest2() { "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -866,10 +893,11 @@ void getTopFilterForAttributeTest3() { "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -890,10 +918,11 @@ void getTopFiltersNoResultsTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -928,10 +957,11 @@ void getTopFiltersNoResultsTest1() { "{\"index\":\"index\",\"search\":\"mySearch\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -952,10 +982,11 @@ void getTopHitsTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -992,10 +1023,11 @@ void getTopHitsTest1() { "{\"index\":\"index\",\"search\":\"mySearch\",\"clickAnalytics\":\"true\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1016,10 +1048,11 @@ void getTopSearchesTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1058,10 +1091,11 @@ void getTopSearchesTest1() { "{\"index\":\"index\",\"clickAnalytics\":\"true\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"orderBy\":\"searchCount\",\"direction\":\"asc\",\"limit\":\"21\",\"offset\":\"42\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1082,10 +1116,11 @@ void getUsersCountTest0() { "{\"index\":\"index\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1109,10 +1144,11 @@ void getUsersCountTest1() { "{\"index\":\"index\",\"startDate\":\"1999-09-19\",\"endDate\":\"2001-01-01\",\"tags\":\"tag\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1165,10 +1201,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1221,10 +1258,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java index c8170ec5c0..18b1727b65 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/insights.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.InsightsClient; import com.algolia.model.insights.*; import com.algolia.utils.JSON; @@ -66,10 +65,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -109,10 +109,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -165,10 +166,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -331,10 +333,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java index f8428c0b06..6cfd4b7aae 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/personalization.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.PersonalizationClient; import com.algolia.model.personalization.*; import com.algolia.utils.JSON; @@ -66,10 +65,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -123,10 +123,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -205,10 +206,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -261,10 +263,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/predict.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/predict.test.java new file mode 100644 index 0000000000..cc8f6f3ada --- /dev/null +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/predict.test.java @@ -0,0 +1,364 @@ +package com.algolia.methods.requests; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import com.algolia.EchoRequester; +import com.algolia.EchoResponse; +import com.algolia.api.PredictClient; +import com.algolia.model.predict.*; +import com.algolia.utils.JSON; +import com.google.gson.reflect.TypeToken; +import java.util.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.skyscreamer.jsonassert.JSONAssert; +import org.skyscreamer.jsonassert.JSONCompareMode; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class PredictClientTests { + + private PredictClient client; + private EchoRequester requester; + + @BeforeAll + void init() { + requester = new EchoRequester(); + client = new PredictClient("appId", "apiKey", requester); + } + + @Test + @DisplayName("allow del method for a custom path with minimal parameters") + void delTest0() { + String path0 = "/test/minimal"; + + assertDoesNotThrow(() -> { + client.del(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "DELETE"); + } + + @Test + @DisplayName("allow del method for a custom path with all parameters") + void delTest1() { + String path0 = "/test/all"; + Map parameters0 = new HashMap<>(); + { + String query1 = "parameters"; + parameters0.put("query", query1); + } + + assertDoesNotThrow(() -> { + client.del(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "DELETE"); + + Map expectedQuery = JSON.deserialize( + "{\"query\":\"parameters\"}", + new TypeToken>() {}.getType() + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } + + @Test + @DisplayName("fetchUserProfile with minimal parameters for modelsToRetrieve") + void fetchUserProfileTest0() { + String userID0 = "user1"; + ModelsToRetrieve params0 = new ModelsToRetrieve(); + { + List modelsToRetrieve1 = new ArrayList<>(); + { + ModelsToRetrieveEnum modelsToRetrieve_02 = ModelsToRetrieveEnum.fromValue( + "funnel_stage" + ); + modelsToRetrieve1.add(modelsToRetrieve_02); + ModelsToRetrieveEnum modelsToRetrieve_12 = ModelsToRetrieveEnum.fromValue( + "order_value" + ); + modelsToRetrieve1.add(modelsToRetrieve_12); + ModelsToRetrieveEnum modelsToRetrieve_22 = ModelsToRetrieveEnum.fromValue( + "affinities" + ); + modelsToRetrieve1.add(modelsToRetrieve_22); + } + params0.setModelsToRetrieve(modelsToRetrieve1); + } + + assertDoesNotThrow(() -> { + client.fetchUserProfile(userID0, Params.ofModelsToRetrieve(params0)); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/users/user1/fetch"); + assertEquals(req.method, "POST"); + + assertDoesNotThrow(() -> { + JSONAssert.assertEquals( + "{\"modelsToRetrieve\":[\"funnel_stage\",\"order_value\",\"affinities\"]}", + req.body, + JSONCompareMode.STRICT_ORDER + ); + }); + } + + @Test + @DisplayName("fetchUserProfile with minimal parameters for typesToRetrieve") + void fetchUserProfileTest1() { + String userID0 = "user1"; + TypesToRetrieve params0 = new TypesToRetrieve(); + { + List typesToRetrieve1 = new ArrayList<>(); + { + TypesToRetrieveEnum typesToRetrieve_02 = TypesToRetrieveEnum.fromValue( + "properties" + ); + typesToRetrieve1.add(typesToRetrieve_02); + TypesToRetrieveEnum typesToRetrieve_12 = TypesToRetrieveEnum.fromValue( + "segments" + ); + typesToRetrieve1.add(typesToRetrieve_12); + } + params0.setTypesToRetrieve(typesToRetrieve1); + } + + assertDoesNotThrow(() -> { + client.fetchUserProfile(userID0, Params.ofTypesToRetrieve(params0)); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/users/user1/fetch"); + assertEquals(req.method, "POST"); + + assertDoesNotThrow(() -> { + JSONAssert.assertEquals( + "{\"typesToRetrieve\":[\"properties\",\"segments\"]}", + req.body, + JSONCompareMode.STRICT_ORDER + ); + }); + } + + @Test + @DisplayName("fetchUserProfile with all parameters") + void fetchUserProfileTest2() { + String userID0 = "user1"; + AllParams params0 = new AllParams(); + { + List modelsToRetrieve1 = new ArrayList<>(); + { + ModelsToRetrieveEnum modelsToRetrieve_02 = ModelsToRetrieveEnum.fromValue( + "funnel_stage" + ); + modelsToRetrieve1.add(modelsToRetrieve_02); + ModelsToRetrieveEnum modelsToRetrieve_12 = ModelsToRetrieveEnum.fromValue( + "order_value" + ); + modelsToRetrieve1.add(modelsToRetrieve_12); + ModelsToRetrieveEnum modelsToRetrieve_22 = ModelsToRetrieveEnum.fromValue( + "affinities" + ); + modelsToRetrieve1.add(modelsToRetrieve_22); + } + params0.setModelsToRetrieve(modelsToRetrieve1); + List typesToRetrieve1 = new ArrayList<>(); + { + TypesToRetrieveEnum typesToRetrieve_02 = TypesToRetrieveEnum.fromValue( + "properties" + ); + typesToRetrieve1.add(typesToRetrieve_02); + TypesToRetrieveEnum typesToRetrieve_12 = TypesToRetrieveEnum.fromValue( + "segments" + ); + typesToRetrieve1.add(typesToRetrieve_12); + } + params0.setTypesToRetrieve(typesToRetrieve1); + } + + assertDoesNotThrow(() -> { + client.fetchUserProfile(userID0, Params.ofAllParams(params0)); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/users/user1/fetch"); + assertEquals(req.method, "POST"); + + assertDoesNotThrow(() -> { + JSONAssert.assertEquals( + "{\"modelsToRetrieve\":[\"funnel_stage\",\"order_value\",\"affinities\"],\"typesToRetrieve\":[\"properties\",\"segments\"]}", + req.body, + JSONCompareMode.STRICT_ORDER + ); + }); + } + + @Test + @DisplayName("allow get method for a custom path with minimal parameters") + void getTest0() { + String path0 = "/test/minimal"; + + assertDoesNotThrow(() -> { + client.get(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "GET"); + } + + @Test + @DisplayName("allow get method for a custom path with all parameters") + void getTest1() { + String path0 = "/test/all"; + Map parameters0 = new HashMap<>(); + { + String query1 = "parameters"; + parameters0.put("query", query1); + } + + assertDoesNotThrow(() -> { + client.get(path0, parameters0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "GET"); + + Map expectedQuery = JSON.deserialize( + "{\"query\":\"parameters\"}", + new TypeToken>() {}.getType() + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } + + @Test + @DisplayName("allow post method for a custom path with minimal parameters") + void postTest0() { + String path0 = "/test/minimal"; + + assertDoesNotThrow(() -> { + client.post(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "POST"); + } + + @Test + @DisplayName("allow post method for a custom path with all parameters") + void postTest1() { + String path0 = "/test/all"; + Map parameters0 = new HashMap<>(); + { + String query1 = "parameters"; + parameters0.put("query", query1); + } + Map body0 = new HashMap<>(); + { + String body1 = "parameters"; + body0.put("body", body1); + } + + assertDoesNotThrow(() -> { + client.post(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "POST"); + + assertDoesNotThrow(() -> { + JSONAssert.assertEquals( + "{\"body\":\"parameters\"}", + req.body, + JSONCompareMode.STRICT_ORDER + ); + }); + + Map expectedQuery = JSON.deserialize( + "{\"query\":\"parameters\"}", + new TypeToken>() {}.getType() + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } + + @Test + @DisplayName("allow put method for a custom path with minimal parameters") + void putTest0() { + String path0 = "/test/minimal"; + + assertDoesNotThrow(() -> { + client.put(path0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/minimal"); + assertEquals(req.method, "PUT"); + } + + @Test + @DisplayName("allow put method for a custom path with all parameters") + void putTest1() { + String path0 = "/test/all"; + Map parameters0 = new HashMap<>(); + { + String query1 = "parameters"; + parameters0.put("query", query1); + } + Map body0 = new HashMap<>(); + { + String body1 = "parameters"; + body0.put("body", body1); + } + + assertDoesNotThrow(() -> { + client.put(path0, parameters0, body0); + }); + EchoResponse req = requester.getLastEchoResponse(); + + assertEquals(req.path, "/1/test/all"); + assertEquals(req.method, "PUT"); + + assertDoesNotThrow(() -> { + JSONAssert.assertEquals( + "{\"body\":\"parameters\"}", + req.body, + JSONCompareMode.STRICT_ORDER + ); + }); + + Map expectedQuery = JSON.deserialize( + "{\"query\":\"parameters\"}", + new TypeToken>() {}.getType() + ); + Map actualQuery = req.queryParameters; + + assertEquals(expectedQuery.size(), actualQuery.size()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); + } + } +} diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java index b6c29cc1df..1be838fa51 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/query-suggestions.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.QuerySuggestionsClient; import com.algolia.model.querySuggestions.*; import com.algolia.utils.JSON; @@ -142,10 +141,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -199,10 +199,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -309,10 +310,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -365,10 +367,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java index 1375f883a3..b49a410ae9 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/recommend.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.RecommendClient; import com.algolia.model.recommend.*; import com.algolia.utils.JSON; @@ -66,10 +65,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -109,10 +109,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -619,10 +620,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -675,10 +677,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } } diff --git a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java index b731af3cc7..7e5b516497 100644 --- a/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java +++ b/tests/output/java/src/test/java/com/algolia/methods/requests/search.test.java @@ -5,7 +5,6 @@ import com.algolia.EchoRequester; import com.algolia.EchoResponse; -import com.algolia.Pair; import com.algolia.api.SearchClient; import com.algolia.model.search.*; import com.algolia.utils.JSON; @@ -157,10 +156,11 @@ void assignUserIdTest0() { "{\"X-Algolia-User-ID\":\"userID\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -243,10 +243,11 @@ void batchAssignUserIdsTest0() { "{\"X-Algolia-User-ID\":\"userID\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -509,10 +510,11 @@ void batchRulesTest0() { "{\"forwardToReplicas\":\"true\",\"clearExistingRules\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -637,10 +639,11 @@ void delTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -797,10 +800,11 @@ void getTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -862,10 +866,11 @@ void getLogsTest0() { "{\"offset\":\"5\",\"length\":\"10\",\"indexName\":\"theIndexName\",\"type\":\"all\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -894,10 +899,11 @@ void getObjectTest0() { "{\"attributesToRetrieve\":\"attr1,attr2\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1059,10 +1065,11 @@ void hasPendingMappingsTest0() { "{\"getClusters\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1107,10 +1114,11 @@ void listIndicesTest0() { "{\"page\":\"8\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1132,10 +1140,11 @@ void listUserIdsTest0() { "{\"page\":\"8\",\"hitsPerPage\":\"100\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1371,10 +1380,11 @@ void partialUpdateObjectTest0() { "{\"createIfNotExists\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1427,10 +1437,11 @@ void postTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1483,10 +1494,11 @@ void putTest1() { "{\"query\":\"parameters\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1633,10 +1645,11 @@ void saveRuleTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1689,10 +1702,11 @@ void saveSynonymTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -1769,10 +1783,11 @@ void saveSynonymsTest0() { "{\"forwardToReplicas\":\"true\",\"replaceExistingSynonyms\":\"false\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } @@ -2155,10 +2170,11 @@ void setSettingsTest0() { "{\"forwardToReplicas\":\"true\"}", new TypeToken>() {}.getType() ); - List actualQuery = req.queryParameters; + Map actualQuery = req.queryParameters; + assertEquals(expectedQuery.size(), actualQuery.size()); - for (Pair p : actualQuery) { - assertEquals(expectedQuery.get(p.getName()), p.getValue()); + for (Map.Entry p : actualQuery.entrySet()) { + assertEquals(expectedQuery.get(p.getKey()), p.getValue()); } } diff --git a/tests/output/javascript/package.json b/tests/output/javascript/package.json index 610e282c94..5fe8ba3e22 100644 --- a/tests/output/javascript/package.json +++ b/tests/output/javascript/package.json @@ -11,6 +11,7 @@ "@experimental-api-clients-automation/client-common": "0.2.0", "@experimental-api-clients-automation/client-insights": "0.2.0", "@experimental-api-clients-automation/client-personalization": "0.2.0", + "@experimental-api-clients-automation/client-predict": "0.2.0", "@experimental-api-clients-automation/client-query-suggestions": "0.2.0", "@experimental-api-clients-automation/client-search": "0.2.0", "@experimental-api-clients-automation/client-sources": "0.2.0", diff --git a/tests/output/javascript/src/client/predict.test.ts b/tests/output/javascript/src/client/predict.test.ts new file mode 100644 index 0000000000..f2e6704356 --- /dev/null +++ b/tests/output/javascript/src/client/predict.test.ts @@ -0,0 +1,99 @@ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable prefer-const */ +// @ts-nocheck Failing tests will have type errors, but we cannot suppress them even with @ts-expect-error because it doesn't work for a block of lines. +import { predictClient } from '@experimental-api-clients-automation/client-predict'; +import { echoRequester } from '@experimental-api-clients-automation/requester-node-http'; + +const appId = 'test-app-id'; +const apiKey = 'test-api-key'; + +function createClient() { + return predictClient(appId, apiKey, 'ew', { requester: echoRequester() }); +} + +describe('api', () => { + test('calls api with correct user agent', async () => { + let $client; + $client = createClient(); + + let actual; + + actual = $client.fetchUserProfile({ + userID: 'user1', + params: { modelsToRetrieve: ['funnel_stage'] }, + }); + + if (actual instanceof Promise) { + actual = await actual; + } + + expect(actual.userAgent).toMatch( + /Algolia%20for%20(.+)%20\(\d+\.\d+\.\d+\)/ + ); + }); + + test('calls api with correct timeouts', async () => { + let $client; + $client = createClient(); + + let actual; + + actual = $client.fetchUserProfile({ + userID: 'user1', + params: { modelsToRetrieve: ['funnel_stage'] }, + }); + + if (actual instanceof Promise) { + actual = await actual; + } + + expect(actual).toEqual( + expect.objectContaining({ connectTimeout: 2, responseTimeout: 30 }) + ); + }); +}); + +describe('parameters', () => { + test('throws when region is not given', async () => { + let $client; + + let actual; + await expect( + new Promise((resolve, reject) => { + $client = predictClient('my-app-id', 'my-api-key', '', { + requester: echoRequester(), + }); + + actual = $client; + + if (actual instanceof Promise) { + actual.then(resolve).catch(reject); + } else { + resolve(); + } + }) + ).rejects.toThrow('`region` is missing.'); + }); + + test('does not throw when region is given', async () => { + let $client; + + let actual; + + await expect( + new Promise((resolve, reject) => { + $client = predictClient('my-app-id', 'my-api-key', 'ew', { + requester: echoRequester(), + }); + + actual = $client; + + if (actual instanceof Promise) { + actual.then(resolve).catch(reject); + } else { + resolve(); + } + }) + ).resolves.not.toThrow(); + }); +}); diff --git a/tests/output/javascript/src/methods/requests/predict.test.ts b/tests/output/javascript/src/methods/requests/predict.test.ts new file mode 100644 index 0000000000..bfa914a067 --- /dev/null +++ b/tests/output/javascript/src/methods/requests/predict.test.ts @@ -0,0 +1,160 @@ +import type { EchoResponse } from '@experimental-api-clients-automation/client-common'; +import { predictClient } from '@experimental-api-clients-automation/client-predict'; +import { echoRequester } from '@experimental-api-clients-automation/requester-node-http'; + +const appId = process.env.ALGOLIA_APPLICATION_ID || 'test_app_id'; +const apiKey = process.env.ALGOLIA_SEARCH_KEY || 'test_api_key'; + +const client = predictClient(appId, apiKey, 'ew', { + requester: echoRequester(), +}); + +describe('del', () => { + test('allow del method for a custom path with minimal parameters', async () => { + const req = (await client.del({ + path: '/test/minimal', + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/minimal'); + expect(req.method).toEqual('DELETE'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('allow del method for a custom path with all parameters', async () => { + const req = (await client.del({ + path: '/test/all', + parameters: { query: 'parameters' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/all'); + expect(req.method).toEqual('DELETE'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual({ query: 'parameters' }); + }); +}); + +describe('fetchUserProfile', () => { + test('fetchUserProfile with minimal parameters for modelsToRetrieve', async () => { + const req = (await client.fetchUserProfile({ + userID: 'user1', + params: { + modelsToRetrieve: ['funnel_stage', 'order_value', 'affinities'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/users/user1/fetch'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + modelsToRetrieve: ['funnel_stage', 'order_value', 'affinities'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('fetchUserProfile with minimal parameters for typesToRetrieve', async () => { + const req = (await client.fetchUserProfile({ + userID: 'user1', + params: { typesToRetrieve: ['properties', 'segments'] }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/users/user1/fetch'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ typesToRetrieve: ['properties', 'segments'] }); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('fetchUserProfile with all parameters', async () => { + const req = (await client.fetchUserProfile({ + userID: 'user1', + params: { + modelsToRetrieve: ['funnel_stage', 'order_value', 'affinities'], + typesToRetrieve: ['properties', 'segments'], + }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/users/user1/fetch'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ + modelsToRetrieve: ['funnel_stage', 'order_value', 'affinities'], + typesToRetrieve: ['properties', 'segments'], + }); + expect(req.searchParams).toStrictEqual(undefined); + }); +}); + +describe('get', () => { + test('allow get method for a custom path with minimal parameters', async () => { + const req = (await client.get({ + path: '/test/minimal', + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/minimal'); + expect(req.method).toEqual('GET'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('allow get method for a custom path with all parameters', async () => { + const req = (await client.get({ + path: '/test/all', + parameters: { query: 'parameters' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/all'); + expect(req.method).toEqual('GET'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual({ query: 'parameters' }); + }); +}); + +describe('post', () => { + test('allow post method for a custom path with minimal parameters', async () => { + const req = (await client.post({ + path: '/test/minimal', + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/minimal'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('allow post method for a custom path with all parameters', async () => { + const req = (await client.post({ + path: '/test/all', + parameters: { query: 'parameters' }, + body: { body: 'parameters' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/all'); + expect(req.method).toEqual('POST'); + expect(req.data).toEqual({ body: 'parameters' }); + expect(req.searchParams).toStrictEqual({ query: 'parameters' }); + }); +}); + +describe('put', () => { + test('allow put method for a custom path with minimal parameters', async () => { + const req = (await client.put({ + path: '/test/minimal', + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/minimal'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual(undefined); + expect(req.searchParams).toStrictEqual(undefined); + }); + + test('allow put method for a custom path with all parameters', async () => { + const req = (await client.put({ + path: '/test/all', + parameters: { query: 'parameters' }, + body: { body: 'parameters' }, + })) as unknown as EchoResponse; + + expect(req.path).toEqual('/1/test/all'); + expect(req.method).toEqual('PUT'); + expect(req.data).toEqual({ body: 'parameters' }); + expect(req.searchParams).toStrictEqual({ query: 'parameters' }); + }); +}); diff --git a/yarn.lock b/yarn.lock index 19410b407d..6c556ac8bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13220,6 +13220,7 @@ __metadata: "@experimental-api-clients-automation/client-common": 0.2.0 "@experimental-api-clients-automation/client-insights": 0.2.0 "@experimental-api-clients-automation/client-personalization": 0.2.0 + "@experimental-api-clients-automation/client-predict": 0.2.0 "@experimental-api-clients-automation/client-query-suggestions": 0.2.0 "@experimental-api-clients-automation/client-search": 0.2.0 "@experimental-api-clients-automation/client-sources": 0.2.0 From b554aacee0654cacc5664dc41fed9d83feab01b9 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 14:27:38 +0200 Subject: [PATCH 08/15] remove generated changes --- .../src/main/java/com/algolia/ApiClient.java | 128 +----- .../java/com/algolia/api/AbtestingClient.java | 70 +-- .../java/com/algolia/api/AnalyticsClient.java | 308 +++++-------- .../java/com/algolia/api/InsightsClient.java | 46 +- .../algolia/api/PersonalizationClient.java | 61 +-- .../java/com/algolia/api/PredictClient.java | 46 +- .../algolia/api/QuerySuggestionsClient.java | 76 +--- .../java/com/algolia/api/RecommendClient.java | 46 +- .../java/com/algolia/api/SearchClient.java | 423 ++++++------------ .../src/algoliasearchLiteClient.ts | 4 + .../client-abtesting/src/abtestingClient.ts | 9 + .../client-analytics/src/analyticsClient.ts | 21 + .../client-insights/src/insightsClient.ts | 5 + .../src/personalizationClient.ts | 8 + .../client-predict/model/allParams.ts | 4 + .../packages/client-predict/model/index.ts | 3 + .../client-predict/model/modelsToRetrieve.ts | 6 +- .../model/modelsToRetrieveEnum.ts | 4 + .../packages/client-predict/model/params.ts | 15 +- .../client-predict/model/typesToRetrieve.ts | 6 +- .../model/typesToRetrieveEnum.ts | 1 + .../client-predict/src/predictClient.ts | 5 + .../src/querySuggestionsClient.ts | 11 + .../client-search/src/searchClient.ts | 61 +++ .../client-sources/src/sourcesClient.ts | 5 + .../packages/recommend/src/recommendClient.ts | 5 + specs/bundled/predict.yml | 48 +- 27 files changed, 560 insertions(+), 865 deletions(-) create mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/allParams.ts create mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieveEnum.ts create mode 100644 clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieveEnum.ts diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiClient.java index 7b2db65c14..2eb4d2a1cb 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/ApiClient.java @@ -188,118 +188,6 @@ public String parameterToString(Object param) { } } - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - *

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

Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs( - String collectionFormat, - String name, - Collection value - ) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString( - String collectionFormat, - Collection value - ) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - /** * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; * charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also default to JSON @@ -574,7 +462,7 @@ public T handleResponse(Response response, Type returnType) public Call buildCall( String path, String method, - List queryParams, + Map queryParams, Object body, Map headerParams, ApiCallback callback @@ -607,23 +495,21 @@ public Call buildCall( public Request buildRequest( String path, String method, - List queryParams, + Map queryParams, Object body, Map headerParams, ApiCallback callback ) throws AlgoliaRuntimeException { headerParams.put("X-Algolia-Application-Id", this.appId); headerParams.put("X-Algolia-API-Key", this.apiKey); + headerParams.put("Accept", "application/json"); + headerParams.put("Content-Type", "application/json"); final String url = buildUrl(path, queryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } RequestBody reqBody; if (!HttpMethod.permitsRequestBody(method)) { @@ -666,7 +552,7 @@ public Request buildRequest( * @param queryParams The query parameters * @return The full URL */ - public String buildUrl(String path, List queryParams) { + public String buildUrl(String path, Map queryParams) { final StringBuilder url = new StringBuilder(); // The real host will be assigned by the retry strategy @@ -675,7 +561,7 @@ public String buildUrl(String path, List queryParams) { if (queryParams != null && !queryParams.isEmpty()) { // support (constant) query string in `path`, e.g. "/posts?draft=1" String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { + for (Entry param : queryParams.entrySet()) { if (param.getValue() != null) { if (prefix != null) { url.append(prefix); @@ -685,7 +571,7 @@ public String buildUrl(String path, List queryParams) { } String value = parameterToString(param.getValue()); url - .append(escapeString(param.getName())) + .append(escapeString(param.getKey())) .append("=") .append(escapeString(value)); } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AbtestingClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AbtestingClient.java index 4f7fc47bb0..62029c2b59 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AbtestingClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AbtestingClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.abtesting.*; import com.algolia.utils.*; @@ -85,12 +84,9 @@ private Call addABTestsCall( // create path and map variables String requestPath = "/2/abtests"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -175,20 +171,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -282,12 +276,9 @@ private Call deleteABTestCall( this.escapeString(id.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -368,20 +359,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -473,12 +462,9 @@ private Call getABTestCall(Integer id, final ApiCallback callback) this.escapeString(id.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -556,20 +542,17 @@ private Call listABTestsCall( // create path and map variables String requestPath = "/2/abtests"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -658,20 +641,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -767,20 +748,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -878,12 +857,9 @@ private Call stopABTestCall( this.escapeString(id.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AnalyticsClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AnalyticsClient.java index 9913cdf6ff..920833c0cd 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AnalyticsClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/AnalyticsClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.analytics.*; import com.algolia.utils.*; @@ -86,20 +85,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -190,20 +187,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -296,28 +291,25 @@ private Call getAverageClickPositionCall( // create path and map variables String requestPath = "/2/clicks/averageClickPosition"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -454,28 +446,25 @@ private Call getClickPositionsCall( // create path and map variables String requestPath = "/2/clicks/positions"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -606,28 +595,25 @@ private Call getClickThroughRateCall( // create path and map variables String requestPath = "/2/clicks/clickThroughRate"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -758,28 +744,25 @@ private Call getConversationRateCall( // create path and map variables String requestPath = "/2/conversions/conversionRate"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -910,28 +893,25 @@ private Call getNoClickRateCall( // create path and map variables String requestPath = "/2/searches/noClickRate"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1061,28 +1041,25 @@ private Call getNoResultsRateCall( // create path and map variables String requestPath = "/2/searches/noResultRate"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1212,28 +1189,25 @@ private Call getSearchesCountCall( // create path and map variables String requestPath = "/2/searches/count"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1363,36 +1337,33 @@ private Call getSearchesNoClicksCall( // create path and map variables String requestPath = "/2/searches/noClicks"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1549,36 +1520,33 @@ private Call getSearchesNoResultsCall( // create path and map variables String requestPath = "/2/searches/noResults"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1731,16 +1699,13 @@ private Call getStatusCall( // create path and map variables String requestPath = "/2/status"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -1828,36 +1793,33 @@ private Call getTopCountriesCall( // create path and map variables String requestPath = "/2/countries"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2012,40 +1974,37 @@ private Call getTopFilterAttributesCall( // create path and map variables String requestPath = "/2/filters"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (search != null) { - queryParams.addAll(this.parameterToPair("search", search)); + queryParams.put("search", parameterToString(search)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2224,40 +2183,37 @@ private Call getTopFilterForAttributeCall( this.escapeString(attribute.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (search != null) { - queryParams.addAll(this.parameterToPair("search", search)); + queryParams.put("search", parameterToString(search)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2451,40 +2407,37 @@ private Call getTopFiltersNoResultsCall( // create path and map variables String requestPath = "/2/filters/noResults"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (search != null) { - queryParams.addAll(this.parameterToPair("search", search)); + queryParams.put("search", parameterToString(search)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2659,46 +2612,41 @@ private Call getTopHitsCall( // create path and map variables String requestPath = "/2/hits"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (search != null) { - queryParams.addAll(this.parameterToPair("search", search)); + queryParams.put("search", parameterToString(search)); } if (clickAnalytics != null) { - queryParams.addAll( - this.parameterToPair("clickAnalytics", clickAnalytics) - ); + queryParams.put("clickAnalytics", parameterToString(clickAnalytics)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2871,50 +2819,45 @@ private Call getTopSearchesCall( // create path and map variables String requestPath = "/2/searches"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (clickAnalytics != null) { - queryParams.addAll( - this.parameterToPair("clickAnalytics", clickAnalytics) - ); + queryParams.put("clickAnalytics", parameterToString(clickAnalytics)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (orderBy != null) { - queryParams.addAll(this.parameterToPair("orderBy", orderBy)); + queryParams.put("orderBy", parameterToString(orderBy)); } if (direction != null) { - queryParams.addAll(this.parameterToPair("direction", direction)); + queryParams.put("direction", parameterToString(direction)); } if (limit != null) { - queryParams.addAll(this.parameterToPair("limit", limit)); + queryParams.put("limit", parameterToString(limit)); } if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3104,28 +3047,25 @@ private Call getUsersCountCall( // create path and map variables String requestPath = "/2/users/count"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (index != null) { - queryParams.addAll(this.parameterToPair("index", index)); + queryParams.put("index", parameterToString(index)); } if (startDate != null) { - queryParams.addAll(this.parameterToPair("startDate", startDate)); + queryParams.put("startDate", parameterToString(startDate)); } if (endDate != null) { - queryParams.addAll(this.parameterToPair("endDate", endDate)); + queryParams.put("endDate", parameterToString(endDate)); } if (tags != null) { - queryParams.addAll(this.parameterToPair("tags", tags)); + queryParams.put("tags", parameterToString(tags)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3252,20 +3192,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -3361,20 +3299,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/InsightsClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/InsightsClient.java index 4a9286e66a..479bd36a89 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/InsightsClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/InsightsClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.insights.*; import com.algolia.utils.*; @@ -86,20 +85,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -190,20 +187,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -295,20 +290,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -402,12 +395,9 @@ private Call pushEventsCall( // create path and map variables String requestPath = "/1/events"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -505,20 +495,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PersonalizationClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PersonalizationClient.java index ac5143b0d5..3dc391eda6 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PersonalizationClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PersonalizationClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.personalization.*; import com.algolia.utils.*; @@ -85,20 +84,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -192,12 +189,9 @@ private Call deleteUserProfileCall( this.escapeString(userToken.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -290,20 +284,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -392,12 +384,9 @@ private Call getPersonalizationStrategyCall( // create path and map variables String requestPath = "/1/strategies/personalization"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -477,12 +466,9 @@ private Call getUserTokenProfileCall( this.escapeString(userToken.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -576,20 +562,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -685,20 +669,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -792,12 +774,9 @@ private Call setPersonalizationStrategyCall( // create path and map variables String requestPath = "/1/strategies/personalization"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PredictClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PredictClient.java index 29aad48cb3..af13bc6970 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PredictClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/PredictClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.predict.*; import com.algolia.utils.*; @@ -81,20 +80,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -189,12 +186,9 @@ private Call fetchUserProfileCall( this.escapeString(userID.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -294,20 +288,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -399,20 +391,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -508,20 +498,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/QuerySuggestionsClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/QuerySuggestionsClient.java index 84c1c5cf81..dee048d17e 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/QuerySuggestionsClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/QuerySuggestionsClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.querySuggestions.*; import com.algolia.utils.*; @@ -84,12 +83,9 @@ private Call createConfigCall( // create path and map variables String requestPath = "/1/configs"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -182,20 +178,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -289,12 +283,9 @@ private Call deleteConfigCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -381,20 +372,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -483,12 +472,9 @@ private Call getAllConfigsCall( // create path and map variables String requestPath = "/1/configs"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -566,12 +552,9 @@ private Call getConfigCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -657,12 +640,9 @@ private Call getConfigStatusCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -751,12 +731,9 @@ private Call getLogFileCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -840,20 +817,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -949,20 +924,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -1061,12 +1034,9 @@ private Call updateConfigCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/RecommendClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/RecommendClient.java index bcd164a028..5595fc4908 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/RecommendClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/RecommendClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.recommend.*; import com.algolia.utils.*; @@ -119,20 +118,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -223,20 +220,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -326,12 +321,9 @@ private Call getRecommendationsCall( // create path and map variables String requestPath = "/1/indexes/*/recommendations"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -425,20 +417,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -534,20 +524,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/SearchClient.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/SearchClient.java index 3c3456694e..f38613cf80 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/SearchClient.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/api/SearchClient.java @@ -3,7 +3,6 @@ import com.algolia.ApiCallback; import com.algolia.ApiClient; import com.algolia.ApiResponse; -import com.algolia.Pair; import com.algolia.exceptions.*; import com.algolia.model.search.*; import com.algolia.utils.*; @@ -118,12 +117,9 @@ private Call addApiKeyCall( // create path and map variables String requestPath = "/1/keys"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -210,12 +206,9 @@ private Call addOrUpdateObjectCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -337,12 +330,9 @@ private Call appendSourceCall( // create path and map variables String requestPath = "/1/security/sources/append"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -423,18 +413,13 @@ private Call assignUserIdCall( // create path and map variables String requestPath = "/1/clusters/mapping"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (xAlgoliaUserID != null) { - queryParams.addAll( - this.parameterToPair("X-Algolia-User-ID", xAlgoliaUserID) - ); + queryParams.put("X-Algolia-User-ID", parameterToString(xAlgoliaUserID)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -546,12 +531,9 @@ private Call batchCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -645,18 +627,13 @@ private Call batchAssignUserIdsCall( // create path and map variables String requestPath = "/1/clusters/mapping/batch"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (xAlgoliaUserID != null) { - queryParams.addAll( - this.parameterToPair("X-Algolia-User-ID", xAlgoliaUserID) - ); + queryParams.put("X-Algolia-User-ID", parameterToString(xAlgoliaUserID)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -773,12 +750,9 @@ private Call batchDictionaryEntriesCall( this.escapeString(dictionaryName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -894,24 +868,23 @@ private Call batchRulesCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } if (clearExistingRules != null) { - queryParams.addAll( - this.parameterToPair("clearExistingRules", clearExistingRules) + queryParams.put( + "clearExistingRules", + parameterToString(clearExistingRules) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1046,12 +1019,9 @@ private Call browseCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1156,18 +1126,16 @@ private Call clearAllSynonymsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1274,12 +1242,9 @@ private Call clearObjectsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1365,18 +1330,16 @@ private Call clearRulesCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1474,20 +1437,18 @@ private Call delCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -1581,12 +1542,9 @@ private Call deleteApiKeyCall( this.escapeString(key.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -1671,12 +1629,9 @@ private Call deleteByCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -1777,12 +1732,9 @@ private Call deleteIndexCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -1868,12 +1820,9 @@ private Call deleteObjectCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -1971,18 +1920,16 @@ private Call deleteRuleCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -2101,12 +2048,9 @@ private Call deleteSourceCall( this.escapeString(source.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -2193,18 +2137,16 @@ private Call deleteSynonymCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -2320,20 +2262,18 @@ private Call getCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2425,12 +2365,9 @@ private Call getApiKeyCall(String key, final ApiCallback callback) this.escapeString(key.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2506,12 +2443,9 @@ private Call getDictionaryLanguagesCall( // create path and map variables String requestPath = "/1/dictionaries/*/languages"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2581,12 +2515,9 @@ private Call getDictionarySettingsCall( // create path and map variables String requestPath = "/1/dictionaries/*/settings"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2665,28 +2596,25 @@ private Call getLogsCall( // create path and map variables String requestPath = "/1/logs"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (offset != null) { - queryParams.addAll(this.parameterToPair("offset", offset)); + queryParams.put("offset", parameterToString(offset)); } if (length != null) { - queryParams.addAll(this.parameterToPair("length", length)); + queryParams.put("length", parameterToString(length)); } if (indexName != null) { - queryParams.addAll(this.parameterToPair("indexName", indexName)); + queryParams.put("indexName", parameterToString(indexName)); } if (type != null) { - queryParams.addAll(this.parameterToPair("type", type)); + queryParams.put("type", parameterToString(type)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2800,18 +2728,16 @@ private Call getObjectCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (attributesToRetrieve != null) { - queryParams.addAll( - this.parameterToPair("attributesToRetrieve", attributesToRetrieve) + queryParams.put( + "attributesToRetrieve", + parameterToString(attributesToRetrieve) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -2926,12 +2852,9 @@ private Call getObjectsCall( // create path and map variables String requestPath = "/1/indexes/*/objects"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -3018,12 +2941,9 @@ private Call getRuleCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3118,12 +3038,9 @@ private Call getSettingsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3201,12 +3118,9 @@ private Call getSourcesCall(final ApiCallback> callback) // create path and map variables String requestPath = "/1/security/sources"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3279,12 +3193,9 @@ private Call getSynonymCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3381,12 +3292,9 @@ private Call getTaskCall( ) .replaceAll("\\{taskID\\}", this.escapeString(taskID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3476,12 +3384,9 @@ private Call getTopUserIdsCall( // create path and map variables String requestPath = "/1/clusters/mapping/top"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3557,12 +3462,9 @@ private Call getUserIdCall(String userID, final ApiCallback callback) this.escapeString(userID.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3645,16 +3547,13 @@ private Call hasPendingMappingsCall( // create path and map variables String requestPath = "/1/clusters/mapping/pending"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (getClusters != null) { - queryParams.addAll(this.parameterToPair("getClusters", getClusters)); + queryParams.put("getClusters", parameterToString(getClusters)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3739,12 +3638,9 @@ private Call listApiKeysCall(final ApiCallback callback) // create path and map variables String requestPath = "/1/keys"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3810,12 +3706,9 @@ private Call listClustersCall( // create path and map variables String requestPath = "/1/clusters"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3885,16 +3778,13 @@ private Call listIndicesCall( // create path and map variables String requestPath = "/1/indexes"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); + queryParams.put("page", parameterToString(page)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -3976,20 +3866,17 @@ private Call listUserIdsCall( // create path and map variables String requestPath = "/1/clusters/mapping"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); + queryParams.put("page", parameterToString(page)); } if (hitsPerPage != null) { - queryParams.addAll(this.parameterToPair("hitsPerPage", hitsPerPage)); + queryParams.put("hitsPerPage", parameterToString(hitsPerPage)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "GET", @@ -4080,12 +3967,9 @@ private Call multipleBatchCall( // create path and map variables String requestPath = "/1/indexes/*/batch"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -4167,12 +4051,9 @@ private Call multipleQueriesCall( // create path and map variables String requestPath = "/1/indexes/*/queries"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -4262,12 +4143,9 @@ private Call operationIndexCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -4377,18 +4255,16 @@ private Call partialUpdateObjectCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (createIfNotExists != null) { - queryParams.addAll( - this.parameterToPair("createIfNotExists", createIfNotExists) + queryParams.put( + "createIfNotExists", + parameterToString(createIfNotExists) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -4545,20 +4421,18 @@ private Call postCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -4654,20 +4528,18 @@ private Call putCall( // create path and map variables String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString()); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (parameters != null) { for (Map.Entry parameter : parameters.entrySet()) { - queryParams.addAll( - this.parameterToPair(parameter.getKey(), parameter.getValue()) + queryParams.put( + parameter.getKey().toString(), + parameterToString(parameter.getValue()) ); } } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -4765,12 +4637,9 @@ private Call removeUserIdCall( this.escapeString(userID.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "DELETE", @@ -4852,12 +4721,9 @@ private Call replaceSourcesCall( // create path and map variables String requestPath = "/1/security/sources"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -4941,12 +4807,9 @@ private Call restoreApiKeyCall( this.escapeString(key.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5031,12 +4894,9 @@ private Call saveObjectCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5135,18 +4995,16 @@ private Call saveRuleCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -5286,18 +5144,16 @@ private Call saveSynonymCall( ) .replaceAll("\\{objectID\\}", this.escapeString(objectID.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -5443,24 +5299,23 @@ private Call saveSynonymsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } if (replaceExistingSynonyms != null) { - queryParams.addAll( - this.parameterToPair("replaceExistingSynonyms", replaceExistingSynonyms) + queryParams.put( + "replaceExistingSynonyms", + parameterToString(replaceExistingSynonyms) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5599,12 +5454,9 @@ private Call searchCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5700,12 +5552,9 @@ private Call searchDictionaryEntriesCall( this.escapeString(dictionaryName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5821,12 +5670,9 @@ private Call searchForFacetValuesCall( ) .replaceAll("\\{facetName\\}", this.escapeString(facetName.toString())); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -5958,12 +5804,9 @@ private Call searchRulesCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -6072,28 +5915,25 @@ private Call searchSynonymsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (query != null) { - queryParams.addAll(this.parameterToPair("query", query)); + queryParams.put("query", parameterToString(query)); } if (type != null) { - queryParams.addAll(this.parameterToPair("type", type)); + queryParams.put("type", parameterToString(type)); } if (page != null) { - queryParams.addAll(this.parameterToPair("page", page)); + queryParams.put("page", parameterToString(page)); } if (hitsPerPage != null) { - queryParams.addAll(this.parameterToPair("hitsPerPage", hitsPerPage)); + queryParams.put("hitsPerPage", parameterToString(hitsPerPage)); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -6224,12 +6064,9 @@ private Call searchUserIdsCall( // create path and map variables String requestPath = "/1/clusters/mapping/search"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "POST", @@ -6322,12 +6159,9 @@ private Call setDictionarySettingsCall( // create path and map variables String requestPath = "/1/dictionaries/*/settings"; - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -6423,18 +6257,16 @@ private Call setSettingsCall( this.escapeString(indexName.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); if (forwardToReplicas != null) { - queryParams.addAll( - this.parameterToPair("forwardToReplicas", forwardToReplicas) + queryParams.put( + "forwardToReplicas", + parameterToString(forwardToReplicas) ); } - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", @@ -6564,12 +6396,9 @@ private Call updateApiKeyCall( this.escapeString(key.toString()) ); - List queryParams = new ArrayList(); + Map queryParams = new HashMap(); Map headers = new HashMap(); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - return this.buildCall( requestPath, "PUT", diff --git a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts index 8198da4215..89f9c81e04 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts @@ -91,6 +91,7 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) { * * @summary Search multiple indices. * @param multipleQueriesParams - The multipleQueriesParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ multipleQueries( multipleQueriesParams: MultipleQueriesParams, @@ -136,6 +137,7 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) { * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -172,6 +174,7 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) { * @param search - The search object. * @param search.indexName - The index in which to perform the request. * @param search.searchParams - The searchParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ search( { indexName, searchParams }: SearchProps, @@ -220,6 +223,7 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) { * @param searchForFacetValues.indexName - The index in which to perform the request. * @param searchForFacetValues.facetName - The facet name. * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchForFacetValues( { diff --git a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingClient.ts b/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingClient.ts index baa0eca7a3..fca390eade 100644 --- a/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingClient.ts @@ -65,6 +65,7 @@ export function createAbtestingClient( * * @summary Create a test. * @param addABTestsRequest - The addABTestsRequest object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ addABTests( addABTestsRequest: AddABTestsRequest, @@ -119,6 +120,7 @@ export function createAbtestingClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -153,6 +155,7 @@ export function createAbtestingClient( * @summary Delete a test. * @param deleteABTest - The deleteABTest object. * @param deleteABTest.id - The A/B test ID. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteABTest( { id }: DeleteABTestProps, @@ -193,6 +196,7 @@ export function createAbtestingClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -227,6 +231,7 @@ export function createAbtestingClient( * @summary Get a test. * @param getABTest - The getABTest object. * @param getABTest.id - The A/B test ID. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getABTest( { id }: GetABTestProps, @@ -265,6 +270,7 @@ export function createAbtestingClient( * @param listABTests - The listABTests object. * @param listABTests.offset - Position of the starting record. Used for paging. 0 is the first record. * @param listABTests.limit - Number of records to return. Limit is the size of the page. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listABTests( { offset, limit }: ListABTestsProps, @@ -305,6 +311,7 @@ export function createAbtestingClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -342,6 +349,7 @@ export function createAbtestingClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, @@ -377,6 +385,7 @@ export function createAbtestingClient( * @summary Stop a test. * @param stopABTest - The stopABTest object. * @param stopABTest.id - The A/B test ID. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ stopABTest( { id }: StopABTestProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsClient.ts b/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsClient.ts index 34b657a914..4473a64e1a 100644 --- a/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsClient.ts @@ -82,6 +82,7 @@ export function createAnalyticsClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -117,6 +118,7 @@ export function createAnalyticsClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -154,6 +156,7 @@ export function createAnalyticsClient( * @param getAverageClickPosition.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getAverageClickPosition.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getAverageClickPosition.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getAverageClickPosition( { index, startDate, endDate, tags }: GetAverageClickPositionProps, @@ -209,6 +212,7 @@ export function createAnalyticsClient( * @param getClickPositions.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickPositions.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickPositions.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getClickPositions( { index, startDate, endDate, tags }: GetClickPositionsProps, @@ -264,6 +268,7 @@ export function createAnalyticsClient( * @param getClickThroughRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickThroughRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getClickThroughRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getClickThroughRate( { index, startDate, endDate, tags }: GetClickThroughRateProps, @@ -319,6 +324,7 @@ export function createAnalyticsClient( * @param getConversationRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getConversationRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getConversationRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getConversationRate( { index, startDate, endDate, tags }: GetConversationRateProps, @@ -374,6 +380,7 @@ export function createAnalyticsClient( * @param getNoClickRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoClickRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoClickRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getNoClickRate( { index, startDate, endDate, tags }: GetNoClickRateProps, @@ -429,6 +436,7 @@ export function createAnalyticsClient( * @param getNoResultsRate.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoResultsRate.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getNoResultsRate.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getNoResultsRate( { index, startDate, endDate, tags }: GetNoResultsRateProps, @@ -484,6 +492,7 @@ export function createAnalyticsClient( * @param getSearchesCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getSearchesCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getSearchesCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSearchesCount( { index, startDate, endDate, tags }: GetSearchesCountProps, @@ -541,6 +550,7 @@ export function createAnalyticsClient( * @param getSearchesNoClicks.limit - Number of records to return. Limit is the size of the page. * @param getSearchesNoClicks.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getSearchesNoClicks.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSearchesNoClicks( { @@ -613,6 +623,7 @@ export function createAnalyticsClient( * @param getSearchesNoResults.limit - Number of records to return. Limit is the size of the page. * @param getSearchesNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getSearchesNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSearchesNoResults( { @@ -680,6 +691,7 @@ export function createAnalyticsClient( * @summary Get Analytics API status. * @param getStatus - The getStatus object. * @param getStatus.index - The index name to target. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getStatus( { index }: GetStatusProps, @@ -725,6 +737,7 @@ export function createAnalyticsClient( * @param getTopCountries.limit - Number of records to return. Limit is the size of the page. * @param getTopCountries.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopCountries.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopCountries( { index, startDate, endDate, limit, offset, tags }: GetTopCountriesProps, @@ -791,6 +804,7 @@ export function createAnalyticsClient( * @param getTopFilterAttributes.limit - Number of records to return. Limit is the size of the page. * @param getTopFilterAttributes.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopFilterAttributes.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopFilterAttributes( { @@ -870,6 +884,7 @@ export function createAnalyticsClient( * @param getTopFilterForAttribute.limit - Number of records to return. Limit is the size of the page. * @param getTopFilterForAttribute.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopFilterForAttribute.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopFilterForAttribute( { @@ -958,6 +973,7 @@ export function createAnalyticsClient( * @param getTopFiltersNoResults.limit - Number of records to return. Limit is the size of the page. * @param getTopFiltersNoResults.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopFiltersNoResults.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopFiltersNoResults( { @@ -1037,6 +1053,7 @@ export function createAnalyticsClient( * @param getTopHits.limit - Number of records to return. Limit is the size of the page. * @param getTopHits.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopHits.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopHits( { @@ -1122,6 +1139,7 @@ export function createAnalyticsClient( * @param getTopSearches.limit - Number of records to return. Limit is the size of the page. * @param getTopSearches.offset - Position of the starting record. Used for paging. 0 is the first record. * @param getTopSearches.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopSearches( { @@ -1207,6 +1225,7 @@ export function createAnalyticsClient( * @param getUsersCount.startDate - The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getUsersCount.endDate - The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. * @param getUsersCount.tags - Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getUsersCount( { index, startDate, endDate, tags }: GetUsersCountProps, @@ -1261,6 +1280,7 @@ export function createAnalyticsClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -1298,6 +1318,7 @@ export function createAnalyticsClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsClient.ts b/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsClient.ts index 2eb7caa392..e050e0ecb5 100644 --- a/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-insights/src/insightsClient.ts @@ -65,6 +65,7 @@ export function createInsightsClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -100,6 +101,7 @@ export function createInsightsClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -136,6 +138,7 @@ export function createInsightsClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -170,6 +173,7 @@ export function createInsightsClient( * * @summary Push events. * @param insightEvents - The insightEvents object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ pushEvents( insightEvents: InsightEvents, @@ -215,6 +219,7 @@ export function createInsightsClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationClient.ts b/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationClient.ts index 08d6579b0a..7733fb7642 100644 --- a/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationClient.ts @@ -68,6 +68,7 @@ export function createPersonalizationClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -102,6 +103,7 @@ export function createPersonalizationClient( * @summary Delete a user profile. * @param deleteUserProfile - The deleteUserProfile object. * @param deleteUserProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteUserProfile( { userToken }: DeleteUserProfileProps, @@ -142,6 +144,7 @@ export function createPersonalizationClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -174,6 +177,7 @@ export function createPersonalizationClient( * The strategy contains information on the events and facets that impact user profiles and personalized search results. * * @summary Get the current strategy. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getPersonalizationStrategy( requestOptions?: RequestOptions @@ -203,6 +207,7 @@ export function createPersonalizationClient( * @summary Get a user profile. * @param getUserTokenProfile - The getUserTokenProfile object. * @param getUserTokenProfile.userToken - UserToken representing the user for which to fetch the Personalization profile. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getUserTokenProfile( { userToken }: GetUserTokenProfileProps, @@ -244,6 +249,7 @@ export function createPersonalizationClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -281,6 +287,7 @@ export function createPersonalizationClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, @@ -315,6 +322,7 @@ export function createPersonalizationClient( * * @summary Set a new strategy. * @param personalizationStrategyParams - The personalizationStrategyParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ setPersonalizationStrategy( personalizationStrategyParams: PersonalizationStrategyParams, diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/allParams.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/allParams.ts new file mode 100644 index 0000000000..ad93ec6535 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/allParams.ts @@ -0,0 +1,4 @@ +import type { ModelsToRetrieve } from './modelsToRetrieve'; +import type { TypesToRetrieve } from './typesToRetrieve'; + +export type AllParams = ModelsToRetrieve & TypesToRetrieve; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/index.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/index.ts index d2e7b5ac21..9ca14d48da 100644 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/index.ts +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/index.ts @@ -1,8 +1,10 @@ export * from './affinities'; +export * from './allParams'; export * from './errorBase'; export * from './fetchUserProfileResponse'; export * from './funnelStage'; export * from './modelsToRetrieve'; +export * from './modelsToRetrieveEnum'; export * from './params'; export * from './predictions'; export * from './predictionsAffinities'; @@ -11,3 +13,4 @@ export * from './predictionsOrderValue'; export * from './properties'; export * from './segments'; export * from './typesToRetrieve'; +export * from './typesToRetrieveEnum'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieve.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieve.ts index f974186839..57b526e85d 100644 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieve.ts +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieve.ts @@ -1 +1,5 @@ -export type ModelsToRetrieve = 'affinities' | 'funnel_stage' | 'order_value'; +import type { ModelsToRetrieveEnum } from './modelsToRetrieveEnum'; + +export type ModelsToRetrieve = { + modelsToRetrieve: ModelsToRetrieveEnum[]; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieveEnum.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieveEnum.ts new file mode 100644 index 0000000000..581288c573 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/modelsToRetrieveEnum.ts @@ -0,0 +1,4 @@ +export type ModelsToRetrieveEnum = + | 'affinities' + | 'funnel_stage' + | 'order_value'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts index 0710550005..8d1b10e8ef 100644 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/params.ts @@ -1,16 +1,5 @@ +import type { AllParams } from './allParams'; import type { ModelsToRetrieve } from './modelsToRetrieve'; import type { TypesToRetrieve } from './typesToRetrieve'; -/** - * Object with models and types to retrieve. - */ -export type Params = { - /** - * List with model types for which to retrieve predictions. - */ - modelsToRetrieve?: ModelsToRetrieve[]; - /** - * List with types to be retrieved. - */ - typesToRetrieve?: TypesToRetrieve[]; -}; +export type Params = AllParams | ModelsToRetrieve | TypesToRetrieve; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieve.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieve.ts index b0bfd5837a..19a2a5f66c 100644 --- a/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieve.ts +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieve.ts @@ -1 +1,5 @@ -export type TypesToRetrieve = 'properties' | 'segments'; +import type { TypesToRetrieveEnum } from './typesToRetrieveEnum'; + +export type TypesToRetrieve = { + typesToRetrieve: TypesToRetrieveEnum[]; +}; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieveEnum.ts b/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieveEnum.ts new file mode 100644 index 0000000000..5065e34dc6 --- /dev/null +++ b/clients/algoliasearch-client-javascript/packages/client-predict/model/typesToRetrieveEnum.ts @@ -0,0 +1 @@ +export type TypesToRetrieveEnum = 'properties' | 'segments'; diff --git a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictClient.ts b/clients/algoliasearch-client-javascript/packages/client-predict/src/predictClient.ts index 1827a36156..c041ea340f 100644 --- a/clients/algoliasearch-client-javascript/packages/client-predict/src/predictClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-predict/src/predictClient.ts @@ -66,6 +66,7 @@ export function createPredictClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -101,6 +102,7 @@ export function createPredictClient( * @param fetchUserProfile - The fetchUserProfile object. * @param fetchUserProfile.userID - User ID for authenticated users or cookie ID for non-authenticated repeated users (visitors). * @param fetchUserProfile.params - The params object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ fetchUserProfile( { userID, params }: FetchUserProfileProps, @@ -148,6 +150,7 @@ export function createPredictClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -184,6 +187,7 @@ export function createPredictClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -221,6 +225,7 @@ export function createPredictClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsClient.ts b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsClient.ts index cc0cd7a317..ad3fec4011 100644 --- a/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsClient.ts @@ -68,6 +68,7 @@ export function createQuerySuggestionsClient( * * @summary Create a configuration. * @param querySuggestionsIndexWithIndexParam - The querySuggestionsIndexWithIndexParam object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ createConfig( querySuggestionsIndexWithIndexParam: QuerySuggestionsIndexWithIndexParam, @@ -106,6 +107,7 @@ export function createQuerySuggestionsClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -140,6 +142,7 @@ export function createQuerySuggestionsClient( * @summary Delete a configuration. * @param deleteConfig - The deleteConfig object. * @param deleteConfig.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteConfig( { indexName }: DeleteConfigProps, @@ -180,6 +183,7 @@ export function createQuerySuggestionsClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -212,6 +216,7 @@ export function createQuerySuggestionsClient( * Get all the configurations of Query Suggestions. For each index, you get a block of JSON with a list of its configuration settings. * * @summary List configurations. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getAllConfigs( requestOptions?: RequestOptions @@ -241,6 +246,7 @@ export function createQuerySuggestionsClient( * @summary Get a single configuration. * @param getConfig - The getConfig object. * @param getConfig.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getConfig( { indexName }: GetConfigProps, @@ -280,6 +286,7 @@ export function createQuerySuggestionsClient( * @summary Get configuration status. * @param getConfigStatus - The getConfigStatus object. * @param getConfigStatus.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getConfigStatus( { indexName }: GetConfigStatusProps, @@ -319,6 +326,7 @@ export function createQuerySuggestionsClient( * @summary Get a log file. * @param getLogFile - The getLogFile object. * @param getLogFile.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getLogFile( { indexName }: GetLogFileProps, @@ -360,6 +368,7 @@ export function createQuerySuggestionsClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -397,6 +406,7 @@ export function createQuerySuggestionsClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, @@ -433,6 +443,7 @@ export function createQuerySuggestionsClient( * @param updateConfig - The updateConfig object. * @param updateConfig.indexName - The index in which to perform the request. * @param updateConfig.querySuggestionsIndexParam - The querySuggestionsIndexParam object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ updateConfig( { indexName, querySuggestionsIndexParam }: UpdateConfigProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts b/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts index 028c7843e1..13f786626d 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts @@ -143,6 +143,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Create an API key. * @param apiKey - The apiKey object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ addApiKey( apiKey: ApiKey, @@ -188,6 +189,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param addOrUpdateObject.indexName - The index in which to perform the request. * @param addOrUpdateObject.objectID - Unique identifier of an object. * @param addOrUpdateObject.body - The Algolia object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ addOrUpdateObject( { indexName, objectID, body }: AddOrUpdateObjectProps, @@ -238,6 +240,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Add a single source. * @param source - The source to add. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ appendSource( source: Source, @@ -276,6 +279,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param assignUserId - The assignUserId object. * @param assignUserId.xAlgoliaUserID - UserID to assign. * @param assignUserId.assignUserIdParams - The assignUserIdParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ assignUserId( { xAlgoliaUserID, assignUserIdParams }: AssignUserIdProps, @@ -330,6 +334,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param batch - The batch object. * @param batch.indexName - The index in which to perform the request. * @param batch.batchWriteParams - The batchWriteParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ batch( { indexName, batchWriteParams }: BatchProps, @@ -377,6 +382,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param batchAssignUserIds - The batchAssignUserIds object. * @param batchAssignUserIds.xAlgoliaUserID - UserID to assign. * @param batchAssignUserIds.batchAssignUserIdsParams - The batchAssignUserIdsParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ batchAssignUserIds( { xAlgoliaUserID, batchAssignUserIdsParams }: BatchAssignUserIdsProps, @@ -436,6 +442,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param batchDictionaryEntries - The batchDictionaryEntries object. * @param batchDictionaryEntries.dictionaryName - The dictionary to search in. * @param batchDictionaryEntries.batchDictionaryEntriesParams - The batchDictionaryEntriesParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ batchDictionaryEntries( { @@ -494,6 +501,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param batchRules.rule - The rule object. * @param batchRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param batchRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ batchRules( { @@ -554,6 +562,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param browse - The browse object. * @param browse.indexName - The index in which to perform the request. * @param browse.browseRequest - The browseRequest object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ browse( { indexName, browseRequest }: BrowseProps, @@ -595,6 +604,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param clearAllSynonyms - The clearAllSynonyms object. * @param clearAllSynonyms.indexName - The index in which to perform the request. * @param clearAllSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ clearAllSynonyms( { indexName, forwardToReplicas }: ClearAllSynonymsProps, @@ -638,6 +648,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Clear all objects from an index. * @param clearObjects - The clearObjects object. * @param clearObjects.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ clearObjects( { indexName }: ClearObjectsProps, @@ -678,6 +689,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param clearRules - The clearRules object. * @param clearRules.indexName - The index in which to perform the request. * @param clearRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ clearRules( { indexName, forwardToReplicas }: ClearRulesProps, @@ -722,6 +734,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -756,6 +769,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Delete an API key. * @param deleteApiKey - The deleteApiKey object. * @param deleteApiKey.key - API Key string. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteApiKey( { key }: DeleteApiKeyProps, @@ -796,6 +810,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param deleteBy - The deleteBy object. * @param deleteBy.indexName - The index in which to perform the request. * @param deleteBy.searchParams - The searchParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteBy( { indexName, searchParams }: DeleteByProps, @@ -842,6 +857,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Delete index. * @param deleteIndex - The deleteIndex object. * @param deleteIndex.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteIndex( { indexName }: DeleteIndexProps, @@ -882,6 +898,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param deleteObject - The deleteObject object. * @param deleteObject.indexName - The index in which to perform the request. * @param deleteObject.objectID - Unique identifier of an object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteObject( { indexName, objectID }: DeleteObjectProps, @@ -928,6 +945,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param deleteRule.indexName - The index in which to perform the request. * @param deleteRule.objectID - Unique identifier of an object. * @param deleteRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteRule( { indexName, objectID, forwardToReplicas }: DeleteRuleProps, @@ -976,6 +994,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Remove a single source. * @param deleteSource - The deleteSource object. * @param deleteSource.source - The IP range of the source. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteSource( { source }: DeleteSourceProps, @@ -1017,6 +1036,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param deleteSynonym.indexName - The index in which to perform the request. * @param deleteSynonym.objectID - Unique identifier of an object. * @param deleteSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ deleteSynonym( { indexName, objectID, forwardToReplicas }: DeleteSynonymProps, @@ -1066,6 +1086,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -1100,6 +1121,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Get an API key. * @param getApiKey - The getApiKey object. * @param getApiKey.key - API Key string. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getApiKey( { key }: GetApiKeyProps, @@ -1137,6 +1159,7 @@ export function createSearchClient(options: CreateClientOptions) { * List dictionaries supported per language. * * @summary List available languages. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getDictionaryLanguages( requestOptions?: RequestOptions @@ -1164,6 +1187,7 @@ export function createSearchClient(options: CreateClientOptions) { * Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. * * @summary Retrieve dictionaries settings. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getDictionarySettings( requestOptions?: RequestOptions @@ -1196,6 +1220,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param getLogs.length - Maximum number of entries to retrieve. The maximum allowed value is 1000. * @param getLogs.indexName - Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getLogs( { offset, length, indexName, type }: GetLogsProps, @@ -1244,6 +1269,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param getObject.indexName - The index in which to perform the request. * @param getObject.objectID - Unique identifier of an object. * @param getObject.attributesToRetrieve - List of attributes to retrieve. If not specified, all retrievable attributes are returned. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getObject( { indexName, objectID, attributesToRetrieve }: GetObjectProps, @@ -1291,6 +1317,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Retrieve one or more objects. * @param getObjectsParams - The getObjectsParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getObjects( getObjectsParams: GetObjectsParams, @@ -1329,6 +1356,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param getRule - The getRule object. * @param getRule.indexName - The index in which to perform the request. * @param getRule.objectID - Unique identifier of an object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getRule( { indexName, objectID }: GetRuleProps, @@ -1373,6 +1401,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Retrieve settings of an index. * @param getSettings - The getSettings object. * @param getSettings.indexName - The index in which to perform the request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSettings( { indexName }: GetSettingsProps, @@ -1410,6 +1439,7 @@ export function createSearchClient(options: CreateClientOptions) { * List all allowed sources. * * @summary List all allowed sources. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSources(requestOptions?: RequestOptions): Promise { const requestPath = '/1/security/sources'; @@ -1438,6 +1468,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param getSynonym - The getSynonym object. * @param getSynonym.indexName - The index in which to perform the request. * @param getSynonym.objectID - Unique identifier of an object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getSynonym( { indexName, objectID }: GetSynonymProps, @@ -1483,6 +1514,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param getTask - The getTask object. * @param getTask.indexName - The index in which to perform the request. * @param getTask.taskID - Unique identifier of an task. Numeric value (up to 64bits). + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTask( { indexName, taskID }: GetTaskProps, @@ -1525,6 +1557,7 @@ export function createSearchClient(options: CreateClientOptions) { * Get the top 10 userIDs with the highest number of records per cluster. The data returned will usually be a few seconds behind real time, because userID usage may take up to a few seconds to propagate to the different clusters. Upon success, the response is 200 OK and contains the following array of userIDs and clusters. * * @summary Get top userID. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getTopUserIds( requestOptions?: RequestOptions @@ -1554,6 +1587,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Get userID. * @param getUserId - The getUserId object. * @param getUserId.userID - UserID to assign. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getUserId( { userID }: GetUserIdProps, @@ -1593,6 +1627,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Get migration status. * @param hasPendingMappings - The hasPendingMappings object. * @param hasPendingMappings.getClusters - Whether to get clusters or not. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ hasPendingMappings( { getClusters }: HasPendingMappingsProps, @@ -1625,6 +1660,7 @@ export function createSearchClient(options: CreateClientOptions) { * List API keys, along with their associated rights. * * @summary List API Keys. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listApiKeys(requestOptions?: RequestOptions): Promise { const requestPath = '/1/keys'; @@ -1650,6 +1686,7 @@ export function createSearchClient(options: CreateClientOptions) { * List the clusters available in a multi-clusters setup for a single appID. Upon success, the response is 200 OK and contains the following clusters. * * @summary List clusters. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listClusters( requestOptions?: RequestOptions @@ -1679,6 +1716,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary List existing indexes. * @param listIndices - The listIndices object. * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listIndices( { page }: ListIndicesProps, @@ -1714,6 +1752,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param listUserIds - The listUserIds object. * @param listUserIds.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ listUserIds( { page, hitsPerPage }: ListUserIdsProps, @@ -1751,6 +1790,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Batch operations to many indices. * @param batchParams - The batchParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ multipleBatch( batchParams: BatchParams, @@ -1787,6 +1827,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Search multiple indices. * @param multipleQueriesParams - The multipleQueriesParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ multipleQueries( multipleQueriesParams: MultipleQueriesParams, @@ -1831,6 +1872,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param operationIndex - The operationIndex object. * @param operationIndex.indexName - The index in which to perform the request. * @param operationIndex.operationIndexParams - The operationIndexParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ operationIndex( { indexName, operationIndexParams }: OperationIndexProps, @@ -1891,6 +1933,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param partialUpdateObject.objectID - Unique identifier of an object. * @param partialUpdateObject.attributeOrBuiltInOperation - List of attributes to update. * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ partialUpdateObject( { @@ -1953,6 +1996,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -1990,6 +2034,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, @@ -2025,6 +2070,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Remove userID. * @param removeUserId - The removeUserId object. * @param removeUserId.userID - UserID to assign. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ removeUserId( { userID }: RemoveUserIdProps, @@ -2064,6 +2110,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Replace all allowed sources. * @param replaceSources - The replaceSources object. * @param replaceSources.source - The sources to allow. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ replaceSources( { source }: ReplaceSourcesProps, @@ -2101,6 +2148,7 @@ export function createSearchClient(options: CreateClientOptions) { * @summary Restore an API key. * @param restoreApiKey - The restoreApiKey object. * @param restoreApiKey.key - API Key string. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ restoreApiKey( { key }: RestoreApiKeyProps, @@ -2141,6 +2189,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param saveObject - The saveObject object. * @param saveObject.indexName - The index in which to perform the request. * @param saveObject.body - The Algolia record. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ saveObject( { indexName, body }: SaveObjectProps, @@ -2190,6 +2239,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param saveRule.objectID - Unique identifier of an object. * @param saveRule.rule - The rule object. * @param saveRule.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ saveRule( { indexName, objectID, rule, forwardToReplicas }: SaveRuleProps, @@ -2259,6 +2309,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param saveSynonym.objectID - Unique identifier of an object. * @param saveSynonym.synonymHit - The synonymHit object. * @param saveSynonym.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ saveSynonym( { indexName, objectID, synonymHit, forwardToReplicas }: SaveSynonymProps, @@ -2323,6 +2374,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param saveSynonyms.synonymHit - The synonymHit object. * @param saveSynonyms.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. * @param saveSynonyms.replaceExistingSynonyms - Replace all synonyms of the index with the ones sent with this request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ saveSynonyms( { @@ -2384,6 +2436,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param search - The search object. * @param search.indexName - The index in which to perform the request. * @param search.searchParams - The searchParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ search( { indexName, searchParams }: SearchProps, @@ -2431,6 +2484,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param searchDictionaryEntries - The searchDictionaryEntries object. * @param searchDictionaryEntries.dictionaryName - The dictionary to search in. * @param searchDictionaryEntries.searchDictionaryEntriesParams - The searchDictionaryEntriesParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchDictionaryEntries( { @@ -2488,6 +2542,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param searchForFacetValues.indexName - The index in which to perform the request. * @param searchForFacetValues.facetName - The facet name. * @param searchForFacetValues.searchForFacetValuesRequest - The searchForFacetValuesRequest object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchForFacetValues( { @@ -2538,6 +2593,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param searchRules - The searchRules object. * @param searchRules.indexName - The index in which to perform the request. * @param searchRules.searchRulesParams - The searchRulesParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchRules( { indexName, searchRulesParams }: SearchRulesProps, @@ -2588,6 +2644,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param searchSynonyms.type - Only search for specific types of synonyms. * @param searchSynonyms.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). * @param searchSynonyms.hitsPerPage - Maximum number of objects to retrieve. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchSynonyms( { indexName, query, type, page, hitsPerPage }: SearchSynonymsProps, @@ -2642,6 +2699,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Search userID. * @param searchUserIdsParams - The searchUserIdsParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ searchUserIds( searchUserIdsParams: SearchUserIdsParams, @@ -2684,6 +2742,7 @@ export function createSearchClient(options: CreateClientOptions) { * * @summary Set dictionaries settings. * @param dictionarySettingsParams - The dictionarySettingsParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ setDictionarySettings( dictionarySettingsParams: DictionarySettingsParams, @@ -2729,6 +2788,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param setSettings.indexName - The index in which to perform the request. * @param setSettings.indexSettings - The indexSettings object. * @param setSettings.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ setSettings( { indexName, indexSettings, forwardToReplicas }: SetSettingsProps, @@ -2780,6 +2840,7 @@ export function createSearchClient(options: CreateClientOptions) { * @param updateApiKey - The updateApiKey object. * @param updateApiKey.key - API Key string. * @param updateApiKey.apiKey - The apiKey object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ updateApiKey( { key, apiKey }: UpdateApiKeyProps, diff --git a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesClient.ts b/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesClient.ts index 3250d303bd..9074dbacb7 100644 --- a/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesClient.ts @@ -63,6 +63,7 @@ export function createSourcesClient( * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -98,6 +99,7 @@ export function createSourcesClient( * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -134,6 +136,7 @@ export function createSourcesClient( * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -168,6 +171,7 @@ export function createSourcesClient( * * @summary Create fetch URL job. * @param postURLJob - The postURLJob object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ postIngestUrl( postURLJob: PostURLJob, @@ -223,6 +227,7 @@ export function createSourcesClient( * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, diff --git a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts index 45f7d132e5..9f2080b67d 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts @@ -89,6 +89,7 @@ export function createRecommendClient(options: CreateClientOptions) { * @param del - The del object. * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param del.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ del( { path, parameters }: DelProps, @@ -124,6 +125,7 @@ export function createRecommendClient(options: CreateClientOptions) { * @param get - The get object. * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param get.parameters - Query parameters to be applied to the current query. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ get( { path, parameters }: GetProps, @@ -157,6 +159,7 @@ export function createRecommendClient(options: CreateClientOptions) { * * @summary Get results. * @param getRecommendationsParams - The getRecommendationsParams object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ getRecommendations( getRecommendationsParams: GetRecommendationsParams, @@ -202,6 +205,7 @@ export function createRecommendClient(options: CreateClientOptions) { * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param post.parameters - Query parameters to be applied to the current query. * @param post.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ post( { path, parameters, body }: PostProps, @@ -239,6 +243,7 @@ export function createRecommendClient(options: CreateClientOptions) { * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified. * @param put.parameters - Query parameters to be applied to the current query. * @param put.body - The parameters to send with the custom request. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. */ put( { path, parameters, body }: PutProps, diff --git a/specs/bundled/predict.yml b/specs/bundled/predict.yml index 3ae05d776f..4555231ff6 100644 --- a/specs/bundled/predict.yml +++ b/specs/bundled/predict.yml @@ -49,17 +49,44 @@ components: message: type: string example: Invalid Application-Id or API-Key - modelsToRetrieve: + modelsToRetrieveEnum: type: string enum: - funnel_stage - order_value - affinities - typesToRetrieve: + modelsToRetrieve: + type: object + required: + - modelsToRetrieve + properties: + modelsToRetrieve: + type: array + items: + $ref: '#/components/schemas/modelsToRetrieveEnum' + typesToRetrieveEnum: type: string enum: - properties - segments + typesToRetrieve: + type: object + required: + - typesToRetrieve + properties: + typesToRetrieve: + type: array + items: + $ref: '#/components/schemas/typesToRetrieveEnum' + allParams: + allOf: + - $ref: '#/components/schemas/modelsToRetrieve' + - $ref: '#/components/schemas/typesToRetrieve' + params: + oneOf: + - $ref: '#/components/schemas/modelsToRetrieve' + - $ref: '#/components/schemas/typesToRetrieve' + - $ref: '#/components/schemas/allParams' responses: BadRequest: description: Bad request or request arguments. @@ -236,22 +263,7 @@ paths: content: application/json: schema: - title: params - type: object - description: Object with models and types to retrieve. - additionalProperties: false - properties: - modelsToRetrieve: - type: array - description: List with model types for which to retrieve predictions. - items: - $ref: '#/components/schemas/modelsToRetrieve' - typesToRetrieve: - type: array - description: List with types to be retrieved. - items: - $ref: '#/components/schemas/typesToRetrieve' - minItems: 1 + $ref: '#/components/schemas/params' responses: '200': description: OK From 10ac6ebef3897535151c29801107ece480afecc2 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 14:28:34 +0200 Subject: [PATCH 09/15] remove generated changes 2 --- .../com/algolia/model/predict/AllParams.java | 110 +++++++++++++ .../model/predict/ModelsToRetrieve.java | 100 +++++++----- .../model/predict/ModelsToRetrieveEnum.java | 59 +++++++ .../com/algolia/model/predict/Params.java | 144 ++++++++---------- .../model/predict/TypesToRetrieve.java | 98 +++++++----- .../model/predict/TypesToRetrieveEnum.java | 57 +++++++ 6 files changed, 408 insertions(+), 160 deletions(-) create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/AllParams.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieveEnum.java create mode 100644 clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieveEnum.java diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/AllParams.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/AllParams.java new file mode 100644 index 0000000000..07ef43702f --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/AllParams.java @@ -0,0 +1,110 @@ +package com.algolia.model.predict; + +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** AllParams */ +public class AllParams { + + @SerializedName("modelsToRetrieve") + private List modelsToRetrieve = new ArrayList<>(); + + @SerializedName("typesToRetrieve") + private List typesToRetrieve = new ArrayList<>(); + + public AllParams setModelsToRetrieve( + List modelsToRetrieve + ) { + this.modelsToRetrieve = modelsToRetrieve; + return this; + } + + public AllParams addModelsToRetrieveItem( + ModelsToRetrieveEnum modelsToRetrieveItem + ) { + this.modelsToRetrieve.add(modelsToRetrieveItem); + return this; + } + + /** + * Get modelsToRetrieve + * + * @return modelsToRetrieve + */ + @javax.annotation.Nonnull + public List getModelsToRetrieve() { + return modelsToRetrieve; + } + + public AllParams setTypesToRetrieve( + List typesToRetrieve + ) { + this.typesToRetrieve = typesToRetrieve; + return this; + } + + public AllParams addTypesToRetrieveItem( + TypesToRetrieveEnum typesToRetrieveItem + ) { + this.typesToRetrieve.add(typesToRetrieveItem); + return this; + } + + /** + * Get typesToRetrieve + * + * @return typesToRetrieve + */ + @javax.annotation.Nonnull + public List getTypesToRetrieve() { + return typesToRetrieve; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllParams allParams = (AllParams) o; + return ( + Objects.equals(this.modelsToRetrieve, allParams.modelsToRetrieve) && + Objects.equals(this.typesToRetrieve, allParams.typesToRetrieve) + ); + } + + @Override + public int hashCode() { + return Objects.hash(modelsToRetrieve, typesToRetrieve); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllParams {\n"); + sb + .append(" modelsToRetrieve: ") + .append(toIndentedString(modelsToRetrieve)) + .append("\n"); + sb + .append(" typesToRetrieve: ") + .append(toIndentedString(typesToRetrieve)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieve.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieve.java index 6d747edaed..669c4aedf4 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieve.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieve.java @@ -1,59 +1,79 @@ package com.algolia.model.predict; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; -/** Gets or Sets modelsToRetrieve */ -@JsonAdapter(ModelsToRetrieve.Adapter.class) -public enum ModelsToRetrieve { - FUNNEL_STAGE("funnel_stage"), +/** ModelsToRetrieve */ +public class ModelsToRetrieve { - ORDER_VALUE("order_value"), + @SerializedName("modelsToRetrieve") + private List modelsToRetrieve = new ArrayList<>(); - AFFINITIES("affinities"); - - private final String value; - - ModelsToRetrieve(String value) { - this.value = value; + public ModelsToRetrieve setModelsToRetrieve( + List modelsToRetrieve + ) { + this.modelsToRetrieve = modelsToRetrieve; + return this; } - public String getValue() { - return value; + public ModelsToRetrieve addModelsToRetrieveItem( + ModelsToRetrieveEnum modelsToRetrieveItem + ) { + this.modelsToRetrieve.add(modelsToRetrieveItem); + return this; } - @Override - public String toString() { - return String.valueOf(value); + /** + * Get modelsToRetrieve + * + * @return modelsToRetrieve + */ + @javax.annotation.Nonnull + public List getModelsToRetrieve() { + return modelsToRetrieve; } - public static ModelsToRetrieve fromValue(String value) { - for (ModelsToRetrieve b : ModelsToRetrieve.values()) { - if (b.value.equals(value)) { - return b; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + ModelsToRetrieve modelsToRetrieve = (ModelsToRetrieve) o; + return Objects.equals( + this.modelsToRetrieve, + modelsToRetrieve.modelsToRetrieve + ); } - public static class Adapter extends TypeAdapter { + @Override + public int hashCode() { + return Objects.hash(modelsToRetrieve); + } - @Override - public void write( - final JsonWriter jsonWriter, - final ModelsToRetrieve enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelsToRetrieve {\n"); + sb + .append(" modelsToRetrieve: ") + .append(toIndentedString(modelsToRetrieve)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } - @Override - public ModelsToRetrieve read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return ModelsToRetrieve.fromValue(value); + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieveEnum.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieveEnum.java new file mode 100644 index 0000000000..73160dc2a8 --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/ModelsToRetrieveEnum.java @@ -0,0 +1,59 @@ +package com.algolia.model.predict; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** Gets or Sets modelsToRetrieveEnum */ +@JsonAdapter(ModelsToRetrieveEnum.Adapter.class) +public enum ModelsToRetrieveEnum { + FUNNEL_STAGE("funnel_stage"), + + ORDER_VALUE("order_value"), + + AFFINITIES("affinities"); + + private final String value; + + ModelsToRetrieveEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ModelsToRetrieveEnum fromValue(String value) { + for (ModelsToRetrieveEnum b : ModelsToRetrieveEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final ModelsToRetrieveEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ModelsToRetrieveEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return ModelsToRetrieveEnum.fromValue(value); + } + } +} diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/Params.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/Params.java index 9d68a20de3..c279e3b0b6 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/Params.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/Params.java @@ -1,108 +1,88 @@ package com.algolia.model.predict; -import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; +import com.algolia.JSON; +import com.algolia.utils.CompoundType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; -/** Object with models and types to retrieve. */ -public class Params { +@JsonAdapter(Params.Adapter.class) +public abstract class Params implements CompoundType { - @SerializedName("modelsToRetrieve") - private List modelsToRetrieve = null; - - @SerializedName("typesToRetrieve") - private List typesToRetrieve = null; - - public Params setModelsToRetrieve(List modelsToRetrieve) { - this.modelsToRetrieve = modelsToRetrieve; - return this; + public static Params ofAllParams(AllParams inside) { + return new ParamsAllParams(inside); } - public Params addModelsToRetrieveItem(ModelsToRetrieve modelsToRetrieveItem) { - if (this.modelsToRetrieve == null) { - this.modelsToRetrieve = new ArrayList<>(); - } - this.modelsToRetrieve.add(modelsToRetrieveItem); - return this; + public static Params ofModelsToRetrieve(ModelsToRetrieve inside) { + return new ParamsModelsToRetrieve(inside); } - /** - * List with model types for which to retrieve predictions. - * - * @return modelsToRetrieve - */ - @javax.annotation.Nullable - public List getModelsToRetrieve() { - return modelsToRetrieve; + public static Params ofTypesToRetrieve(TypesToRetrieve inside) { + return new ParamsTypesToRetrieve(inside); } - public Params setTypesToRetrieve(List typesToRetrieve) { - this.typesToRetrieve = typesToRetrieve; - return this; - } + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter out, final Params oneOf) + throws IOException { + TypeAdapter runtimeTypeAdapter = (TypeAdapter) JSON + .getGson() + .getAdapter(TypeToken.get(oneOf.getInsideValue().getClass())); + runtimeTypeAdapter.write(out, oneOf.getInsideValue()); + } - public Params addTypesToRetrieveItem(TypesToRetrieve typesToRetrieveItem) { - if (this.typesToRetrieve == null) { - this.typesToRetrieve = new ArrayList<>(); + @Override + public Params read(final JsonReader jsonReader) throws IOException { + return null; } - this.typesToRetrieve.add(typesToRetrieveItem); - return this; } +} + +@JsonAdapter(Params.Adapter.class) +class ParamsAllParams extends Params { + + private final AllParams insideValue; - /** - * List with types to be retrieved. - * - * @return typesToRetrieve - */ - @javax.annotation.Nullable - public List getTypesToRetrieve() { - return typesToRetrieve; + ParamsAllParams(AllParams insideValue) { + this.insideValue = insideValue; } @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Params params = (Params) o; - return ( - Objects.equals(this.modelsToRetrieve, params.modelsToRetrieve) && - Objects.equals(this.typesToRetrieve, params.typesToRetrieve) - ); + public AllParams getInsideValue() { + return insideValue; } +} - @Override - public int hashCode() { - return Objects.hash(modelsToRetrieve, typesToRetrieve); +@JsonAdapter(Params.Adapter.class) +class ParamsModelsToRetrieve extends Params { + + private final ModelsToRetrieve insideValue; + + ParamsModelsToRetrieve(ModelsToRetrieve insideValue) { + this.insideValue = insideValue; } @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Params {\n"); - sb - .append(" modelsToRetrieve: ") - .append(toIndentedString(modelsToRetrieve)) - .append("\n"); - sb - .append(" typesToRetrieve: ") - .append(toIndentedString(typesToRetrieve)) - .append("\n"); - sb.append("}"); - return sb.toString(); + public ModelsToRetrieve getInsideValue() { + return insideValue; } +} - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); +@JsonAdapter(Params.Adapter.class) +class ParamsTypesToRetrieve extends Params { + + private final TypesToRetrieve insideValue; + + ParamsTypesToRetrieve(TypesToRetrieve insideValue) { + this.insideValue = insideValue; + } + + @Override + public TypesToRetrieve getInsideValue() { + return insideValue; } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieve.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieve.java index 004f1458de..1e21d9c7f1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieve.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieve.java @@ -1,57 +1,79 @@ package com.algolia.model.predict; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; +import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; -/** Gets or Sets typesToRetrieve */ -@JsonAdapter(TypesToRetrieve.Adapter.class) -public enum TypesToRetrieve { - PROPERTIES("properties"), +/** TypesToRetrieve */ +public class TypesToRetrieve { - SEGMENTS("segments"); + @SerializedName("typesToRetrieve") + private List typesToRetrieve = new ArrayList<>(); - private final String value; - - TypesToRetrieve(String value) { - this.value = value; + public TypesToRetrieve setTypesToRetrieve( + List typesToRetrieve + ) { + this.typesToRetrieve = typesToRetrieve; + return this; } - public String getValue() { - return value; + public TypesToRetrieve addTypesToRetrieveItem( + TypesToRetrieveEnum typesToRetrieveItem + ) { + this.typesToRetrieve.add(typesToRetrieveItem); + return this; } - @Override - public String toString() { - return String.valueOf(value); + /** + * Get typesToRetrieve + * + * @return typesToRetrieve + */ + @javax.annotation.Nonnull + public List getTypesToRetrieve() { + return typesToRetrieve; } - public static TypesToRetrieve fromValue(String value) { - for (TypesToRetrieve b : TypesToRetrieve.values()) { - if (b.value.equals(value)) { - return b; - } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + TypesToRetrieve typesToRetrieve = (TypesToRetrieve) o; + return Objects.equals( + this.typesToRetrieve, + typesToRetrieve.typesToRetrieve + ); } - public static class Adapter extends TypeAdapter { + @Override + public int hashCode() { + return Objects.hash(typesToRetrieve); + } - @Override - public void write( - final JsonWriter jsonWriter, - final TypesToRetrieve enumeration - ) throws IOException { - jsonWriter.value(enumeration.getValue()); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypesToRetrieve {\n"); + sb + .append(" typesToRetrieve: ") + .append(toIndentedString(typesToRetrieve)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } - @Override - public TypesToRetrieve read(final JsonReader jsonReader) - throws IOException { - String value = jsonReader.nextString(); - return TypesToRetrieve.fromValue(value); + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); } } diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieveEnum.java b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieveEnum.java new file mode 100644 index 0000000000..8b07cfbb3b --- /dev/null +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/model/predict/TypesToRetrieveEnum.java @@ -0,0 +1,57 @@ +package com.algolia.model.predict; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** Gets or Sets typesToRetrieveEnum */ +@JsonAdapter(TypesToRetrieveEnum.Adapter.class) +public enum TypesToRetrieveEnum { + PROPERTIES("properties"), + + SEGMENTS("segments"); + + private final String value; + + TypesToRetrieveEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypesToRetrieveEnum fromValue(String value) { + for (TypesToRetrieveEnum b : TypesToRetrieveEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write( + final JsonWriter jsonWriter, + final TypesToRetrieveEnum enumeration + ) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypesToRetrieveEnum read(final JsonReader jsonReader) + throws IOException { + String value = jsonReader.nextString(); + return TypesToRetrieveEnum.fromValue(value); + } + } +} From d3262e65d949d29bde29f56cd7df4ecba7a005fe Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 14:35:07 +0200 Subject: [PATCH 10/15] remove gen --- config/generation.config.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/config/generation.config.js b/config/generation.config.js index 5341361bcb..7fe777d97d 100644 --- a/config/generation.config.js +++ b/config/generation.config.js @@ -14,11 +14,8 @@ module.exports = { '!clients/algoliasearch-client-java-2/.gitignore', '!clients/algoliasearch-client-java-2/gradle/wrapper/**', '!clients/algoliasearch-client-java-2/algoliasearch-core/build.gradle', - '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/*', - '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/*', - 'clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponse*.java', - '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/EchoResponseInterface.java', - '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/echo/CallEcho.java', + '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/exceptions/**', + '!clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/**', // JavaScript '!clients/algoliasearch-client-javascript/*', From ef897d18f973bff60a34cfebd04476c976b39b24 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 14:43:18 +0200 Subject: [PATCH 11/15] don't remove all files when clean cts --- .github/workflows/check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7b9aba1fe9..e7509d0cee 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -225,7 +225,9 @@ jobs: - name: Clean CTS output before generate if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} - run: rm -rf ${{ matrix.client.testsOutputPath }} + run: | + rm -rf ${{ matrix.client.testsOutputPath }}/client || true + rm -rf ${{ matrix.client.testsOutputPath }}/methods || true - name: Generate CTS if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} From d08cf1b271127ec4bd0d6da79fcd6a1324bdd53a Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 15:44:07 +0200 Subject: [PATCH 12/15] review --- .github/workflows/check.yml | 5 ++--- scripts/ci/githubActions/createMatrix.ts | 8 +++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e7509d0cee..9c6131056f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -226,8 +226,7 @@ jobs: - name: Clean CTS output before generate if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} run: | - rm -rf ${{ matrix.client.testsOutputPath }}/client || true - rm -rf ${{ matrix.client.testsOutputPath }}/methods || true + rm -rf ${{ matrix.client.testsOutputPathToClean }} || true - name: Generate CTS if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} @@ -237,7 +236,7 @@ jobs: if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} run: | git --no-pager diff - exit $(git diff --name-only --diff-filter=d ${{ matrix.client.testsOutputPath }} | wc -l) + exit $(git diff --name-only --diff-filter=d ${{ matrix.client.testsOutputPathToClean }} | wc -l) - name: Run CTS if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index 292e75fafd..5cd47fc71a 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -97,6 +97,10 @@ async function getClientMatrix(baseBranch: string): Promise { continue; } + const testOutputBase = `./tests/output/${language}/${getTestOutputFolder( + language + )}`; + clientMatrix.client.push({ language, path: matrix[language].path, @@ -107,9 +111,7 @@ async function getClientMatrix(baseBranch: string): Promise { `templates/${language}`, `generators/src`, ]), - testsOutputPath: `./tests/output/${language}/${getTestOutputFolder( - language - )}`, + testsOutputPath: `${testOutputBase}/client ${testOutputBase}/methods`, }); } From 3e842c80dcddbe9a5b502b14543e2f7732a80dd0 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 15:59:37 +0200 Subject: [PATCH 13/15] smaller git diff --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9c6131056f..539595f02f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -235,7 +235,7 @@ jobs: - name: Check diff with pushed CTS if: ${{ needs.setup.outputs.RUN_CTS == 'true' }} run: | - git --no-pager diff + git --no-pager diff ${{ matrix.client.testsOutputPathToClean }} exit $(git diff --name-only --diff-filter=d ${{ matrix.client.testsOutputPathToClean }} | wc -l) - name: Run CTS From 25d9d65a7fd02ed692936c5d276719bc2a663b28 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 16:10:45 +0200 Subject: [PATCH 14/15] rename in script --- scripts/ci/githubActions/createMatrix.ts | 2 +- scripts/ci/githubActions/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index 5cd47fc71a..d962561044 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -111,7 +111,7 @@ async function getClientMatrix(baseBranch: string): Promise { `templates/${language}`, `generators/src`, ]), - testsOutputPath: `${testOutputBase}/client ${testOutputBase}/methods`, + testsOutputPathToClean: `${testOutputBase}/client ${testOutputBase}/methods`, }); } diff --git a/scripts/ci/githubActions/types.ts b/scripts/ci/githubActions/types.ts index 648eb92c50..781e1177d7 100644 --- a/scripts/ci/githubActions/types.ts +++ b/scripts/ci/githubActions/types.ts @@ -32,7 +32,7 @@ export type ClientMatrix = BaseMatrix & { /** * The test output path to clean. */ - testsOutputPath: string; + testsOutputPathToClean: string; }; export type SpecMatrix = BaseMatrix & { From 59df1c7c4a84dd47e3d7f964bc99d5b53a1f9010 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 10 May 2022 16:47:57 +0200 Subject: [PATCH 15/15] review --- .github/workflows/check.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 56a01e6655..ebfb0adce2 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -225,6 +225,11 @@ jobs: - name: Generate CTS run: yarn cli cts generate ${{ matrix.client.language }} ${{ matrix.client.toRun }} + - name: Check diff with pushed CTS + run: | + git --no-pager diff -- ${{ matrix.client.testsOutputPathToClean }} + exit $(git diff --name-only --diff-filter=d ${{ matrix.client.testsOutputPathToClean }} | wc -l) + - name: Run CTS run: yarn cli cts run ${{ matrix.client.language }}