Skip to content

Commit

Permalink
chore: generated code for commit f47a6a7. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed May 11, 2022
1 parent f47a6a7 commit 3e91d84
Show file tree
Hide file tree
Showing 16 changed files with 1,082 additions and 1,080 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public void onResponse(Call call, Response response)
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and
* "DELETE"
* @param queryParams The query parameters
* @param queryParameters The query parameters
* @param body The request body object
* @param headerParams The header parameters
* @param requestOptions The requestOptions to send along with the query, they will be merged with
Expand All @@ -283,15 +283,15 @@ public void onResponse(Call call, Response response)
public Call buildCall(
String path,
String method,
Map<String, String> queryParams,
Map<String, String> queryParameters,
Object body,
Map<String, String> headerParams,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Request request = buildRequest(
path,
method,
queryParams,
queryParameters,
body,
headerParams,
requestOptions
Expand All @@ -306,7 +306,7 @@ public Call buildCall(
* @param path The sub-path of the HTTP URL
* @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and
* "DELETE"
* @param queryParams The query parameters
* @param queryParameters The query parameters
* @param body The request body object
* @param headerParams The header parameters
* @param requestOptions The requestOptions to send along with the query, they will be merged with
Expand All @@ -317,16 +317,16 @@ public Call buildCall(
public Request buildRequest(
String path,
String method,
Map<String, String> queryParams,
Map<String, String> queryParameters,
Object body,
Map<String, String> headerParams,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
boolean hasRequestOptions = requestOptions != null;
final String url = buildUrl(
path,
queryParams,
hasRequestOptions ? requestOptions.getExtraQueryParams() : null
queryParameters,
hasRequestOptions ? requestOptions.getExtraQueryParameters() : null
);
final Request.Builder reqBuilder = new Request.Builder().url(url);
processHeaderParams(
Expand Down Expand Up @@ -357,22 +357,22 @@ public Request buildRequest(
* Build full URL by concatenating base path, the given sub path and query parameters.
*
* @param path The sub path
* @param queryParams The query parameters
* @param extraQueryParams The query parameters, coming from the requestOptions
* @param queryParameters The query parameters
* @param extraQueryParameters The query parameters, coming from the requestOptions
* @return The full URL
*/
public String buildUrl(
String path,
Map<String, String> queryParams,
Map<String, String> extraQueryParams
Map<String, String> queryParameters,
Map<String, String> extraQueryParameters
) {
StringBuilder url = new StringBuilder();

// The real host will be assigned by the retry strategy
url.append("http://temp.path").append(path);

url = parseQueryParameters(path, url, queryParams);
url = parseQueryParameters(path, url, extraQueryParams);
url = parseQueryParameters(path, url, queryParameters);
url = parseQueryParameters(path, url, extraQueryParameters);

return url.toString();
}
Expand All @@ -381,19 +381,19 @@ public String buildUrl(
* Parses the given map of Query Parameters to a given URL.
*
* @param path The sub path
* @param url The url to add queryParams to
* @param queryParams The query parameters
* @param url The url to add queryParameters to
* @param queryParameters The query parameters
* @return The URL
*/
public StringBuilder parseQueryParameters(
String path,
StringBuilder url,
Map<String, String> queryParams
Map<String, String> queryParameters
) {
if (queryParams != null && !queryParams.isEmpty()) {
if (queryParameters != null && !queryParameters.isEmpty()) {
// support (constant) query string in `path`, e.g. "/posts?draft=1"
String prefix = path.contains("?") ? "&" : "?";
for (Entry<String, String> param : queryParams.entrySet()) {
for (Entry<String, String> param : queryParameters.entrySet()) {
if (param.getValue() != null) {
if (prefix != null) {
url.append(prefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ public CompletableFuture<ABTestResponse> addABTestsAsync(
// create path and map variables
String requestPath = "/2/abtests";

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

Call call =
this.buildCall(
requestPath,
"POST",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -217,12 +217,12 @@ public CompletableFuture<Object> delAsync(
// create path and map variables
String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString());

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

if (parameters != null) {
for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
queryParams.put(
queryParameters.put(
parameter.getKey().toString(),
parameterToString(parameter.getValue())
);
Expand All @@ -233,7 +233,7 @@ public CompletableFuture<Object> delAsync(
this.buildCall(
requestPath,
"DELETE",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -310,14 +310,14 @@ public CompletableFuture<ABTestResponse> deleteABTestAsync(
this.escapeString(id.toString())
);

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

Call call =
this.buildCall(
requestPath,
"DELETE",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -393,12 +393,12 @@ public CompletableFuture<Object> getAsync(
// create path and map variables
String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString());

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

if (parameters != null) {
for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
queryParams.put(
queryParameters.put(
parameter.getKey().toString(),
parameterToString(parameter.getValue())
);
Expand All @@ -409,7 +409,7 @@ public CompletableFuture<Object> getAsync(
this.buildCall(
requestPath,
"GET",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -485,14 +485,14 @@ public CompletableFuture<ABTest> getABTestAsync(
this.escapeString(id.toString())
);

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

Call call =
this.buildCall(
requestPath,
"GET",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -568,22 +568,22 @@ public CompletableFuture<ListABTestsResponse> listABTestsAsync(
// create path and map variables
String requestPath = "/2/abtests";

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

if (offset != null) {
queryParams.put("offset", parameterToString(offset));
queryParameters.put("offset", parameterToString(offset));
}

if (limit != null) {
queryParams.put("limit", parameterToString(limit));
queryParameters.put("limit", parameterToString(limit));
}

Call call =
this.buildCall(
requestPath,
"GET",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -678,12 +678,12 @@ public CompletableFuture<Object> postAsync(
// create path and map variables
String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString());

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

if (parameters != null) {
for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
queryParams.put(
queryParameters.put(
parameter.getKey().toString(),
parameterToString(parameter.getValue())
);
Expand All @@ -694,7 +694,7 @@ public CompletableFuture<Object> postAsync(
this.buildCall(
requestPath,
"POST",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -791,12 +791,12 @@ public CompletableFuture<Object> putAsync(
// create path and map variables
String requestPath = "/1{path}".replaceAll("\\{path\\}", path.toString());

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

if (parameters != null) {
for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
queryParams.put(
queryParameters.put(
parameter.getKey().toString(),
parameterToString(parameter.getValue())
);
Expand All @@ -807,7 +807,7 @@ public CompletableFuture<Object> putAsync(
this.buildCall(
requestPath,
"PUT",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down Expand Up @@ -888,14 +888,14 @@ public CompletableFuture<ABTestResponse> stopABTestAsync(
this.escapeString(id.toString())
);

Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> queryParameters = new HashMap<String, String>();
Map<String, String> headers = new HashMap<String, String>();

Call call =
this.buildCall(
requestPath,
"POST",
queryParams,
queryParameters,
bodyObj,
headers,
requestOptions
Expand Down
Loading

0 comments on commit 3e91d84

Please sign in to comment.