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 328eb67b1d..a1f6e9538c 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 @@ -1,10 +1,7 @@ package com.algolia; import com.algolia.exceptions.*; -import com.algolia.utils.AlgoliaAgent; -import com.algolia.utils.JSON; -import com.algolia.utils.RequestOptions; -import com.algolia.utils.Requester; +import com.algolia.utils.*; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; @@ -277,6 +274,8 @@ public void onResponse(Call call, Response response) * @param headerParams The header parameters * @param requestOptions The requestOptions to send along with the query, they will be merged with * the transporter requestOptions. + * @param useReadTransporter Some POST methods in the Algolia REST API uses the `read` + * transporter. This information is defined at the spec level. * @return The HTTP call * @throws AlgoliaRuntimeException If fail to serialize the request body object */ @@ -286,7 +285,8 @@ public Call buildCall( Map queryParameters, Object body, Map headerParams, - RequestOptions requestOptions + RequestOptions requestOptions, + Boolean useReadTransporter ) throws AlgoliaRuntimeException { Request request = buildRequest( path, @@ -294,7 +294,8 @@ public Call buildCall( queryParameters, body, headerParams, - requestOptions + requestOptions, + useReadTransporter ); return requester.newCall(request); @@ -311,6 +312,8 @@ public Call buildCall( * @param headerParams The header parameters * @param requestOptions The requestOptions to send along with the query, they will be merged with * the transporter requestOptions. + * @param useReadTransporter Some POST methods in the Algolia REST API uses the `read` + * transporter. This information is defined at the spec level. * @return The HTTP request * @throws AlgoliaRuntimeException If fail to serialize the request body object */ @@ -320,7 +323,8 @@ public Request buildRequest( Map queryParameters, Object body, Map headerParams, - RequestOptions requestOptions + RequestOptions requestOptions, + Boolean useReadTransporter ) throws AlgoliaRuntimeException { boolean hasRequestOptions = requestOptions != null; final String url = buildUrl( @@ -350,6 +354,10 @@ public Request buildRequest( reqBody = serialize(body); } + if (useReadTransporter) { + reqBuilder.tag(new UseReadTransporter()); + } + return reqBuilder.method(method, reqBody).build(); } @@ -435,20 +443,4 @@ public void processHeaderParams( } } } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding( - Map formParams - ) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } } 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 6548bb13f7..d624568bc3 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 @@ -143,7 +143,8 @@ public CompletableFuture addABTestsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -236,7 +237,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -320,7 +322,8 @@ public CompletableFuture deleteABTestAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -412,7 +415,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -495,7 +499,8 @@ public CompletableFuture getABTestAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -586,7 +591,8 @@ public CompletableFuture listABTestsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -697,7 +703,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -810,7 +817,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -898,7 +906,8 @@ public CompletableFuture stopABTestAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 205269045b..5026262281 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 @@ -161,7 +161,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -267,7 +268,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -417,7 +419,8 @@ public CompletableFuture getAverageClickPositio queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -574,7 +577,8 @@ public CompletableFuture getClickPositionsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -717,7 +721,8 @@ public CompletableFuture getClickThroughRateAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -866,7 +871,8 @@ public CompletableFuture getConversationRateAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1015,7 +1021,8 @@ public CompletableFuture getNoClickRateAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1158,7 +1165,8 @@ public CompletableFuture getNoResultsRateAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1299,7 +1307,8 @@ public CompletableFuture getSearchesCountAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1486,7 +1495,8 @@ public CompletableFuture getSearchesNoClicksAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1698,7 +1708,8 @@ public CompletableFuture getSearchesNoResultsAsync queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -1817,7 +1828,8 @@ public CompletableFuture getStatusAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1985,7 +1997,8 @@ public CompletableFuture getTopCountriesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2209,7 +2222,8 @@ public CompletableFuture getTopFilterAttributesA queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -2470,7 +2484,8 @@ public CompletableFuture getTopFilterForAttrib queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -2713,7 +2728,8 @@ public CompletableFuture getTopFiltersNoResultsA queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -2965,7 +2981,8 @@ public CompletableFuture getTopHitsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3234,7 +3251,8 @@ public CompletableFuture getTopSearchesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3413,7 +3431,8 @@ public CompletableFuture getUsersCountAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3528,7 +3547,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3641,7 +3661,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 dd7d68328d..57ca0160fb 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 @@ -161,7 +161,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -267,7 +268,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -379,7 +381,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -480,7 +483,8 @@ public CompletableFuture pushEventsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -579,7 +583,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 810eaf0a72..b5da63d337 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 @@ -147,7 +147,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -245,7 +246,8 @@ public CompletableFuture deleteUserProfileAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -338,7 +340,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -414,7 +417,8 @@ public CompletableFuture getPersonalizationStrate queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -499,7 +503,8 @@ public CompletableFuture getUserTokenProfileAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -598,7 +603,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -711,7 +717,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -803,7 +810,8 @@ public CompletableFuture setPersonalizationS queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); 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 a936557445..c628997731 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 @@ -143,7 +143,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -247,7 +248,8 @@ public CompletableFuture fetchUserProfileAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -341,7 +343,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -453,7 +456,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -566,7 +570,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 8ce50dc34c..9c0c3cf626 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 @@ -129,7 +129,8 @@ public CompletableFuture createConfigAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -222,7 +223,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -312,7 +314,8 @@ public CompletableFuture deleteConfigAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -404,7 +407,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -478,7 +482,8 @@ public CompletableFuture> getAllConfigsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken>() {}.getType(); return this.executeAsync(call, returnType); @@ -550,7 +555,8 @@ public CompletableFuture getConfigAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -628,7 +634,8 @@ public CompletableFuture getConfigStatusAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -700,7 +707,8 @@ public CompletableFuture> getLogFileAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken>() {}.getType(); return this.executeAsync(call, returnType); @@ -798,7 +806,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -911,7 +920,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1013,7 +1023,8 @@ public CompletableFuture updateConfigAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 3b3b3f5e07..2f2ccedba2 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 @@ -181,7 +181,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -287,7 +288,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -374,7 +376,8 @@ public CompletableFuture getRecommendationsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -473,7 +476,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -586,7 +590,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 3d41828bfe..bb827a64c2 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 @@ -158,7 +158,8 @@ public CompletableFuture addApiKeyAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -258,7 +259,8 @@ public CompletableFuture addOrUpdateObjectAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -330,7 +332,8 @@ public CompletableFuture appendSourceAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -422,7 +425,8 @@ public CompletableFuture assignUserIdAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -510,7 +514,8 @@ public CompletableFuture batchAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -611,7 +616,8 @@ public CompletableFuture batchAssignUserIdsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -713,7 +719,8 @@ public CompletableFuture batchDictionaryEntriesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -858,7 +865,8 @@ public CompletableFuture batchRulesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -982,7 +990,8 @@ public CompletableFuture browseAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1097,7 +1106,8 @@ public CompletableFuture clearAllSynonymsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1185,7 +1195,8 @@ public CompletableFuture clearObjectsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1287,7 +1298,8 @@ public CompletableFuture clearRulesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1393,7 +1405,8 @@ public CompletableFuture delAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1479,7 +1492,8 @@ public CompletableFuture deleteApiKeyAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1569,7 +1583,8 @@ public CompletableFuture deleteByAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1643,7 +1658,8 @@ public CompletableFuture deleteIndexAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1729,7 +1745,8 @@ public CompletableFuture deleteObjectAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1845,7 +1862,8 @@ public CompletableFuture deleteRuleAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -1935,7 +1953,8 @@ public CompletableFuture deleteSourceAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2050,7 +2069,8 @@ public CompletableFuture deleteSynonymAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2165,7 +2185,8 @@ public CompletableFuture getAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2248,7 +2269,8 @@ public CompletableFuture getApiKeyAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2306,7 +2328,8 @@ public CompletableFuture> getDictionaryLanguagesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken>() {}.getType(); return this.executeAsync(call, returnType); @@ -2366,7 +2389,8 @@ public CompletableFuture getDictionarySettingsAsy queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -2480,7 +2504,8 @@ public CompletableFuture getLogsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2609,7 +2634,8 @@ public CompletableFuture> getObjectAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken>() {}.getType(); return this.executeAsync(call, returnType); @@ -2698,7 +2724,8 @@ public CompletableFuture getObjectsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2784,7 +2811,8 @@ public CompletableFuture getRuleAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2858,7 +2886,8 @@ public CompletableFuture getSettingsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -2914,7 +2943,8 @@ public CompletableFuture> getSourcesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken>() {}.getType(); return this.executeAsync(call, returnType); @@ -2999,7 +3029,8 @@ public CompletableFuture getSynonymAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3086,7 +3117,8 @@ public CompletableFuture getTaskAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3150,7 +3182,8 @@ public CompletableFuture getTopUserIdsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3225,7 +3258,8 @@ public CompletableFuture getUserIdAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3310,7 +3344,8 @@ public CompletableFuture hasPendingMappingsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3378,7 +3413,8 @@ public CompletableFuture listApiKeysAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3436,7 +3472,8 @@ public CompletableFuture listClustersAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3515,7 +3552,8 @@ public CompletableFuture listIndicesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3621,7 +3659,8 @@ public CompletableFuture listUserIdsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3706,7 +3745,8 @@ public CompletableFuture multipleBatchAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3794,7 +3834,8 @@ public CompletableFuture operationIndexAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -3956,7 +3997,8 @@ public CompletableFuture partialUpdateObjectAsync queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {} .getType(); @@ -4094,7 +4136,8 @@ public CompletableFuture postAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4207,7 +4250,8 @@ public CompletableFuture putAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4296,7 +4340,8 @@ public CompletableFuture removeUserIdAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4365,7 +4410,8 @@ public CompletableFuture replaceSourcesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4438,7 +4484,8 @@ public CompletableFuture restoreApiKeyAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4522,7 +4569,8 @@ public CompletableFuture saveObjectAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4659,7 +4707,8 @@ public CompletableFuture saveRuleAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -4834,7 +4883,8 @@ public CompletableFuture saveSynonymAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5010,7 +5060,8 @@ public CompletableFuture saveSynonymsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5111,7 +5162,8 @@ public CompletableFuture searchAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5208,7 +5260,8 @@ public CompletableFuture searchDictionaryEntriesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5338,7 +5391,8 @@ public CompletableFuture searchForFacetValuesAsync queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {} .getType(); @@ -5453,7 +5507,8 @@ public CompletableFuture searchRulesAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5541,7 +5596,8 @@ public CompletableFuture searchSingleIndexAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5684,7 +5740,8 @@ public CompletableFuture searchSynonymsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5799,7 +5856,8 @@ public CompletableFuture searchUserIdsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + true ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5872,7 +5930,8 @@ public CompletableFuture setDictionarySettingsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -5996,7 +6055,8 @@ public CompletableFuture setSettingsAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); @@ -6108,7 +6168,8 @@ public CompletableFuture updateApiKeyAsync( queryParameters, bodyObj, headers, - requestOptions + requestOptions, + false ); Type returnType = new TypeToken() {}.getType(); return this.executeAsync(call, returnType); 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 73d618115b..0b8b7c6131 100644 --- a/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts +++ b/clients/algoliasearch-client-javascript/packages/algoliasearch-lite/src/algoliasearchLiteClient.ts @@ -151,6 +151,7 @@ export function createAlgoliasearchLiteClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchMethodParams, + useReadTransporter: true, }; return transporter.request( 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 2d47b8dd87..8df367eaf4 100644 --- a/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts +++ b/clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts @@ -1368,6 +1368,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: getObjectsParams, + useReadTransporter: true, }; return transporter.request( @@ -2448,6 +2449,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchMethodParams, + useReadTransporter: true, }; return transporter.request( @@ -2505,6 +2507,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchDictionaryEntriesParams, + useReadTransporter: true, }; return transporter.request( @@ -2557,6 +2560,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchForFacetValuesRequest, + useReadTransporter: true, }; return transporter.request( @@ -2605,6 +2609,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchRulesParams, + useReadTransporter: true, }; return transporter.request( @@ -2653,6 +2658,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchParams, + useReadTransporter: true, }; return transporter.request( @@ -2713,6 +2719,7 @@ export function createSearchClient(options: CreateClientOptions) { const request: Request = { method: 'POST', path: requestPath, + useReadTransporter: true, }; return transporter.request( @@ -2756,6 +2763,7 @@ export function createSearchClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: searchUserIdsParams, + useReadTransporter: true, }; return transporter.request( diff --git a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts index 355dc099e3..df601917e4 100644 --- a/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts +++ b/clients/algoliasearch-client-javascript/packages/recommend/src/recommendClient.ts @@ -185,6 +185,7 @@ export function createRecommendClient(options: CreateClientOptions) { method: 'POST', path: requestPath, data: getRecommendationsParams, + useReadTransporter: true, }; return transporter.request( diff --git a/clients/algoliasearch-client-php/lib/Api/AbtestingClient.php b/clients/algoliasearch-client-php/lib/Api/AbtestingClient.php index 2dfe3a7c5f..702b169af4 100644 --- a/clients/algoliasearch-client-php/lib/Api/AbtestingClient.php +++ b/clients/algoliasearch-client-php/lib/Api/AbtestingClient.php @@ -36,7 +36,6 @@ public function __construct( AbtestingConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -495,7 +494,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -512,26 +512,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/AnalyticsClient.php b/clients/algoliasearch-client-php/lib/Api/AnalyticsClient.php index 7c4fdb009e..f7f47a984a 100644 --- a/clients/algoliasearch-client-php/lib/Api/AnalyticsClient.php +++ b/clients/algoliasearch-client-php/lib/Api/AnalyticsClient.php @@ -36,7 +36,6 @@ public function __construct( AnalyticsConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -1754,7 +1753,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -1771,26 +1771,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/InsightsClient.php b/clients/algoliasearch-client-php/lib/Api/InsightsClient.php index 4f995870ea..f7b26c099e 100644 --- a/clients/algoliasearch-client-php/lib/Api/InsightsClient.php +++ b/clients/algoliasearch-client-php/lib/Api/InsightsClient.php @@ -35,7 +35,6 @@ public function __construct( InsightsConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -332,7 +331,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -349,26 +349,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/PersonalizationClient.php b/clients/algoliasearch-client-php/lib/Api/PersonalizationClient.php index 59527d87e1..a8b9cb842f 100644 --- a/clients/algoliasearch-client-php/lib/Api/PersonalizationClient.php +++ b/clients/algoliasearch-client-php/lib/Api/PersonalizationClient.php @@ -36,7 +36,6 @@ public function __construct( PersonalizationConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -450,7 +449,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -467,26 +467,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsClient.php b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsClient.php index d5d9d2231a..03116bbceb 100644 --- a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsClient.php +++ b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsClient.php @@ -36,7 +36,6 @@ public function __construct( QuerySuggestionsConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -603,7 +602,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -620,26 +620,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/RecommendClient.php b/clients/algoliasearch-client-php/lib/Api/RecommendClient.php index dcab314ff8..4a395a739d 100644 --- a/clients/algoliasearch-client-php/lib/Api/RecommendClient.php +++ b/clients/algoliasearch-client-php/lib/Api/RecommendClient.php @@ -35,7 +35,6 @@ public function __construct( RecommendConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -223,7 +222,8 @@ public function getRecommendations( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -335,7 +335,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -352,26 +353,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Api/SearchClient.php b/clients/algoliasearch-client-php/lib/Api/SearchClient.php index 1934bd653d..59f70f82f9 100644 --- a/clients/algoliasearch-client-php/lib/Api/SearchClient.php +++ b/clients/algoliasearch-client-php/lib/Api/SearchClient.php @@ -36,7 +36,6 @@ public function __construct( SearchConfig $config ) { $this->config = $config; - $this->api = $apiWrapper; } @@ -1525,7 +1524,8 @@ public function getObjects($getObjectsParams, $requestOptions = []) $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -2784,7 +2784,8 @@ public function search($searchMethodParams, $requestOptions = []) $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -2853,7 +2854,8 @@ public function searchDictionaryEntries( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -2931,7 +2933,8 @@ public function searchForFacetValues( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -3002,7 +3005,8 @@ public function searchRules( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -3066,7 +3070,8 @@ public function searchSingleIndex( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -3136,7 +3141,8 @@ public function searchSynonyms( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -3183,7 +3189,8 @@ public function searchUserIds($searchUserIdsParams, $requestOptions = []) $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + true ); } @@ -3372,7 +3379,8 @@ private function sendRequest( $headers, $queryParameters, $httpBody, - $requestOptions + $requestOptions, + $useReadTransporter = false ) { if (!isset($requestOptions['headers'])) { $requestOptions['headers'] = []; @@ -3389,26 +3397,16 @@ private function sendRequest( $queryParameters, $requestOptions['queryParameters'] ); - $query = \GuzzleHttp\Psr7\Query::build( $requestOptions['queryParameters'] ); - if ($method === 'GET') { - $request = $this->api->read( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $requestOptions - ); - } else { - $request = $this->api->write( - $method, - $resourcePath . ($query ? "?{$query}" : ''), - $httpBody, - $requestOptions - ); - } - - return $request; + return $this->api->sendRequest( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody, + $requestOptions, + $useReadTransporter + ); } } diff --git a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php index d5d049349c..7bca493145 100644 --- a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php +++ b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php @@ -58,12 +58,12 @@ public function __construct(array $config = []) { if (isset($config['apiKey'])) { $this->setAlgoliaApiKey($config['apiKey']); - $this->setApiKey('X-Algolia-API-Key', $config['apiKey']); + $this->setApiKey('x-algolia-api-key', $config['apiKey']); } if (isset($config['appId'])) { $this->setAppId($config['appId']); - $this->setApiKey('X-Algolia-Application-Id', $config['appId']); + $this->setApiKey('x-algolia-application-id', $config['appId']); } $config += $this->getDefaultConfiguration(); diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php index 7324eac2d0..4d5c6921dd 100644 --- a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php +++ b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php @@ -50,8 +50,7 @@ private function normalize($options) 'headers' => [ 'x-algolia-application-id' => $this->config->getAppId(), 'x-algolia-api-key' => $this->config->getAlgoliaApiKey(), - 'User-Agent' => - $this->config->getAlgoliaAgent() !== null + 'User-Agent' => $this->config->getAlgoliaAgent() !== null ? $this->config->getAlgoliaAgent() : AlgoliaAgent::get(), 'Content-Type' => 'application/json', diff --git a/specs/bundled/algoliasearch-lite.yml b/specs/bundled/algoliasearch-lite.yml index cbdb4da342..a1c1b8759c 100644 --- a/specs/bundled/algoliasearch-lite.yml +++ b/specs/bundled/algoliasearch-lite.yml @@ -2020,6 +2020,7 @@ paths: tags: - algoliasearch-lite operationId: search + x-use-read-transporter: true summary: Search multiple indices. description: Perform a search operation targeting one or many indices. requestBody: diff --git a/specs/bundled/recommend.yml b/specs/bundled/recommend.yml index d40658e9b0..0b4c155112 100644 --- a/specs/bundled/recommend.yml +++ b/specs/bundled/recommend.yml @@ -1128,6 +1128,7 @@ paths: tags: - recommend operationId: getRecommendations + x-use-read-transporter: true summary: Get results. description: >- Returns recommendations or trending results, for a specific model and diff --git a/specs/bundled/search.yml b/specs/bundled/search.yml index e06a7f5671..72519a79b7 100644 --- a/specs/bundled/search.yml +++ b/specs/bundled/search.yml @@ -2098,6 +2098,7 @@ paths: tags: - search operationId: searchSingleIndex + x-use-read-transporter: true summary: Search in a single index. description: Perform a search operation targeting one specific index. parameters: @@ -2128,6 +2129,7 @@ paths: tags: - search operationId: search + x-use-read-transporter: true summary: Search multiple indices. description: Perform a search operation targeting one or many indices. requestBody: @@ -2191,6 +2193,7 @@ paths: tags: - search operationId: searchForFacetValues + x-use-read-transporter: true summary: Search for values of a given facet. description: >- Search for values of a given facet, optionally restricting the returned @@ -2678,6 +2681,7 @@ paths: tags: - search operationId: getObjects + x-use-read-transporter: true summary: Retrieve one or more objects. description: >- Retrieve one or more objects, potentially from different indices, in a @@ -2942,6 +2946,7 @@ paths: tags: - search operationId: searchSynonyms + x-use-read-transporter: true summary: Search synonyms. description: Search or browse all synonyms, optionally filtering them by type. parameters: @@ -3275,6 +3280,7 @@ paths: tags: - search operationId: searchRules + x-use-read-transporter: true summary: Search for rules. description: Search for rules matching various criteria. parameters: @@ -3412,6 +3418,7 @@ paths: tags: - search operationId: searchDictionaryEntries + x-use-read-transporter: true description: Search the dictionary entries. summary: Search a dictionary entries. parameters: @@ -3821,6 +3828,7 @@ paths: tags: - search operationId: searchUserIds + x-use-read-transporter: true summary: Search userID. description: > Search for userIDs. diff --git a/tests/output/javascript/src/client/recommend.test.ts b/tests/output/javascript/src/client/recommend.test.ts index aa470268ad..3edfe7487b 100644 --- a/tests/output/javascript/src/client/recommend.test.ts +++ b/tests/output/javascript/src/client/recommend.test.ts @@ -25,7 +25,7 @@ describe('api', () => { } expect(actual).toEqual( - expect.objectContaining({ host: 'test-app-id.algolia.net' }) + expect.objectContaining({ host: 'test-app-id-dsn.algolia.net' }) ); }); @@ -59,7 +59,7 @@ describe('api', () => { } expect(actual).toEqual( - expect.objectContaining({ connectTimeout: 2, responseTimeout: 30 }) + expect.objectContaining({ connectTimeout: 2, responseTimeout: 5 }) ); }); }); diff --git a/tests/output/javascript/src/client/search.test.ts b/tests/output/javascript/src/client/search.test.ts index bc06404ae9..ac1257cb2f 100644 --- a/tests/output/javascript/src/client/search.test.ts +++ b/tests/output/javascript/src/client/search.test.ts @@ -25,7 +25,7 @@ describe('api', () => { } expect(actual).toEqual( - expect.objectContaining({ host: 'test-app-id.algolia.net' }) + expect.objectContaining({ host: 'test-app-id-dsn.algolia.net' }) ); }); @@ -59,7 +59,7 @@ describe('api', () => { } expect(actual).toEqual( - expect.objectContaining({ connectTimeout: 2, responseTimeout: 30 }) + expect.objectContaining({ connectTimeout: 2, responseTimeout: 5 }) ); }); });